Fix bottom bar scaffold navigation

Change-Id: I5ca88c5d99f20daf4299ab13b3454990c4d9fc1d
feature/adaptive_scaffold
Miłosz Moczkowski 1 year ago
parent 7cc7702c92
commit e6c0176bfd

@ -294,6 +294,7 @@ private fun <T> RailScaffold(
snackbarHost = snackbarHost,
containerColor = colors.contentContainerColor,
contentColor = colors.contentColor,
contentWindowInsets = contentWindowInsets,
) { padding ->
content(padding)
}
@ -399,6 +400,7 @@ fun <T> AdaptiveScaffold(
content: @Composable (padding: PaddingValues) -> Unit,
) {
val isDetailsPaneVisible by navigator.isVisible.collectAsState(initial = false)
AdaptiveScaffold(
modifier = modifier,
navigationItems = navigationItems,

@ -64,10 +64,11 @@ class AdaptiveScaffoldNavigator : Navigator<Destination>() {
value = backStackEntry
}
}
val backStackEntry = currentBackStackEntry
backStackEntry?.LocalOwnersProvider(saveableStateHolder) {
val destination = (backStackEntry.destination as? Destination)
destination?.content?.invoke(backStackEntry)
currentBackStackEntry?.let { backStackEntry ->
backStackEntry.LocalOwnersProvider(saveableStateHolder) {
val destination = backStackEntry.destination as Destination
destination.content(backStackEntry)
}
}
}
@ -82,12 +83,12 @@ class AdaptiveScaffoldNavigator : Navigator<Destination>() {
navigatorExtras: Extras?,
) {
entries.forEach { entry ->
state.pushWithTransition(entry)
state.push(entry)
}
}
override fun popBackStack(popUpTo: NavBackStackEntry, savedState: Boolean) {
state.popWithTransition(popUpTo, savedState)
state.pop(popUpTo, savedState)
}
@NavDestination.ClassType(Composable::class)

@ -38,7 +38,7 @@ internal class TopicArgs(val topicId: String) {
fun NavController.navigateToTopic(topicId: String) {
val encodedId = Uri.encode(topicId)
this.navigate("topic_route/$encodedId") {
launchSingleTop = true
popBackStack("topic_route/{$topicIdArg}", inclusive = true)
}
}

Loading…
Cancel
Save