Hello everyone! I have a navigation related questi...
# compose
p
Hello everyone! I have a navigation related question. My app has a NavDrawer with two screens. All the screens has a TopAppBar. When I'm on there screens, I can use the Drawer and can see the "hamburger menu" on the top left corner. From the first screen, I can navigate to a Details screen, which has the same TopAppBar except the "hamburger menu", instead there is a back arrow. My question is, how can I implement the navigation between the Drawer screens and to the Detials screen?
This is my current implementation. But I want to open ArticleScreen "on top of" the Drawer screens.
Copy code
@Composable
fun AppMainScreen() {
    val scaffoldState = rememberScaffoldState()
    val navController = rememberNavController()
    val scope = rememberCoroutineScope()

    Scaffold(
        drawerContent = {
            MyDrawer(
                onDestinationClicked = { route ->
                    navController.navigate(route) {
                        popUpTo(navController.graph.startDestinationId)
                        launchSingleTop = true
                    }
                    scope.launch {
                        scaffoldState.drawerState.close()
                    }
                }
            )
        },
        drawerBackgroundColor = MaterialTheme.colors.background,
        drawerContentColor = MaterialTheme.colors.onBackground,
        topBar = {
            MyTopBar(
                navigationIcon = {
                    Icon(
                        imageVector = <http://Icons.Default.Menu|Icons.Default.Menu>,
                        contentDescription = null,
                        modifier = Modifier
                            .padding(start = 16.dp)
                            .clickable(onClick = {
                                scope.launch { scaffoldState.drawerState.open() }
                            })
                    )
                }
            )
        },
        bottomBar = { Footer() },
        scaffoldState = scaffoldState,
        content = { paddingValues ->
            Surface(modifier = Modifier.padding(paddingValues)) {
                NavHost(
                    navController = navController,
                    startDestination = DrawerScreens.Home.route
                ) {
                    composable(DrawerScreens.Home.route) {
                        HomeScreen(navController)
                    }
                    composable(DrawerScreens.GoodCauses.route) {
                        GoodCausesScreen()
                    }
                    composable(HomeScreens.ArticleDetails.route) {
                        ArticleScreen(navController)
                    }
                }
            }
        }
    )

}