Skip to content

Instantly share code, notes, and snippets.

@ifucolo
Created August 22, 2025 13:02
Show Gist options
  • Select an option

  • Save ifucolo/a3bfcd7a3fe8b6205dcbfb2db17d3716 to your computer and use it in GitHub Desktop.

Select an option

Save ifucolo/a3bfcd7a3fe8b6205dcbfb2db17d3716 to your computer and use it in GitHub Desktop.
@Composable
fun PrayersRouteComponent(
onShowNavigationBar: (Boolean) -> Unit = {}
) {
val backStack = rememberNavBackStack<PrayersSubRoute>(PrayersSubRoute.PrayersRoute)
NavDisplay(
backStack = backStack,
onBack = { keysToRemove -> repeat(keysToRemove) { backStack.removeLastOrNull() } },
entryDecorators = listOf(
rememberSceneSetupNavEntryDecorator(),
rememberSavedStateNavEntryDecorator(),
rememberViewModelStoreNavEntryDecorator()
),
entryProvider = entryProvider {
onShowNavigationBar(backStack.lastOrNull() == PrayersSubRoute.PrayersRoute)
entry<PrayersSubRoute.PrayersRoute> {
PrayersScreen(
onPrayerClicked = { prayer ->
backStack.add(PrayersSubRoute.PrayerRoute(prayerName = prayer.prayer.name))
},
onNovenaClicked = { novena ->
backStack.add(PrayersSubRoute.NovenaRoute(novenaName = novena.novena.name))
},
onChapletClicked = { chaplet ->
backStack.add(PrayersSubRoute.ChapletRoute(chapletName = chaplet.terco.name))
}
)
}
entry<PrayersSubRoute.PrayerRoute> { route ->
PrayerDetailScreen(
prayerName = route.prayerName,
onBackClick = { backStack.removeLastOrNull() }
)
}
entry<PrayersSubRoute.ChapletRoute> { route ->
ChapletFlowRouteComponent(
chapletName = route.chapletName,
onClose = { backStack.removeLastOrNull() }
)
}
entry<PrayersSubRoute.NovenaRoute> { route ->
NovenaFlowRouteComponent(
novenaName = route.novenaName,
onClose = { backStack.removeLastOrNull() }
)
}
},
.....
transitionSpec,
popTransitionSpec,
predictivePopTransitionSpec,
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment