Skip to content

Instantly share code, notes, and snippets.

@igorescodro
Created June 9, 2025 23:06
Show Gist options
  • Save igorescodro/4736988f22739aa74f6c5431103faf52 to your computer and use it in GitHub Desktop.
Save igorescodro/4736988f22739aa74f6c5431103faf52 to your computer and use it in GitHub Desktop.
// NavGraph.kt
interface NavGraph {
val navGraph: NavGraphBuilder.(NavEventController) -> Unit
}
// ShoppingNavGraph.kt
internal class ShoppingNavGraph : NavGraph {
override val navGraph: NavGraphBuilder.(NavEventController) -> Unit = { navEventController ->
composable<ShoppingDestination.Details> {
val route: ShoppingDestination.Details = navEntry.toRoute()
ShoppingDetails(
itemId = route.itemId,
onCheckoutClick = {
navEventController.sendEvent(ShoppingEvent.OnCheckoutClick)
},
onMyCoupounsClick = {
navEventController.sendEvent(ShoppingEvent.OnMyCoupounsClick)
}
)
}
composable<ShoppingDestination.Cart> {
// [...] all the other declarations
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment