Navigation
App Flow
LoginView
└── SplashView (check stored token)
├── Token exists + valid → HomeView
└── No token / expired → PinLoginView or LoginView
└── OTP verified → SetPinView (first time) → HomeView
Screen Routes
| Route | Screen | Description |
|---|---|---|
/ | SplashView | Token check, redirect |
/login | LoginView | Phone number entry |
/otp-verify | OtpVerifyView | OTP entry |
/pin-login | PinLoginView | PIN entry for returning driver |
/set-pin | SetPinView | First-time PIN setup |
/forgot-password-phone | ForgotPasswordPhoneView | Forgot PIN — phone entry |
/forgot-password-otp | ForgotPasswordOtpView | Forgot PIN — OTP verify |
/forgot-password-set-pin | ForgotPasswordSetPinView | Forgot PIN — new PIN |
/home | HomeView | Main dashboard with map |
/trip-detail/:id | TripDetailView | Trip stops and controls |
/students/:tripId | StudentsView | Student list for a stop |
/incident-report | IncidentReportView | Report new incident |
/incident-history | IncidentHistoryView | Past incidents |
/profile | ProfileView | Profile and PIN change |
Bottom Navigation
Bottom nav on the main shell (HomeView) has 4 tabs:
| Tab | Icon | Screen |
|---|---|---|
| Home | Icons.home | HomeView |
| History | Icons.history | IncidentHistoryView |
| Report | Icons.warning | IncidentReportView |
| Profile | Icons.person | ProfileView |
AppNavigator
app_navigator.dart uses Navigator.pushNamed for all routing:
class AppNavigator {
static void push(BuildContext context, String routeName, {Object? arguments}) {
Navigator.pushNamed(context, routeName, arguments: arguments);
}
static void pushReplacement(BuildContext context, String routeName, {Object? arguments}) {
Navigator.pushReplacementNamed(context, routeName, arguments: arguments);
}
static void pop(BuildContext context) {
Navigator.pop(context);
}
}