This commit is contained in:
Phuoc Nguyen
2025-11-18 17:59:27 +07:00
parent 0dda402246
commit fc4711a18e
8 changed files with 568 additions and 285 deletions

View File

@@ -62,13 +62,18 @@ final routerProvider = Provider<GoRouter>((ref) {
final isLoggedIn = authState.value != null;
final isOnSplashPage = state.matchedLocation == RouteNames.splash;
final isOnLoginPage = state.matchedLocation == RouteNames.login;
final isOnForgotPasswordPage = state.matchedLocation == RouteNames.forgotPassword;
final isOnForgotPasswordPage =
state.matchedLocation == RouteNames.forgotPassword;
final isOnRegisterPage = state.matchedLocation == RouteNames.register;
final isOnBusinessUnitPage =
state.matchedLocation == RouteNames.businessUnitSelection;
final isOnOtpPage = state.matchedLocation == RouteNames.otpVerification;
final isOnAuthPage =
isOnLoginPage || isOnForgotPasswordPage || isOnRegisterPage || isOnBusinessUnitPage || isOnOtpPage;
isOnLoginPage ||
isOnForgotPasswordPage ||
isOnRegisterPage ||
isOnBusinessUnitPage ||
isOnOtpPage;
// While loading auth state, show splash screen
if (isLoading) {
@@ -367,8 +372,13 @@ final routerProvider = Provider<GoRouter>((ref) {
GoRoute(
path: RouteNames.addresses,
name: RouteNames.addresses,
pageBuilder: (context, state) =>
MaterialPage(key: state.pageKey, child: const AddressesPage()),
pageBuilder: (context, state) {
final extra = state.extra as Map<String, dynamic>?;
return MaterialPage(
key: state.pageKey,
child: AddressesPage(extra: extra),
);
},
),
// Address Form Route (Create/Edit)