How can we use this with bottom navigator of Scaffold?
See original GitHub issueHi, thanks for the exciting library.
I have a question about getting a navigator at the Scaffold bottom navigator.
When using Scaffold with vanilla nav host, we usually do like this,
@Composable
fun RallyApp() {
RallyTheme {
val allScreens = RallyScreen.values().toList()
val navController = rememberNavController()
val backstackEntry = navController.currentBackStackEntryAsState()
val currentScreen = RallyScreen.fromRoute(
backstackEntry.value?.destination?.route
)
Scaffold(
topBar = {
RallyTabRow(
allScreens = allScreens,
onTabSelected = { screen -> navController.navigate(screen.name) },
currentScreen = currentScreen
)
}
) { innerPadding ->
RallyNavHost(
navController = navController,
modifier = Modifier.padding(innerPadding)
)
}
}
}
But when using Destinations,
how can we give navigator to the top or bottom bar…? In this situation?
@Composable
fun RallyApp() {
RallyTheme {
val allScreens = RallyScreen.values().toList()
Scaffold(
topBar = {
RallyTabRow(
allScreens = allScreens,
// todo: how can we give navigator?
onTabSelected = { screen -> navigator.navigate(screen.name) },
currentScreen = currentScreen
)
}
) { innerPadding ->
DestinationsNavHost(navGraph = NavGraphs.root)
}
}
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (8 by maintainers)
Top Results From Across the Web
BottomNavigationBar class - material library - Dart API
A bottom navigation bar is usually used in conjunction with a Scaffold, where it is provided as the Scaffold.bottomNavigationBar argument.
Read more >How to build a bottom navigation bar in Flutter - LogRocket Blog
This tutorial demonstrates how to build, integrate, and customize a bottom navigation bar in a Flutter app.
Read more >Flutter - Custom Bottom Navigation Bar - GeeksforGeeks
A bottom navigation bar is a material widget that is present at the bottom of an app for selecting or navigating to different...
Read more >Flutter Bottom Navigation Bar with Multiple Navigators: A Case ...
In the Scaffold body, create a Stack with one child for each tab. Each child is an Offstage widget with a child Navigator...
Read more >Bottom Navigation and Navigation Drawer Using Scaffold from ...
In this post I'll show navigation using bottom navigation (and ... And this is all we need to use scaffold for holding our...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Buggyy This is my toy project, so it’s a public repo, this is it. https://github.com/wangmir/calliope/blob/d08fc6d872e2a18da1a3c84513335a7b09b55771/app/src/main/java/com/wangmir/calliope/ui/view/Home.kt
(I changed address, in case I fix the code in the future.)
@Buggyy let me know if there is any way I can help! 😃
I plan to have some tutorials for specific cases like this to complement the sample app. I have a lot of things in mind still, but I want to do that eventually. Meanwhile, if there is any way I can help!