I’ve tried the new Navigation Component and it rea...
# compose
j
I’ve tried the new Navigation Component and it really works well so far. I’m still struggling with some concepts. My App has a Bottom Navigation and a TopAppBar. My questions: 1. Can I split up the navigation? E.g. I want to open a new part of the App without the Bottom Navigation. Or should I integrate that part in my main NavHost and just decompose the BottomBar? I’m not sure if this scales well in larger projects. I’m also unsure how to model this if multiple screens are visible (e.g. some semi-transparent screen on top of the one selected by the Bottom Navigation). 2. I want to dynamically change the title of my TopAppBar from a part of my UI. Is there an elegant way to do this? Currently I’m passing in the NavController and change the title with a given Argument. But this seems not that nice, since I have to add this parameter to every route. And I’m not able to change the title dynamically afterwards. Should I create a state for the title and pass it to every Composable which can change the State?
i
1. Generally your Scaffold is above the NavHost. You'd just not output a bottom navigation bar based on whatever state you want. You're responsible for figuring out what that logic is and you could make it as complicated (a combined flow with multiple inputs including the current destination) or uncomplicated (a
mutableStateOf
boolean hoisted state) as it makes sense for your app 2. Again, you are in total control over how you represent state, who can change that state, etc.