Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import kotlin.coroutines.cancellation.CancellationException
import kotlinx.coroutines.flow.Flow
import kotlinx.serialization.Serializable

@Serializable data object Home
@Serializable data object Settings

@Composable
private fun PredictiveBackOverrideExit(
Expand All @@ -56,7 +60,7 @@ private fun PredictiveBackOverrideExit(
// [START android_compose_predictiveback_navhost]
NavHost(
navController = navController,
startDestination = "home",
startDestination = Home,
popExitTransition = {
scaleOut(
targetScale = 0.9f,
Expand All @@ -70,13 +74,13 @@ private fun PredictiveBackOverrideExit(
)
// [END android_compose_predictiveback_navhost]
{
composable("home") {
composable<Home> {
HomeScreen(
modifier = modifier,
navController = navController,
)
}
composable("settings") {
composable<Settings> {
SettingsScreen(
modifier = modifier,
navController = navController,
Expand Down Expand Up @@ -119,6 +123,7 @@ private fun PredictiveBackHandlerBasicExample() {
boxScale = 1F - (1F * backEvent.progress)
}
// code for completion
boxScale = 0F
} catch (e: CancellationException) {
// code for cancellation
boxScale = 1F
Expand Down
Loading