Refactor navigation and remove unused navigator extensions across staff features

- Removed background color from CreateOrderView, OneTimeOrderView, and RapidOrderView.
- Updated navigation paths in OneTimeOrderView and other staff authentication pages to use new constants.
- Deleted unused navigator extensions for staff authentication, home, profile, and shifts.
- Refactored navigation in StaffMainModule to use new path constants.
- Cleaned up imports and adjusted navigation calls in various staff-related pages and widgets.
This commit is contained in:
Achintha Isuru
2026-02-04 18:22:39 -05:00
parent b5c3af580c
commit 3b11c49d90
41 changed files with 122 additions and 434 deletions

View File

@@ -1,21 +0,0 @@
import 'package:flutter_modular/flutter_modular.dart';
import '../../domain/ui_entities/auth_mode.dart';
/// Extension on [IModularNavigator] to provide strongly-typed navigation
/// for the staff authentication feature.
extension AuthNavigator on IModularNavigator {
/// Navigates to the phone verification page.
void pushPhoneVerification(AuthMode mode) {
pushNamed('./phone-verification', arguments: <String, String>{'mode': mode.name});
}
/// Navigates to the profile setup page, replacing the current route.
void pushReplacementProfileSetup() {
pushReplacementNamed('./profile-setup');
}
/// Navigates to the worker home (external to this module).
void pushWorkerHome() {
pushNamed('/worker-main/home');
}
}

View File

@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_modular/flutter_modular.dart';
import 'package:staff_authentication/src/domain/ui_entities/auth_mode.dart';
import '../navigation/auth_navigator.dart'; // Import the extension
import 'package:krow_core/core.dart';
import '../widgets/get_started_page/get_started_actions.dart';
import '../widgets/get_started_page/get_started_background.dart';
import '../widgets/get_started_page/get_started_header.dart';
@@ -17,12 +17,12 @@ class GetStartedPage extends StatelessWidget {
/// On sign up pressed callback.
void onSignUpPressed() {
Modular.to.pushPhoneVerification(AuthMode.signup);
Modular.to.toPhoneVerification('signup');
}
/// On login pressed callback.
void onLoginPressed() {
Modular.to.pushPhoneVerification(AuthMode.login);
Modular.to.toPhoneVerification('login');
}
@override

View File

@@ -7,7 +7,7 @@ import 'package:staff_authentication/src/presentation/blocs/auth_event.dart';
import 'package:staff_authentication/src/presentation/blocs/auth_state.dart';
import 'package:staff_authentication/staff_authentication.dart';
import '../navigation/auth_navigator.dart'; // Import the extension
import 'package:krow_core/core.dart';
import '../widgets/phone_verification_page/otp_verification.dart';
import '../widgets/phone_verification_page/phone_input.dart';
@@ -100,9 +100,9 @@ class _PhoneVerificationPageState extends State<PhoneVerificationPage> {
listener: (BuildContext context, AuthState state) {
if (state.status == AuthStatus.authenticated) {
if (state.mode == AuthMode.signup) {
Modular.to.pushReplacementProfileSetup();
Modular.to.toProfileSetup();
} else {
Modular.to.pushWorkerHome();
Modular.to.toStaffHome();
}
} else if (state.status == AuthStatus.error &&
state.mode == AuthMode.signup) {

View File

@@ -9,7 +9,7 @@ import '../widgets/profile_setup_page/profile_setup_location.dart';
import '../widgets/profile_setup_page/profile_setup_experience.dart';
import '../widgets/profile_setup_page/profile_setup_header.dart';
import 'package:staff_authentication/staff_authentication.dart';
import '../navigation/auth_navigator.dart'; // Import the extension
import 'package:krow_core/core.dart';
/// Page for setting up the user profile after authentication.
class ProfileSetupPage extends StatefulWidget {
@@ -93,7 +93,7 @@ class _ProfileSetupPageState extends State<ProfileSetupPage> {
child: BlocConsumer<ProfileSetupBloc, ProfileSetupState>(
listener: (BuildContext context, ProfileSetupState state) {
if (state.status == ProfileSetupStatus.success) {
Modular.to.pushWorkerHome();
Modular.to.toStaffHome();
} else if (state.status == ProfileSetupStatus.failure) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(