# compose

Kayacan Kaya

01/11/2021, 6:52 PM
Hello everyone. I have a question about fullscreen composables. While using Scaffold (and its bottom bar for navigation) and NavHost (attached to the bottom bar) together, opening a fullscreen composable from a content composable of Scaffold fills the content composable’s area as expected. To open them fullscreen covering the whole, another NavHost should be placed on the layer above the Scaffold in order to get rid of the scope of content composable.* However, I do not want to include all fullscreen pages in the same NavHost as it violates my architecture. In order to place fullscreen composables in their respective packages (not including them in one nav host), I have customized Scaffold whose bottom bar is stateful just like in  BottomDrawerLayout. I am hiding/showing bottom bar while navigating to fullscreen composables from the content composable of the Scaffold by the NavHosts inside the content composables. Though it supported my architecture, it feels like I am breaking the KISS principle 🙂 Do you have any other suggestions? (*One of Jetpack’s example apps Jetsnack has an example usage of Navhost used for fullscreens in git branch dedicated to navigation. You can check it out if you’re interested in the topic)

Dejan Predovic

01/12/2021, 6:49 PM
Hi! I also had a problem like that. At the end I added another NavController/NavHost at the very top of the hierarchy. Something like:
private sealed class MainNavigation(val route: String) { object Home : MainNavigation("home") object SomethingElse : MainNavigation("somethingelse") } @Composable fun MainScreen() { val navController = rememberNavController() NavHost(navController, startDestination = MainNavigation.Home.route) { composable(MainNavigation.Home.route) { HomeScreen(navController) } composable(MainNavigation.SomethingElse.route) { SomethingElse(navController) } } }
You pass the navController so your screens can navigate back and forth. Each screen can have it's own with or without Scaffold/Navigation/whatever.

Kayacan Kaya

01/13/2021, 6:58 AM
Hi, thanks for your time and response. I examined your code and as far as I understood, this does not solve my problem unfortunately.