-
Notifications
You must be signed in to change notification settings - Fork 331
Open
Description
snippets/compose/snippets/src/main/java/com/example/compose/snippets/components/Navigation.kt
Lines 153 to 180 in 2421773
| @Composable | |
| fun NavigationRailExample(modifier: Modifier = Modifier) { | |
| val navController = rememberNavController() | |
| val startDestination = Destination.SONGS | |
| var selectedDestination by rememberSaveable { mutableIntStateOf(startDestination.ordinal) } | |
| Scaffold(modifier = modifier) { contentPadding -> | |
| NavigationRail(modifier = Modifier.padding(contentPadding)) { | |
| Destination.entries.forEachIndexed { index, destination -> | |
| NavigationRailItem( | |
| selected = selectedDestination == index, | |
| onClick = { | |
| navController.navigate(route = destination.route) | |
| selectedDestination = index | |
| }, | |
| icon = { | |
| Icon( | |
| destination.icon, | |
| contentDescription = destination.contentDescription | |
| ) | |
| }, | |
| label = { Text(destination.label) } | |
| ) | |
| } | |
| } | |
| AppNavHost(navController, startDestination) | |
| } | |
| } |
This current example is not visible because it doesn't put the navigation rail in a row layout with it's navhost.
Metadata
Metadata
Assignees
Labels
No labels