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:
@@ -27,9 +27,9 @@ class AppModule extends Module {
|
||||
@override
|
||||
void routes(RouteManager r) {
|
||||
// Set the initial route to the authentication module
|
||||
r.module("/", module: staff_authentication.StaffAuthenticationModule());
|
||||
r.module(StaffPaths.root, module: staff_authentication.StaffAuthenticationModule());
|
||||
|
||||
r.module('/worker-main', module: staff_main.StaffMainModule());
|
||||
r.module(StaffPaths.main, module: staff_main.StaffMainModule());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,14 @@ extension ClientNavigator on IModularNavigator {
|
||||
// AUTHENTICATION FLOWS
|
||||
// ==========================================================================
|
||||
|
||||
/// Navigate to the root authentication screen.
|
||||
///
|
||||
/// This effectively logs out the user by navigating to root.
|
||||
/// Used when signing out or session expires.
|
||||
void toClientRoot() {
|
||||
navigate(ClientPaths.root);
|
||||
}
|
||||
|
||||
/// Navigates to the client sign-in page.
|
||||
///
|
||||
/// This page allows existing clients to log in using email/password
|
||||
|
||||
@@ -28,6 +28,14 @@ extension StaffNavigator on IModularNavigator {
|
||||
// AUTHENTICATION FLOWS
|
||||
// ==========================================================================
|
||||
|
||||
/// Navigates to the root get started/authentication screen.
|
||||
///
|
||||
/// This effectively logs out the user by navigating to root.
|
||||
/// Used when signing out or session expires.
|
||||
void toGetStarted() {
|
||||
navigate(StaffPaths.root);
|
||||
}
|
||||
|
||||
/// Navigates to the phone verification page.
|
||||
///
|
||||
/// Used for both login and signup flows to verify phone numbers via OTP.
|
||||
@@ -289,16 +297,4 @@ extension StaffNavigator on IModularNavigator {
|
||||
void toSettings() {
|
||||
pushNamed(StaffPaths.settings);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
// SPECIAL NAVIGATION
|
||||
// ==========================================================================
|
||||
|
||||
/// Navigates to the get started/authentication screen.
|
||||
///
|
||||
/// This effectively logs out the user by navigating to root.
|
||||
/// Used when signing out or session expires.
|
||||
void toGetStarted() {
|
||||
navigate(StaffPaths.root);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,12 +45,12 @@ class StaffPaths {
|
||||
///
|
||||
/// Used for both login and signup flows to verify phone numbers via OTP.
|
||||
/// Expects `mode` argument: 'login' or 'signup'
|
||||
static const String phoneVerification = './phone-verification';
|
||||
static const String phoneVerification = '/phone-verification';
|
||||
|
||||
/// Profile setup page (relative path within auth module).
|
||||
///
|
||||
/// Initial profile setup for new staff members after verification.
|
||||
static const String profileSetup = './profile-setup';
|
||||
static const String profileSetup = '/profile-setup';
|
||||
|
||||
// ==========================================================================
|
||||
// MAIN SHELL & NAVIGATION
|
||||
|
||||
@@ -16,7 +16,6 @@ class PermanentOrderPage extends StatelessWidget {
|
||||
t.client_create_order.permanent;
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: UiColors.bgPrimary,
|
||||
appBar: UiAppBar(
|
||||
title: labels.title,
|
||||
onLeadingPressed: () => Modular.to.navigate(ClientPaths.createOrder),
|
||||
|
||||
@@ -16,7 +16,6 @@ class RecurringOrderPage extends StatelessWidget {
|
||||
t.client_create_order.recurring;
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: UiColors.bgPrimary,
|
||||
appBar: UiAppBar(
|
||||
title: labels.title,
|
||||
onLeadingPressed: () => Modular.to.toClientHome(),
|
||||
|
||||
@@ -40,7 +40,6 @@ class CreateOrderView extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: UiColors.bgPrimary,
|
||||
appBar: UiAppBar(
|
||||
title: t.client_create_order.title,
|
||||
onLeadingPressed: () => Modular.to.toClientHome(),
|
||||
|
||||
@@ -33,7 +33,7 @@ class OneTimeOrderView extends StatelessWidget {
|
||||
message: labels.success_message,
|
||||
buttonLabel: labels.back_to_orders,
|
||||
onDone: () => Modular.to.pushNamedAndRemoveUntil(
|
||||
'/client-main/orders/',
|
||||
ClientPaths.orders,
|
||||
(_) => false,
|
||||
arguments: <String, dynamic>{
|
||||
'initialDate': state.date.toIso8601String(),
|
||||
@@ -45,7 +45,6 @@ class OneTimeOrderView extends StatelessWidget {
|
||||
if (state.vendors.isEmpty &&
|
||||
state.status != OneTimeOrderStatus.loading) {
|
||||
return Scaffold(
|
||||
backgroundColor: UiColors.bgPrimary,
|
||||
body: Column(
|
||||
children: <Widget>[
|
||||
OneTimeOrderHeader(
|
||||
@@ -84,7 +83,6 @@ class OneTimeOrderView extends StatelessWidget {
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: UiColors.bgPrimary,
|
||||
body: Column(
|
||||
children: <Widget>[
|
||||
OneTimeOrderHeader(
|
||||
|
||||
@@ -75,7 +75,6 @@ class _RapidOrderFormState extends State<_RapidOrderForm> {
|
||||
}
|
||||
},
|
||||
child: Scaffold(
|
||||
backgroundColor: UiColors.bgPrimary,
|
||||
body: Column(
|
||||
children: <Widget>[
|
||||
RapidOrderHeader(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
|
||||
import '../blocs/client_settings_bloc.dart';
|
||||
import '../widgets/client_settings_page/settings_actions.dart';
|
||||
@@ -26,7 +27,7 @@ class ClientSettingsPage extends StatelessWidget {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Signed out successfully')),
|
||||
);
|
||||
Modular.to.navigate('/');
|
||||
Modular.to.toClientRoot();
|
||||
}
|
||||
if (state is ClientSettingsError) {
|
||||
ScaffoldMessenger.of(
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -2,6 +2,7 @@ library staff_authentication;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:krow_data_connect/krow_data_connect.dart';
|
||||
import 'package:firebase_auth/firebase_auth.dart' as firebase;
|
||||
import 'package:staff_authentication/src/data/repositories_impl/auth_repository_impl.dart';
|
||||
@@ -72,9 +73,9 @@ class StaffAuthenticationModule extends Module {
|
||||
|
||||
@override
|
||||
void routes(RouteManager r) {
|
||||
r.child('/', child: (_) => const GetStartedPage());
|
||||
r.child(StaffPaths.root, child: (_) => const GetStartedPage());
|
||||
r.child(
|
||||
'/phone-verification',
|
||||
StaffPaths.phoneVerification,
|
||||
child: (BuildContext context) {
|
||||
final Map<String, dynamic>? data = r.args.data;
|
||||
final String? modeName = data?['mode'];
|
||||
@@ -85,6 +86,6 @@ class StaffAuthenticationModule extends Module {
|
||||
return PhoneVerificationPage(mode: mode);
|
||||
},
|
||||
);
|
||||
r.child('/profile-setup', child: (_) => const ProfileSetupPage());
|
||||
r.child(StaffPaths.profileSetup, child: (_) => const ProfileSetupPage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
/// Extension on [IModularNavigator] providing typed navigation helpers
|
||||
/// for the Staff Home feature (worker home screen).
|
||||
///
|
||||
/// Keep routes as small wrappers around `pushNamed` / `navigate` so callers
|
||||
/// don't need to rely on literal paths throughout the codebase.
|
||||
extension HomeNavigator on IModularNavigator {
|
||||
/// Navigates to the worker profile page.
|
||||
void pushWorkerProfile() {
|
||||
pushNamed('/worker-main/profile');
|
||||
}
|
||||
|
||||
/// Navigates to the availability page.
|
||||
void pushAvailability() {
|
||||
pushNamed('/worker-main/availability');
|
||||
}
|
||||
|
||||
/// Navigates to the messages page.
|
||||
void pushMessages() {
|
||||
pushNamed('/messages');
|
||||
}
|
||||
|
||||
/// Navigates to the payments page.
|
||||
void navigateToPayments() {
|
||||
navigate('/worker-main/payments');
|
||||
}
|
||||
|
||||
/// Navigates to the shifts listing.
|
||||
/// Optionally provide a [tab] query param (e.g. `find`).
|
||||
void pushShifts({String? tab}) {
|
||||
if (tab == null) {
|
||||
navigate('/worker-main/shifts');
|
||||
} else {
|
||||
navigate('/worker-main/shifts', arguments: <String, dynamic>{
|
||||
'initialTab': tab,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// Navigates to the settings page.
|
||||
void pushSettings() {
|
||||
pushNamed('/settings');
|
||||
}
|
||||
|
||||
/// Navigates to the shift details page for the given [shift].
|
||||
void pushShiftDetails(Shift shift) {
|
||||
pushNamed('/worker-main/shift-details/${shift.id}', arguments: shift);
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:lucide_icons/lucide_icons.dart';
|
||||
import 'package:staff_home/src/presentation/blocs/home_cubit.dart';
|
||||
import 'package:staff_home/src/presentation/navigation/home_navigator.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:staff_home/src/presentation/widgets/home_page/empty_state_widget.dart';
|
||||
import 'package:staff_home/src/presentation/widgets/home_page/home_header.dart';
|
||||
import 'package:staff_home/src/presentation/widgets/home_page/placeholder_banner.dart';
|
||||
@@ -69,7 +69,7 @@ class WorkerHomePage extends StatelessWidget {
|
||||
bg: UiColors.bgHighlight,
|
||||
accent: UiColors.primary,
|
||||
onTap: () {
|
||||
Modular.to.pushWorkerProfile();
|
||||
Modular.to.toProfile();
|
||||
},
|
||||
);
|
||||
},
|
||||
@@ -85,21 +85,21 @@ class WorkerHomePage extends StatelessWidget {
|
||||
child: QuickActionItem(
|
||||
icon: LucideIcons.search,
|
||||
label: quickI18n.find_shifts,
|
||||
onTap: () => Modular.to.pushShifts(),
|
||||
onTap: () => Modular.to.toShifts(),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: QuickActionItem(
|
||||
icon: LucideIcons.calendar,
|
||||
label: quickI18n.availability,
|
||||
onTap: () => Modular.to.pushAvailability(),
|
||||
onTap: () => Modular.to.toAvailability(),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: QuickActionItem(
|
||||
icon: LucideIcons.dollarSign,
|
||||
label: quickI18n.earnings,
|
||||
onTap: () => Modular.to.navigateToPayments(),
|
||||
onTap: () => Modular.to.toPayments(),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -132,7 +132,7 @@ class WorkerHomePage extends StatelessWidget {
|
||||
EmptyStateWidget(
|
||||
message: emptyI18n.no_shifts_today,
|
||||
actionLink: emptyI18n.find_shifts_cta,
|
||||
onAction: () => Modular.to.pushShifts(tab: 'find'),
|
||||
onAction: () => Modular.to.toShifts(initialTab: 'find'),
|
||||
)
|
||||
else
|
||||
Column(
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:lucide_icons/lucide_icons.dart';
|
||||
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:core_localization/core_localization.dart';
|
||||
import 'package:staff_home/src/presentation/navigation/home_navigator.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
|
||||
|
||||
/// Card widget for displaying pending payment information, using design system tokens.
|
||||
@@ -16,7 +16,7 @@ class PendingPaymentCard extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final pendingI18n = t.staff.home.pending_payment;
|
||||
return GestureDetector(
|
||||
onTap: () => Modular.to.navigateToPayments(),
|
||||
onTap: () => Modular.to.toPayments(),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(UiConstants.space4),
|
||||
decoration: BoxDecoration(
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
import 'package:lucide_icons/lucide_icons.dart';
|
||||
import 'package:staff_home/src/presentation/navigation/home_navigator.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
|
||||
class RecommendedShiftCard extends StatelessWidget {
|
||||
final Shift shift;
|
||||
|
||||
@@ -5,7 +5,7 @@ import 'package:intl/intl.dart';
|
||||
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
import '../navigation/home_navigator.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
|
||||
class ShiftCard extends StatefulWidget {
|
||||
final Shift shift;
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
|
||||
/// Extension on [IModularNavigator] providing typed navigation helpers
|
||||
/// for the Staff Profile feature.
|
||||
///
|
||||
/// These methods provide a type-safe way to navigate to various profile-related
|
||||
/// pages without relying on string literals throughout the codebase.
|
||||
extension ProfileNavigator on IModularNavigator {
|
||||
/// Navigates to the personal info page.
|
||||
void pushPersonalInfo() {
|
||||
pushNamed('../onboarding/personal-info');
|
||||
}
|
||||
|
||||
/// Navigates to the emergency contact page.
|
||||
void pushEmergencyContact() {
|
||||
pushNamed('../emergency-contact');
|
||||
}
|
||||
|
||||
/// Navigates to the experience page.
|
||||
void pushExperience() {
|
||||
pushNamed('../experience');
|
||||
}
|
||||
|
||||
/// Navigates to the attire page.
|
||||
void pushAttire() {
|
||||
pushNamed('../attire');
|
||||
}
|
||||
|
||||
/// Navigates to the documents page.
|
||||
void pushDocuments() {
|
||||
pushNamed('../documents');
|
||||
}
|
||||
|
||||
/// Navigates to the certificates page.
|
||||
void pushCertificates() {
|
||||
pushNamed('/certificates');
|
||||
}
|
||||
|
||||
/// Navigates to the tax forms page.
|
||||
void pushTaxForms() {
|
||||
pushNamed('../tax-forms/');
|
||||
}
|
||||
|
||||
/// Navigates to Krow University.
|
||||
void pushKrowUniversity() {
|
||||
pushNamed('/krow-university');
|
||||
}
|
||||
|
||||
/// Navigates to the trainings page.
|
||||
void pushTrainings() {
|
||||
pushNamed('/trainings');
|
||||
}
|
||||
|
||||
/// Navigates to the leaderboard page.
|
||||
void pushLeaderboard() {
|
||||
pushNamed('/leaderboard');
|
||||
}
|
||||
|
||||
/// Navigates to the bank account page.
|
||||
void pushBankAccount() {
|
||||
pushNamed('../bank-account/');
|
||||
}
|
||||
|
||||
/// Navigates to the timecard page.
|
||||
void pushTimecard() {
|
||||
pushNamed('../time-card');
|
||||
}
|
||||
|
||||
/// Navigates to the FAQs page.
|
||||
void pushFaqs() {
|
||||
pushNamed('/faqs');
|
||||
}
|
||||
|
||||
/// Navigates to the privacy & security page.
|
||||
void pushPrivacy() {
|
||||
pushNamed('/privacy');
|
||||
}
|
||||
|
||||
/// Navigates to the messages page.
|
||||
void pushMessages() {
|
||||
pushNamed('/messages');
|
||||
}
|
||||
|
||||
/// Navigates to the get started/authentication screen.
|
||||
void navigateToGetStarted() {
|
||||
navigate('/');
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
import '../blocs/profile_cubit.dart';
|
||||
import '../blocs/profile_state.dart';
|
||||
import '../navigation/profile_navigator.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import '../widgets/logout_button.dart';
|
||||
import '../widgets/profile_menu_grid.dart';
|
||||
import '../widgets/profile_menu_item.dart';
|
||||
@@ -61,7 +61,7 @@ class StaffProfilePage extends StatelessWidget {
|
||||
bloc: cubit,
|
||||
listener: (context, state) {
|
||||
if (state.status == ProfileStatus.signedOut) {
|
||||
Modular.to.navigateToGetStarted();
|
||||
Modular.to.toGetStarted();
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
@@ -124,17 +124,17 @@ class StaffProfilePage extends StatelessWidget {
|
||||
ProfileMenuItem(
|
||||
icon: UiIcons.user,
|
||||
label: i18n.menu_items.personal_info,
|
||||
onTap: () => Modular.to.pushPersonalInfo(),
|
||||
onTap: () => Modular.to.toPersonalInfo(),
|
||||
),
|
||||
ProfileMenuItem(
|
||||
icon: UiIcons.phone,
|
||||
label: i18n.menu_items.emergency_contact,
|
||||
onTap: () => Modular.to.pushEmergencyContact(),
|
||||
onTap: () => Modular.to.toEmergencyContact(),
|
||||
),
|
||||
ProfileMenuItem(
|
||||
icon: UiIcons.briefcase,
|
||||
label: i18n.menu_items.experience,
|
||||
onTap: () => Modular.to.pushExperience(),
|
||||
onTap: () => Modular.to.toExperience(),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -149,7 +149,7 @@ class StaffProfilePage extends StatelessWidget {
|
||||
ProfileMenuItem(
|
||||
icon: UiIcons.file,
|
||||
label: i18n.menu_items.tax_forms,
|
||||
onTap: () => Modular.to.pushTaxForms(),
|
||||
onTap: () => Modular.to.toTaxForms(),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -163,17 +163,17 @@ class StaffProfilePage extends StatelessWidget {
|
||||
ProfileMenuItem(
|
||||
icon: UiIcons.building,
|
||||
label: i18n.menu_items.bank_account,
|
||||
onTap: () => Modular.to.pushBankAccount(),
|
||||
onTap: () => Modular.to.toBankAccount(),
|
||||
),
|
||||
ProfileMenuItem(
|
||||
icon: UiIcons.creditCard,
|
||||
label: i18n.menu_items.payments,
|
||||
onTap: () => Modular.to.navigate('/worker-main/payments'),
|
||||
onTap: () => Modular.to.toPayments(),
|
||||
),
|
||||
ProfileMenuItem(
|
||||
icon: UiIcons.clock,
|
||||
label: i18n.menu_items.timecard,
|
||||
onTap: () => Modular.to.pushTimecard(),
|
||||
onTap: () => Modular.to.toTimeCard(),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
|
||||
/// Extension on [IModularNavigator] to provide strongly-typed navigation
|
||||
/// for the staff certificates feature.
|
||||
extension CertificatesNavigator on IModularNavigator {
|
||||
/// Navigates back.
|
||||
void popCertificates() {
|
||||
pop();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
library staff_certificates;
|
||||
|
||||
export 'src/staff_certificates_module.dart';
|
||||
export 'src/presentation/navigation/certificates_navigator.dart'; // Export navigator extension
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
|
||||
/// Extension on [IModularNavigator] to provide strongly-typed navigation
|
||||
/// for the staff documents feature.
|
||||
extension DocumentsNavigator on IModularNavigator {
|
||||
/// Navigates to the document upload/view page.
|
||||
/// [documentId] is the ID of the document to view or upload.
|
||||
void pushDocumentDetails(String documentId) {
|
||||
pushNamed('./details', arguments: documentId);
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import 'package:core_localization/core_localization.dart';
|
||||
|
||||
import '../blocs/documents/documents_cubit.dart';
|
||||
import '../blocs/documents/documents_state.dart';
|
||||
import '../navigation/documents_navigator.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import '../widgets/document_card.dart';
|
||||
import '../widgets/documents_progress_card.dart';
|
||||
|
||||
@@ -81,7 +81,7 @@ class DocumentsPage extends StatelessWidget {
|
||||
...state.documents.map(
|
||||
(StaffDocument doc) => DocumentCard(
|
||||
document: doc,
|
||||
onTap: () => Modular.to.pushDocumentDetails(doc.id),
|
||||
onTap: () => Modular.to.pushNamed('./details', arguments: doc.id),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
|
||||
extension StaffBankAccountNavigator on IModularNavigator {
|
||||
void popPage() {
|
||||
pop();
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
import '../blocs/bank_account_cubit.dart';
|
||||
import '../blocs/bank_account_state.dart';
|
||||
import '../navigation/staff_bank_account_navigator.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import '../widgets/add_account_form.dart';
|
||||
|
||||
class BankAccountPage extends StatelessWidget {
|
||||
@@ -33,7 +33,7 @@ class BankAccountPage extends StatelessWidget {
|
||||
elevation: 0,
|
||||
leading: IconButton(
|
||||
icon: const Icon(UiIcons.arrowLeft, color: UiColors.textSecondary),
|
||||
onPressed: () => Modular.to.popPage(),
|
||||
onPressed: () => Modular.to.pop(),
|
||||
),
|
||||
title: Text(
|
||||
strings.title,
|
||||
@@ -118,10 +118,10 @@ class BankAccountPage extends StatelessWidget {
|
||||
accountNumber: account,
|
||||
type: type,
|
||||
);
|
||||
Modular.to.popPage();
|
||||
Modular.to.pop();
|
||||
},
|
||||
onCancel: () {
|
||||
Modular.to.popPage();
|
||||
Modular.to.pop();
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
|
||||
/// Extension on [IModularNavigator] to provide strongly-typed navigation
|
||||
/// for the staff attire feature.
|
||||
extension AttireNavigator on IModularNavigator {
|
||||
/// Navigates back.
|
||||
void popAttire() {
|
||||
pop();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
|
||||
extension ExperienceNavigator on IModularNavigator {
|
||||
// Add navigation methods here if the page navigates deeper.
|
||||
// Currently ExperiencePage is a leaf, but might need to navigate back or to success screen.
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
|
||||
/// Typed navigation extensions for the Staff Profile Info feature.
|
||||
///
|
||||
/// Provides type-safe navigation methods to avoid magic strings
|
||||
/// throughout the codebase.
|
||||
extension ProfileInfoNavigator on IModularNavigator {
|
||||
/// Navigates to the Personal Info page.
|
||||
///
|
||||
/// This page allows staff members to edit their personal information
|
||||
/// including phone, bio, languages, and preferred locations.
|
||||
Future<void> pushPersonalInfo() {
|
||||
return pushNamed('./personal-info');
|
||||
}
|
||||
|
||||
/// Navigates to the Emergency Contact page.
|
||||
///
|
||||
/// TODO: Implement when emergency contact page is created.
|
||||
Future<void> pushEmergencyContact() {
|
||||
return pushNamed('/profile/onboarding/emergency-contact');
|
||||
}
|
||||
|
||||
/// Navigates to the Experience page.
|
||||
///
|
||||
/// TODO: Implement when experience page is created.
|
||||
Future<void> pushExperience() {
|
||||
return pushNamed('/profile/onboarding/experience');
|
||||
}
|
||||
|
||||
/// Navigates to the Attire page.
|
||||
///
|
||||
/// TODO: Implement when attire page is created.
|
||||
Future<void> pushAttire() {
|
||||
return pushNamed('/profile/onboarding/attire');
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
|
||||
/// Typed navigation extensions for the Staff Profile Info feature.
|
||||
///
|
||||
/// Provides type-safe navigation methods to avoid magic strings
|
||||
/// throughout the codebase.
|
||||
extension ProfileInfoNavigator on IModularNavigator {
|
||||
/// Navigates to the Personal Info page.
|
||||
///
|
||||
/// This page allows staff members to edit their personal information
|
||||
/// including phone, bio, languages, and preferred locations.
|
||||
Future<void> pushPersonalInfo() {
|
||||
return pushNamed('./personal-info');
|
||||
}
|
||||
|
||||
/// Navigates to the Emergency Contact page.
|
||||
///
|
||||
/// TODO: Implement when emergency contact page is created.
|
||||
Future<void> pushEmergencyContact() {
|
||||
return pushNamed('/profile/onboarding/emergency-contact');
|
||||
}
|
||||
|
||||
/// Navigates to the Experience page.
|
||||
///
|
||||
/// TODO: Implement when experience page is created.
|
||||
Future<void> pushExperience() {
|
||||
return pushNamed('/profile/onboarding/experience');
|
||||
}
|
||||
|
||||
/// Navigates to the Attire page.
|
||||
///
|
||||
/// TODO: Implement when attire page is created.
|
||||
Future<void> pushAttire() {
|
||||
return pushNamed('/profile/onboarding/attire');
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
extension ShiftsNavigator on IModularNavigator {
|
||||
void navigateToShiftsHome({DateTime? selectedDate}) {
|
||||
navigate('/worker-main/shifts/', arguments: {'selectedDate': selectedDate});
|
||||
}
|
||||
|
||||
void pushShiftDetails(Shift shift) {
|
||||
navigate('/worker-main/shift-details/${shift.id}', arguments: shift);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
import 'package:design_system/design_system.dart'; // Re-added for UiIcons/Colors as they are used in expanded logic
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
import 'package:design_system/design_system.dart'; // Re-added for UiIcons/Colors as they are used in expanded logic
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:staff_shifts/staff_shifts.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
import '../blocs/shift_details/shift_details_bloc.dart';
|
||||
import '../blocs/shift_details/shift_details_event.dart';
|
||||
import '../blocs/shift_details/shift_details_state.dart';
|
||||
@@ -148,10 +149,10 @@ class _ShiftDetailsPageState extends State<ShiftDetailsPage> {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(state.message),
|
||||
backgroundColor: const Color(0xFF10B981),
|
||||
backgroundColor: UiColors.tagSuccess,
|
||||
),
|
||||
);
|
||||
Modular.to.navigateToShiftsHome(selectedDate: state.shiftDate);
|
||||
Modular.to.toShifts(selectedDate: state.shiftDate);
|
||||
} else if (state is ShiftDetailsError) {
|
||||
if (_isApplying || widget.shift == null) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
@@ -196,7 +197,7 @@ class _ShiftDetailsPageState extends State<ShiftDetailsPage> {
|
||||
appBar: UiAppBar(
|
||||
title: displayShift.title,
|
||||
centerTitle: false,
|
||||
onLeadingPressed: () => Modular.to.navigateToShiftsHome(),
|
||||
onLeadingPressed: () => Modular.to.toShifts(),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:intl/intl.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:core_localization/core_localization.dart';
|
||||
import 'package:staff_shifts/src/presentation/navigation/shifts_navigator.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
|
||||
class MyShiftCard extends StatefulWidget {
|
||||
final Shift shift;
|
||||
|
||||
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import '../../navigation/shifts_navigator.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import '../my_shift_card.dart';
|
||||
import '../shared/empty_state_view.dart';
|
||||
|
||||
|
||||
@@ -2,5 +2,4 @@ library staff_shifts;
|
||||
|
||||
export 'src/staff_shifts_module.dart';
|
||||
export 'src/shift_details_module.dart';
|
||||
export 'src/presentation/navigation/shifts_navigator.dart';
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:staff_main/src/presentation/blocs/staff_main_state.dart';
|
||||
import 'package:staff_main/src/presentation/constants/staff_main_routes.dart';
|
||||
import 'package:staff_main/src/presentation/navigation/staff_main_navigator.dart';
|
||||
|
||||
class StaffMainCubit extends Cubit<StaffMainState> implements Disposable {
|
||||
StaffMainCubit() : super(const StaffMainState()) {
|
||||
@@ -41,19 +40,19 @@ class StaffMainCubit extends Cubit<StaffMainState> implements Disposable {
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
Modular.to.navigateToShifts();
|
||||
Modular.to.toShifts();
|
||||
break;
|
||||
case 1:
|
||||
Modular.to.navigateToPayments();
|
||||
Modular.to.toPayments();
|
||||
break;
|
||||
case 2:
|
||||
Modular.to.navigateToHome();
|
||||
Modular.to.toStaffHome();
|
||||
break;
|
||||
case 3:
|
||||
Modular.to.navigateToClockIn();
|
||||
Modular.to.toClockIn();
|
||||
break;
|
||||
case 4:
|
||||
Modular.to.navigateToProfile();
|
||||
Modular.to.toProfile();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import '../constants/staff_main_routes.dart';
|
||||
|
||||
/// Extension to provide typed navigation for the Staff Main feature.
|
||||
extension StaffMainNavigator on IModularNavigator {
|
||||
/// Navigates to the Staff Main Shell (Home).
|
||||
/// This replaces the current navigation stack.
|
||||
void navigateStaffMain() {
|
||||
navigate('${StaffMainRoutes.modulePath}/home/');
|
||||
}
|
||||
|
||||
/// Navigates to the Shifts tab.
|
||||
void navigateToShifts() {
|
||||
navigate(StaffMainRoutes.shiftsFull);
|
||||
}
|
||||
|
||||
/// Navigates to the Payments tab.
|
||||
void navigateToPayments() {
|
||||
navigate(StaffMainRoutes.paymentsFull);
|
||||
}
|
||||
|
||||
/// Navigates to the Home tab.
|
||||
void navigateToHome() {
|
||||
navigate('${StaffMainRoutes.homeFull}/');
|
||||
}
|
||||
|
||||
/// Navigates to the Clock In tab.
|
||||
void navigateToClockIn() {
|
||||
navigate(StaffMainRoutes.clockInFull);
|
||||
}
|
||||
|
||||
/// Navigates to the Profile tab.
|
||||
void navigateToProfile() {
|
||||
navigate(StaffMainRoutes.profileFull);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,23 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:staff_home/staff_home.dart';
|
||||
import 'package:staff_profile/staff_profile.dart';
|
||||
import 'package:staff_profile_info/staff_profile_info.dart';
|
||||
import 'package:staff_emergency_contact/staff_emergency_contact.dart';
|
||||
import 'package:staff_profile_experience/staff_profile_experience.dart';
|
||||
import 'package:staff_bank_account/staff_bank_account.dart';
|
||||
import 'package:staff_tax_forms/staff_tax_forms.dart';
|
||||
import 'package:staff_documents/staff_documents.dart';
|
||||
import 'package:staff_certificates/staff_certificates.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:staff_attire/staff_attire.dart';
|
||||
import 'package:staff_shifts/staff_shifts.dart';
|
||||
import 'package:staff_payments/staff_payements.dart';
|
||||
import 'package:staff_time_card/staff_time_card.dart';
|
||||
import 'package:staff_availability/staff_availability.dart';
|
||||
import 'package:staff_bank_account/staff_bank_account.dart';
|
||||
import 'package:staff_certificates/staff_certificates.dart';
|
||||
import 'package:staff_clock_in/staff_clock_in.dart';
|
||||
|
||||
import 'package:staff_documents/staff_documents.dart';
|
||||
import 'package:staff_emergency_contact/staff_emergency_contact.dart';
|
||||
import 'package:staff_home/staff_home.dart';
|
||||
import 'package:staff_main/src/presentation/blocs/staff_main_cubit.dart';
|
||||
import 'package:staff_main/src/presentation/constants/staff_main_routes.dart';
|
||||
import 'package:staff_main/src/presentation/pages/placeholder_page.dart';
|
||||
import 'package:staff_main/src/presentation/pages/staff_main_page.dart';
|
||||
import 'package:staff_payments/staff_payements.dart';
|
||||
import 'package:staff_profile/staff_profile.dart';
|
||||
import 'package:staff_profile_experience/staff_profile_experience.dart';
|
||||
import 'package:staff_profile_info/staff_profile_info.dart';
|
||||
import 'package:staff_shifts/staff_shifts.dart';
|
||||
import 'package:staff_tax_forms/staff_tax_forms.dart';
|
||||
import 'package:staff_time_card/staff_time_card.dart';
|
||||
|
||||
class StaffMainModule extends Module {
|
||||
@override
|
||||
@@ -34,53 +32,70 @@ class StaffMainModule extends Module {
|
||||
child: (BuildContext context) => const StaffMainPage(),
|
||||
children: <ParallelRoute<dynamic>>[
|
||||
ModuleRoute<dynamic>(
|
||||
StaffMainRoutes.shifts,
|
||||
StaffPaths.childRoute(StaffPaths.main, StaffPaths.shifts),
|
||||
module: StaffShiftsModule(),
|
||||
),
|
||||
ModuleRoute<dynamic>(
|
||||
StaffMainRoutes.payments,
|
||||
StaffPaths.childRoute(StaffPaths.main, StaffPaths.payments),
|
||||
module: StaffPaymentsModule(),
|
||||
),
|
||||
ModuleRoute<dynamic>(
|
||||
StaffMainRoutes.home,
|
||||
StaffPaths.childRoute(StaffPaths.main, StaffPaths.home),
|
||||
module: StaffHomeModule(),
|
||||
),
|
||||
ModuleRoute<dynamic>(
|
||||
StaffMainRoutes.clockIn,
|
||||
StaffPaths.childRoute(StaffPaths.main, StaffPaths.clockIn),
|
||||
module: StaffClockInModule(),
|
||||
),
|
||||
ModuleRoute<dynamic>(
|
||||
StaffMainRoutes.profile,
|
||||
StaffPaths.childRoute(StaffPaths.main, StaffPaths.profile),
|
||||
module: StaffProfileModule(),
|
||||
),
|
||||
],
|
||||
);
|
||||
r.module('/onboarding', module: StaffProfileInfoModule());
|
||||
r.module('/emergency-contact', module: StaffEmergencyContactModule());
|
||||
r.module('/experience', module: StaffProfileExperienceModule());
|
||||
r.module('/attire', module: StaffAttireModule());
|
||||
r.module('/bank-account', module: StaffBankAccountModule());
|
||||
r.module('/tax-forms', module: StaffTaxFormsModule());
|
||||
r.module(
|
||||
'/documents',
|
||||
StaffPaths.childRoute(StaffPaths.main, StaffPaths.onboardingPersonalInfo).replaceFirst('/personal-info', ''),
|
||||
module: StaffProfileInfoModule(),
|
||||
);
|
||||
r.module(
|
||||
StaffPaths.childRoute(StaffPaths.main, StaffPaths.emergencyContact),
|
||||
module: StaffEmergencyContactModule(),
|
||||
);
|
||||
r.module(
|
||||
StaffPaths.childRoute(StaffPaths.main, StaffPaths.experience),
|
||||
module: StaffProfileExperienceModule(),
|
||||
);
|
||||
r.module(
|
||||
StaffPaths.childRoute(StaffPaths.main, StaffPaths.attire),
|
||||
module: StaffAttireModule(),
|
||||
);
|
||||
r.module(
|
||||
StaffPaths.childRoute(StaffPaths.main, StaffPaths.bankAccount),
|
||||
module: StaffBankAccountModule(),
|
||||
);
|
||||
r.module(
|
||||
StaffPaths.childRoute(StaffPaths.main, StaffPaths.taxForms),
|
||||
module: StaffTaxFormsModule(),
|
||||
);
|
||||
r.module(
|
||||
StaffPaths.childRoute(StaffPaths.main, StaffPaths.documents),
|
||||
module: StaffDocumentsModule(),
|
||||
);
|
||||
r.module(
|
||||
'/certificates',
|
||||
StaffPaths.childRoute(StaffPaths.main, StaffPaths.certificates),
|
||||
module: StaffCertificatesModule(),
|
||||
);
|
||||
r.module(
|
||||
'/time-card',
|
||||
StaffPaths.childRoute(StaffPaths.main, StaffPaths.timeCard),
|
||||
module: StaffTimeCardModule(),
|
||||
);
|
||||
r.module(
|
||||
'/availability',
|
||||
StaffPaths.childRoute(StaffPaths.main, StaffPaths.availability),
|
||||
module: StaffAvailabilityModule(),
|
||||
);
|
||||
r.module(
|
||||
'/shift-details',
|
||||
module: ShiftDetailsModule(),
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
library;
|
||||
|
||||
export 'src/presentation/navigation/staff_main_navigator.dart';
|
||||
export 'src/staff_main_module.dart';
|
||||
|
||||
Reference in New Issue
Block a user