Skip to content

Instantly share code, notes, and snippets.

@igorescodro
Last active March 24, 2021 11:35
Show Gist options
  • Save igorescodro/47b0eb97739be52abb7a9867f75e937d to your computer and use it in GitHub Desktop.
Save igorescodro/47b0eb97739be52abb7a9867f75e937d to your computer and use it in GitHub Desktop.
@Composable
fun NavGraph(startDestination: String = "home") {
val navController = rememberNavController()
NavHost(navController = navController, startDestination = startDestination) {
composable(route = "home") {
Home()
}
composable(
route = "task_detail/{task_id}",
arguments = listOf(navArgument("task_id") { type = NavType.LongType }),
) { backStackEntry ->
val arguments = backStackEntry.arguments
TaskDetail(taskId = arguments?.getLong("task_id"))
}
composable(route = "about") {
About()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment