Skip to content

Instantly share code, notes, and snippets.

@MrNtlu
Last active December 8, 2022 16:33
Show Gist options
  • Save MrNtlu/f1703409e38a85b92af58c280f35d935 to your computer and use it in GitHub Desktop.
Save MrNtlu/f1703409e38a85b92af58c280f35d935 to your computer and use it in GitHub Desktop.
Jetpack Compose Navigation Part 1
@Composable
fun NavigationComposable(
navController: NavHostController,
) {
NavHost(navController = navController, startDestination = "home") {
composable("home") {
HomeScreen(navController = navController)
}
composable(
route = "add?value={value}",
arguments = listOf(
navArgument("value") {
type = NavType.StringType
defaultValue = "Default"
}
)
) { backStackEntry ->
AddScreen(
backStackEntry.arguments?.getString("value") ?: ""
)
}
composable("settings") {
SettingsScreen()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment