commonMain.moe.tlaster.precompose.navigation.PopUpTo.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of precompose-jvm Show documentation
Show all versions of precompose-jvm Show documentation
A third-party Jetbrains Compose library with ViewModel, LiveData and Navigation support.
The newest version!
package moe.tlaster.precompose.navigation
sealed interface PopUpTo {
/**
* Whether the `popUpTo` destination should be popped from the back stack.
*/
val inclusive: Boolean get() = false
/**
* do nothing
*/
object None : PopUpTo
/**
* pop prev back stack
*/
object Prev : PopUpTo {
override val inclusive: Boolean get() = true
}
/**
* The `popUpTo` destination, if it's an empty string will clear all backstack
* @param route the route to pop up to
* @param inclusive whether the `popUpTo` destination should be popped from the back stack.
*/
data class Route(
val route: String,
override val inclusive: Boolean,
) : PopUpTo
companion object {
/**
* popUpTo first back stack
* @param inclusive whether the `popUpTo` destination should be popped from the back stack.
*/
@Suppress("FunctionName")
fun First(inclusive: Boolean = true): PopUpTo = Route("", inclusive)
}
}
/**
* The `popUpTo` destination, if it's an empty string will clear all backstack
* @param route the route to pop up to
* @param inclusive whether the `popUpTo` destination should be popped from the back stack.
*/
@Suppress("FunctionName")
fun PopUpTo(route: String, inclusive: Boolean = false) = PopUpTo.Route(
route = route,
inclusive = inclusive,
)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy