Skip to content

Navigation Controllers Hierarchy

Andrés Pedraza Míguez edited this page Dec 6, 2025 · 2 revisions

The app uses a nested navigation strategy to handle Bottom Tabs and full-screen flows properly.

1. LocalRootNavController

  • Scope: Global (The entire Activity).
  • Provider: AppNavHost.
  • Usage:
    • Auth flows (Login -> Onboarding).
    • Full-screen features that should cover the BottomBar (e.g., Settings, creating a new Group).
    • Back navigation from "leaf" screens.

2. LocalTabNavController

  • Scope: Local (Inside MainScreen tabs).
  • Provider: MainScreen.
  • Usage:
    • Navigation within a specific tab (e.g., Expenses List -> Expense Detail).
    • Preserves the back stack of each tab independently.

How to use

We use CompositionLocal to access them easily in our composables without passing them down as parameters everywhere.

// To navigate to a full-screen feature (hiding bottom bar)
val rootNav = LocalRootNavController.current
rootNav.navigate(Routes.SETTINGS)

// To navigate inside the current tab
val tabNav = LocalTabNavController.current
tabNav.navigate(Routes.EXPENSE_DETAIL)

Clone this wiki locally