Skip to content

Instantly share code, notes, and snippets.

@dilrajsingh1997
Last active November 20, 2021 12:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dilrajsingh1997/5f955cfc76300025503796e3c82f5542 to your computer and use it in GitHub Desktop.
Save dilrajsingh1997/5f955cfc76300025503796e3c82f5542 to your computer and use it in GitHub Desktop.
@Composable
fun DemoScreen() {
val navController = rememberNavController()
val graph = remember(navController) {
NavigationGraph(navController)
}
NavHost(
navController = navController,
startDestination = "home"
) {
composable(
route = "home",
arguments = listOf()
) { backStackEntry ->
Box(modifier = Modifier.fillMaxSize()) {
Column(
modifier = Modifier.align(Alignment.Center),
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(text = "This is home page", textAlign = TextAlign.Center)
Spacer(modifier = Modifier.height(20.dp))
Button(onClick = { graph.openUserPage(UUID.randomUUID().toString(), false) }) {
Text(text = "Go to user page", textAlign = TextAlign.Center)
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment