Created
February 8, 2022 07:40
-
-
Save kasem-sm/d0ee9e6e7e6c698e26c56e6187f79a4f to your computer and use it in GitHub Desktop.
Navigation Overview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
internal fun SlimeBottomBar( | |
navController: NavController, | |
items: List<BottomNavigationItems>, | |
) { | |
Column { | |
val currentRoute = navController.currentRouteAsState() | |
NavigationBar { | |
items.forEach { item -> | |
NavigationBarItem( | |
icon = { | |
Icon( | |
painter = painterResource(id = item.icon), | |
modifier = Modifier.size(22.dp), | |
contentDescription = item.title, | |
tint = MaterialTheme.colorScheme.onSurfaceVariant, | |
) | |
}, | |
selected = currentRoute == item.route, | |
onClick = { | |
if (navController.currentDestination?.route != item.route) { | |
navController.navigate(item.route) { | |
popUpTo(navController.graph.findStartDestination().id) { | |
saveState = true | |
} | |
launchSingleTop = true | |
restoreState = true | |
} | |
} | |
} | |
) | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal fun NavGraphBuilder.attachSignUpScreen( | |
navController: NavController, | |
) { | |
composable(Routes.RegisterScreen.route) { | |
RegisterScreen( | |
viewModel = hiltViewModel(), | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment