Skip to content

Missing Row Layout in Example for NavigationRail #760

Description

@nibuen

@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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions