Young Rock
10/09/2022, 7:18 AMNavController
in the form of CompositionLocal
?yschimke
10/09/2022, 9:19 AMYoung Rock
10/09/2022, 9:28 AMonClickXxx
which are flowed up by child composable, that make the top screen's code full of navigation logic.yschimke
10/09/2022, 9:44 AMnlindberg
10/09/2022, 10:16 AMval contentController = rememberAnimatedNavController()
mainViewModel.configure(contentController)
val starRoute = mainViewModel.startRoute()
Then in the childs e.g:
navigationActions.navigate(ContentScreen.DetailsScreen(it.id))
where NavigationActions is an interface on mainviewmodel.
override fun navigate(screen: ContentScreen) {
viewModelScope.launch {
val current = contentController?.currentDestination?.route
if (current != screen.route) contentController?.navigate(screen.route)
}
}
yschimke
10/09/2022, 10:39 AMnlindberg
10/09/2022, 10:42 AMnlindberg
10/09/2022, 11:17 AM