BottomSheetNavDemo
@Composable
fun BottomSheetNavDemo() {
val bottomSheetNavigator = rememberBottomSheetNavigator()
val navController = rememberNavController(bottomSheetNavigator)
ModalBottomSheetLayout(bottomSheetNavigator) {
NavHost(navController, Destinations.Home) {
composable(Destinations.Home) {
HomeScreen(
showSheet = {
navController.navigate(Destinations.Sheet + "?arg=From Home Screen")
},
showFeed = { navController.navigate(Destinations.Feed) },
)
}
composable(Destinations.Feed) { Text("Feed!") }
bottomSheet(Destinations.Sheet + "?arg={arg}") { backstackEntry ->
val arg = backstackEntry.arguments?.getString("arg") ?: "Missing argument :("
BottomSheet(
showFeed = { navController.navigate(Destinations.Feed) },
showAnotherSheet = {
navController.navigate(Destinations.Sheet + "?arg=${UUID.randomUUID()}")
},
arg = arg,
)
}
}
}
}