Skip to content

Instantly share code, notes, and snippets.

@dilrajsingh1997
Created November 20, 2021 12:45
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/5a51726c7c11c09344e64ce9c35b4425 to your computer and use it in GitHub Desktop.
Save dilrajsingh1997/5a51726c7c11c09344e64ce9c35b4425 to your computer and use it in GitHub Desktop.
composable(
route = "userPage?userId={userId},isLoggedIn={isLoggedIn}",
arguments = listOf(
navArgument("userId") {
type = NavType.StringType
},
navArgument("isLoggedIn") {
type = NavType.BoolType
},
)
) { backStackEntry ->
val userId = backStackEntry.arguments?.getString("userId") ?: ""
val isLoggedIn = backStackEntry.arguments?.getBoolean("isLoggedIn") ?: false
Box(modifier = Modifier.fillMaxSize()) {
Column(
modifier = Modifier.align(Alignment.Center),
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(text = "This is user page with userId: $userId", textAlign = TextAlign.Center)
Spacer(modifier = Modifier.height(20.dp))
Text(text = "Is user logged in $isLoggedIn", textAlign = TextAlign.Center)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment