Advertisement
Shesko_Andrey

Untitled

Nov 13th, 2023
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1.  
  2. //Отсяда видно как перехожу к ботомшиту
  3. @OptIn(ExperimentalAnimationApi::class)
  4. @Composable
  5. @Destination
  6. @RootNavGraph(start = true)
  7. fun HomeScreen(navigator: NavController)
  8. {
  9. val viewModel = viewModel<HomeScreenViewModel>()
  10. HomeScreenContent(
  11. items = viewModel.items,
  12. onAdd = {
  13. navigator.navigateTo(EditBookScreenDestination)
  14. {
  15. launchSingleTop = true
  16.  
  17. restoreState = true
  18.  
  19. }
  20. },
  21. onRemove = viewModel::onClickRemoveBook
  22. )
  23.  
  24. }
  25.  
  26.  
  27.  
  28. // сам ботомшит
  29. @OptIn(ExperimentalMaterialNavigationApi::class, ExperimentalMaterial3Api::class)
  30. @ExperimentalAnimationApi
  31. @Destination()
  32. @Composable
  33. fun EditBookScreen(navigator:NavController) {
  34. ModalBottomSheet(onDismissRequest = {
  35. navigator.navigateTo(HomeScreenDestination)
  36. {
  37. launchSingleTop = true
  38. restoreState = true
  39. popUpTo(NavGraphs.root)
  40. {
  41.  
  42. }
  43. }
  44. })
  45. {......}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement