I have a Scaffold like this:
Scaffold(
topBar = {
TopBar(...)
},
bottomBar = {
BottomNavigationBar(...)
}
) {
NavHost(...)
}
What is the best way to change TopBar when I navigate to another screen?
I have a Scaffold like this:
Scaffold(
topBar = {
TopBar(...)
},
bottomBar = {
BottomNavigationBar(...)
}
) {
NavHost(...)
}
What is the best way to change TopBar when I navigate to another screen?
There are two possible ways to go:
Observing currentScreen and use when inside topBar and change it according to that
Put topbar inside the screen it belongs to.
For me prefer the second one since it's not shared with each other, there's no reason to use ugly when statement for it.