Skip to content

Instantly share code, notes, and snippets.

@raamcosta
Created September 28, 2021 16:34
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 raamcosta/6c3a55a07a9f2a0eb476596d3370b37c to your computer and use it in GitHub Desktop.
Save raamcosta/6c3a55a07a9f2a0eb476596d3370b37c to your computer and use it in GitHub Desktop.
First approach: ProfileScreenSpec
object ProfileScreenSpec : ScreenSpec {
override val route = "profile/{id}?isEditable={isEditable}"
override val arguments = listOf(
navArgument("id") {
type = NavType.StringType
},
navArgument("isEditable") {
type = NavType.BoolType
defaultValue = false
}
)
@Composable
override fun Content(
navController: NavController,
navBackStackEntry: NavBackStackEntry,
) {
ProfileScreen(
profileId = navBackStackEntry.arguments?.getString("id")!!,
isEditable = navBackStackEntry.arguments?.getBoolean("isEditable")!!
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment