cranpose-navigation
cranpose-navigation provides a typed back stack and a composable NavHost.
Routes can carry screen arguments, and each stack entry owns a view-model
store.
Depend directly on cranpose-navigation when a Cranpose app needs screen
navigation. The feature set is empty. The app also needs its usual
cranpose host and renderer features; the navigation crate brings UI,
animation, and cranpose-coroflow APIs as dependencies.
Define routes and screens
rememberNavController stores the stack in the current composition. NavHost
maps each route to a screen, while a screen callback can push a typed route:
use ;
use composable;
NavHost crossfades between screens and connects platform back requests to
stack pop. Use NavHostWith for a custom transition and NavController::navigate_with
for pop-up and single-top options.
Android API map
| Android API | Cranpose API |
|---|---|
rememberNavController() and startDestination |
rememberNavController, NavController |
NavHost and typed destinations |
NavHost with a route match |
| Enter and exit transitions | NavHostWith |
navigate, popBackStack, navigateUp |
navigate, pop_back_stack, navigate_up |
popUpTo, inclusive pop, single top |
navigate_with, NavOptions |
| Current back-stack entry | current_route, back_stack |
| View model scoped to a back-stack entry | cranpose_coroflow::viewModel inside a screen |