Skip to content

Instantly share code, notes, and snippets.

@Farhandroid
Last active March 1, 2022 12:13
Show Gist options
  • Save Farhandroid/3436734fce56c38bb780b1405b9f1992 to your computer and use it in GitHub Desktop.
Save Farhandroid/3436734fce56c38bb780b1405b9f1992 to your computer and use it in GitHub Desktop.
BottomItem
@Composable
fun RowScope.BottomItem(
screen: BottomNavigationItem,
currentDestination: NavDestination?,
navController: NavHostController,
) {
//RowScope.BottomNavigationItem
BottomNavigationItem(
icon = { Icon(painterResource(id = screen.icon), contentDescription = screen.title) },
selected = currentDestination?.hierarchy?.any {
it.route == screen.screen_route
} == true,
unselectedContentColor = LocalContentColor.current.copy(alpha = ContentAlpha.disabled),
onClick = {
navController.navigate(screen.screen_route)
}
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment