Skip to content

Missing Row Layout in Example for NavigationRail #760

@nibuen

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.

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