The TecNM Control Escolar app uses Navigation Compose to handle all screen transitions. This provides a declarative, type-safe way to navigate between screens while maintaining a single-activity architecture.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Jesus-Puertos/AppTECNMControlEscolar/llms.txt
Use this file to discover all available pages before exploring further.
Navigation Routes
All navigation routes are defined using a sealed class inAppScreens.kt:
AppScreens.kt
Why Sealed Classes?
Type Safety
Compile-time safety ensures you can’t navigate to non-existent routes
Autocomplete
IDE provides autocomplete for all available screens
Exhaustive When
Kotlin ensures all cases are handled in when expressions
Refactor Friendly
Renaming routes updates all references automatically
Route Naming Convention
Routes use lowercase strings matching the screen purpose:| Object | Route String | Screen |
|---|---|---|
AppScreens.Home | "home" | HomeScreen |
AppScreens.Schedule | "schedule" | ScheduleScreen |
AppScreens.Map | "map" | MapScreen |
AppScreens.Profile | "profile" | ProfileScreen |
Navigation Graph Setup
TheAppNavigation composable sets up the navigation graph and integrates the bottom navigation bar:
AppNavigation.kt
Key Components
NavController Creation
rememberNavController() creates and remembers the navigation controller across recompositionsBottom Navigation Integration
The navigation system is tightly integrated with the bottom navigation bar. TheBottomBar component receives the NavController to handle navigation:
The
innerPadding ensures that screen content doesn’t render underneath the bottom navigation bar.Navigation Configuration
Start Destination
The app launches to the Home screen by default:Route-to-Screen Mapping
Each route is mapped to its corresponding screen composable:Navigation Actions
Navigation actions are handled in theBottomBar component. Here’s how navigation is triggered:
BottomBar.kt (excerpt)
Navigation Options
Clears the back stack up to the start destination, preventing stack buildup when switching between bottom nav items
Prevents multiple instances of the same screen being added to the back stack
Current Route Detection
The bottom bar highlights the current screen by observing the back stack:selected state of navigation items:
Adding New Screens
To add a new screen to the navigation system:Future Enhancements
Navigation Arguments
Navigation Arguments
Deep Linking
Deep Linking
Deep links can be added to support navigation from notifications or external intents.
Nested Navigation
Nested Navigation
Animation Transitions
Animation Transitions
Custom animations can be added to enhance the user experience during screen transitions.
Best Practices
Single NavController
Always use a single NavController for the entire app. Avoid creating multiple NavControllers as this complicates state management and back stack handling.
Stateless Screens
Keep screen composables stateless and let the ViewModel or state hoisting handle business logic. This makes screens easier to navigate to and test.
Safe Navigation
Always use the sealed class routes instead of string literals to prevent typos and ensure type safety.
