From f57f41c508b0c273d9922d564e18c326eb71ce21 Mon Sep 17 00:00:00 2001 From: Achintha Isuru Date: Sat, 24 Jan 2026 10:00:36 -0500 Subject: [PATCH] Add explicit types and improve type safety across codebase This commit adds explicit type annotations to variables, function parameters, and return types throughout the codebase, particularly in widget trees, Bloc logic, and repository implementations. The changes improve code readability, maintainability, and type safety, and align with Dart best practices. No business logic was changed. --- .../apps/design_system_viewer/lib/main.dart | 2 +- apps/mobile/apps/staff/lib/main.dart | 10 ++-- .../domain/arguments/usecase_argument.dart | 2 +- .../lib/src/bloc/locale_bloc.dart | 4 +- .../locale_repository_impl.dart | 2 +- .../lib/src/mocks/home_repository_mock.dart | 6 +- .../design_system/lib/src/ui_theme.dart | 12 ++-- .../lib/src/widgets/ui_button.dart | 2 +- .../lib/src/widgets/ui_chip.dart | 18 +++--- .../lib/src/widgets/ui_step_indicator.dart | 4 +- .../lib/src/widgets/ui_text_field.dart | 4 +- .../lib/client_authentication.dart | 4 +- .../auth_repository_impl.dart | 29 ++++----- .../sign_in_with_email_arguments.dart | 2 +- .../sign_in_with_social_arguments.dart | 2 +- .../sign_up_with_email_arguments.dart | 2 +- .../presentation/blocs/client_auth_bloc.dart | 7 ++- .../presentation/blocs/client_auth_event.dart | 8 +-- .../presentation/blocs/client_auth_state.dart | 2 +- .../pages/client_get_started_page.dart | 22 +++---- .../pages/client_sign_in_page.dart | 16 ++--- .../pages/client_sign_up_page.dart | 20 +++---- .../client_sign_in_form.dart | 8 +-- .../client_sign_up_form.dart | 12 ++-- .../widgets/common/auth_divider.dart | 2 +- .../widgets/common/section_titles.dart | 2 +- .../client_create_order_repository_impl.dart | 60 +++++++++---------- .../blocs/one_time_order_bloc.dart | 15 ++--- .../one_time_order_position_card.dart | 6 +- .../features/client/home/lib/client_home.dart | 4 +- .../home_repository_impl.dart | 2 +- .../presentation/blocs/client_home_bloc.dart | 16 ++--- .../presentation/blocs/client_home_event.dart | 6 +- .../presentation/blocs/client_home_state.dart | 6 +- .../navigation/client_home_navigator.dart | 4 +- .../presentation/pages/client_home_page.dart | 14 ++--- .../presentation/widgets/actions_widget.dart | 6 +- .../widgets/client_home_edit_banner.dart | 8 +-- .../widgets/client_home_header.dart | 14 ++--- .../widgets/coverage_dashboard.dart | 38 ++++++------ .../presentation/widgets/coverage_widget.dart | 12 ++-- .../widgets/dashboard_widget_builder.dart | 8 +-- .../widgets/draggable_widget_wrapper.dart | 6 +- .../widgets/header_icon_button.dart | 4 +- .../widgets/live_activity_widget.dart | 22 +++---- .../presentation/widgets/reorder_widget.dart | 36 +++++------ .../widgets/shift_order_form_sheet.dart | 18 +++--- .../presentation/widgets/spending_widget.dart | 20 +++---- .../features/client/hubs/lib/client_hubs.dart | 2 +- .../hub_repository_impl.dart | 41 ++++++------- .../arguments/assign_nfc_tag_arguments.dart | 2 +- .../arguments/create_hub_arguments.dart | 2 +- .../arguments/delete_hub_arguments.dart | 2 +- .../presentation/blocs/client_hubs_bloc.dart | 9 +-- .../presentation/blocs/client_hubs_event.dart | 12 ++-- .../presentation/blocs/client_hubs_state.dart | 4 +- .../presentation/pages/client_hubs_page.dart | 19 +++--- .../presentation/widgets/add_hub_dialog.dart | 6 +- .../src/presentation/widgets/hub_card.dart | 10 ++-- .../presentation/widgets/hub_empty_state.dart | 4 +- .../presentation/widgets/hub_info_card.dart | 4 +- .../widgets/identify_nfc_dialog.dart | 12 ++-- .../client/settings/lib/client_settings.dart | 2 +- .../blocs/client_settings_event.dart | 2 +- .../blocs/client_settings_state.dart | 4 +- .../settings_profile_header.dart | 18 +++--- .../settings_quick_links.dart | 8 +-- .../view_orders_repository_impl.dart | 54 ++++++++--------- .../presentation/blocs/view_orders_cubit.dart | 14 ++--- .../auth_repository_impl.dart | 23 +++---- .../sign_in_with_phone_arguments.dart | 2 +- .../arguments/verify_otp_arguments.dart | 2 +- .../src/presentation/blocs/auth_event.dart | 10 ++-- .../src/presentation/blocs/auth_state.dart | 2 +- .../profile_setup/profile_setup_event.dart | 14 ++--- .../profile_setup/profile_setup_state.dart | 8 +-- .../navigation/auth_navigator.dart | 2 +- .../presentation/pages/get_started_page.dart | 4 +- .../pages/phone_verification_page.dart | 10 ++-- .../pages/profile_setup_page.dart | 34 +++++------ .../widgets/common/auth_trouble_link.dart | 2 +- .../common/section_title_subtitle.dart | 2 +- .../get_started_page/get_started_actions.dart | 2 +- .../get_started_background.dart | 4 +- .../get_started_page/get_started_header.dart | 4 +- .../otp_verification.dart | 4 +- .../otp_verification/otp_input_field.dart | 14 ++--- .../otp_verification/otp_resend_section.dart | 2 +- .../otp_verification_actions.dart | 2 +- .../otp_verification_header.dart | 4 +- .../phone_verification_page/phone_input.dart | 6 +- .../phone_input/phone_input_actions.dart | 2 +- .../phone_input/phone_input_form_field.dart | 8 +-- .../phone_input/phone_input_header.dart | 2 +- .../profile_setup_basic_info.dart | 4 +- .../profile_setup_experience.dart | 22 +++---- .../profile_setup_header.dart | 2 +- .../profile_setup_location.dart | 14 ++--- .../lib/staff_authentication.dart | 9 +-- 99 files changed, 495 insertions(+), 485 deletions(-) diff --git a/apps/mobile/apps/design_system_viewer/lib/main.dart b/apps/mobile/apps/design_system_viewer/lib/main.dart index 244a702c..7bd967d4 100644 --- a/apps/mobile/apps/design_system_viewer/lib/main.dart +++ b/apps/mobile/apps/design_system_viewer/lib/main.dart @@ -103,7 +103,7 @@ class _MyHomePageState extends State { // action in the IDE, or press "p" in the console), to see the // wireframe for each widget. mainAxisAlignment: .center, - children: [ + children: [ const Text('You have pushed the button this many times:'), Text( '$_counter', diff --git a/apps/mobile/apps/staff/lib/main.dart b/apps/mobile/apps/staff/lib/main.dart index 63d82ff0..e7c11471 100644 --- a/apps/mobile/apps/staff/lib/main.dart +++ b/apps/mobile/apps/staff/lib/main.dart @@ -17,10 +17,10 @@ void main() async { /// The main application module. class AppModule extends Module { @override - List get imports => [core_localization.LocalizationModule()]; + List get imports => [core_localization.LocalizationModule()]; @override - void routes(r) { + void routes(RouteManager r) { // Set the initial route to the authentication module r.module("/", module: staff_authentication.StaffAuthenticationModule()); @@ -40,7 +40,7 @@ class AppWidget extends StatelessWidget { @override Widget build(BuildContext context) { return BlocProvider( - create: (context) => + create: (BuildContext context) => Modular.get() ..add(const core_localization.LoadLocale()), child: @@ -48,14 +48,14 @@ class AppWidget extends StatelessWidget { core_localization.LocaleBloc, core_localization.LocaleState >( - builder: (context, state) { + builder: (BuildContext context, core_localization.LocaleState state) { return MaterialApp.router( title: "KROW Staff", theme: UiTheme.light, routerConfig: Modular.routerConfig, locale: state.locale, supportedLocales: state.supportedLocales, - localizationsDelegates: const [ + localizationsDelegates: const >[ GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, diff --git a/apps/mobile/packages/core/lib/src/domain/arguments/usecase_argument.dart b/apps/mobile/packages/core/lib/src/domain/arguments/usecase_argument.dart index 4936596d..aba3af53 100644 --- a/apps/mobile/packages/core/lib/src/domain/arguments/usecase_argument.dart +++ b/apps/mobile/packages/core/lib/src/domain/arguments/usecase_argument.dart @@ -8,5 +8,5 @@ abstract class UseCaseArgument extends Equatable { const UseCaseArgument(); @override - List get props => []; + List get props => []; } diff --git a/apps/mobile/packages/core_localization/lib/src/bloc/locale_bloc.dart b/apps/mobile/packages/core_localization/lib/src/bloc/locale_bloc.dart index 4d46b623..5ae60907 100644 --- a/apps/mobile/packages/core_localization/lib/src/bloc/locale_bloc.dart +++ b/apps/mobile/packages/core_localization/lib/src/bloc/locale_bloc.dart @@ -46,8 +46,8 @@ class LocaleBloc extends Bloc { LoadLocale event, Emitter emit, ) async { - final savedLocale = await getLocaleUseCase(); - final locale = const Locale('es'); + final Locale? savedLocale = await getLocaleUseCase(); + final Locale locale = const Locale('es'); LocaleSettings.setLocaleRaw(locale.languageCode); diff --git a/apps/mobile/packages/core_localization/lib/src/data/repositories_impl/locale_repository_impl.dart b/apps/mobile/packages/core_localization/lib/src/data/repositories_impl/locale_repository_impl.dart index b4927061..ddda18cb 100644 --- a/apps/mobile/packages/core_localization/lib/src/data/repositories_impl/locale_repository_impl.dart +++ b/apps/mobile/packages/core_localization/lib/src/data/repositories_impl/locale_repository_impl.dart @@ -19,7 +19,7 @@ class LocaleRepositoryImpl implements LocaleRepositoryInterface { @override Future getSavedLocale() async { - final languageCode = await _localDataSource.getLanguageCode(); + final String? languageCode = await _localDataSource.getLanguageCode(); if (languageCode != null) { return Locale(languageCode); } diff --git a/apps/mobile/packages/data_connect/lib/src/mocks/home_repository_mock.dart b/apps/mobile/packages/data_connect/lib/src/mocks/home_repository_mock.dart index 626c9fee..3da2699a 100644 --- a/apps/mobile/packages/data_connect/lib/src/mocks/home_repository_mock.dart +++ b/apps/mobile/packages/data_connect/lib/src/mocks/home_repository_mock.dart @@ -24,9 +24,9 @@ class HomeRepositoryMock { /// /// Returns a tuple of (businessName, photoUrl). (String, String?) getUserSession() { - final session = ClientSessionStore.instance.session; - final businessName = session?.business?.businessName ?? 'Your Company'; - final photoUrl = session?.userPhotoUrl; + final ClientSession? session = ClientSessionStore.instance.session; + final String businessName = session?.business?.businessName ?? 'Your Company'; + final String? photoUrl = session?.userPhotoUrl; return (businessName, photoUrl); } } diff --git a/apps/mobile/packages/design_system/lib/src/ui_theme.dart b/apps/mobile/packages/design_system/lib/src/ui_theme.dart index 92e295b2..ae97f1b6 100644 --- a/apps/mobile/packages/design_system/lib/src/ui_theme.dart +++ b/apps/mobile/packages/design_system/lib/src/ui_theme.dart @@ -70,7 +70,7 @@ class UiTheme { ), maximumSize: const Size(double.infinity, 54), ).copyWith( - side: WidgetStateProperty.resolveWith((states) { + side: WidgetStateProperty.resolveWith((Set states) { if (states.contains(WidgetState.disabled)) { return const BorderSide( color: UiColors.borderPrimary, @@ -79,7 +79,7 @@ class UiTheme { } return null; }), - overlayColor: WidgetStateProperty.resolveWith((states) { + overlayColor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(WidgetState.hovered)) return UiColors.buttonPrimaryHover; return null; @@ -238,7 +238,7 @@ class UiTheme { navigationBarTheme: NavigationBarThemeData( backgroundColor: UiColors.white, indicatorColor: UiColors.primaryInverse.withAlpha(51), // 20% of 255 - labelTextStyle: WidgetStateProperty.resolveWith((states) { + labelTextStyle: WidgetStateProperty.resolveWith((Set states) { if (states.contains(WidgetState.selected)) { return UiTypography.footnote2m.textPrimary; } @@ -248,7 +248,7 @@ class UiTheme { // Switch Theme switchTheme: SwitchThemeData( - trackColor: WidgetStateProperty.resolveWith((states) { + trackColor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(WidgetState.selected)) { return UiColors.switchActive; } @@ -259,7 +259,7 @@ class UiTheme { // Checkbox Theme checkboxTheme: CheckboxThemeData( - fillColor: WidgetStateProperty.resolveWith((states) { + fillColor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(WidgetState.selected)) return UiColors.primary; return null; }), @@ -268,7 +268,7 @@ class UiTheme { // Radio Theme radioTheme: RadioThemeData( - fillColor: WidgetStateProperty.resolveWith((states) { + fillColor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(WidgetState.selected)) return UiColors.primary; return null; }), diff --git a/apps/mobile/packages/design_system/lib/src/widgets/ui_button.dart b/apps/mobile/packages/design_system/lib/src/widgets/ui_button.dart index 1460f07a..7867798c 100644 --- a/apps/mobile/packages/design_system/lib/src/widgets/ui_button.dart +++ b/apps/mobile/packages/design_system/lib/src/widgets/ui_button.dart @@ -160,7 +160,7 @@ class UiButton extends StatelessWidget { } // Multiple elements case: Use a Row with MainAxisSize.min - final List children = []; + final List children = []; if (leadingIcon != null) { children.add(Icon(leadingIcon, size: iconSize)); diff --git a/apps/mobile/packages/design_system/lib/src/widgets/ui_chip.dart b/apps/mobile/packages/design_system/lib/src/widgets/ui_chip.dart index 55ec46d0..f7bd0177 100644 --- a/apps/mobile/packages/design_system/lib/src/widgets/ui_chip.dart +++ b/apps/mobile/packages/design_system/lib/src/widgets/ui_chip.dart @@ -68,21 +68,21 @@ class UiChip extends StatelessWidget { @override Widget build(BuildContext context) { - final backgroundColor = _getBackgroundColor(); - final contentColor = _getContentColor(); - final textStyle = _getTextStyle().copyWith(color: contentColor); - final padding = _getPadding(); - final iconSize = _getIconSize(); + final Color backgroundColor = _getBackgroundColor(); + final Color contentColor = _getContentColor(); + final TextStyle textStyle = _getTextStyle().copyWith(color: contentColor); + final EdgeInsets padding = _getPadding(); + final double iconSize = _getIconSize(); - final content = Row( + final Row content = Row( mainAxisSize: MainAxisSize.min, - children: [ - if (leadingIcon != null) ...[ + children: [ + if (leadingIcon != null) ...[ Icon(leadingIcon, size: iconSize, color: contentColor), SizedBox(width: _getGap()), ], Text(label, style: textStyle), - if (trailingIcon != null) ...[ + if (trailingIcon != null) ...[ SizedBox(width: _getGap()), GestureDetector( onTap: onTrailingIconTap, diff --git a/apps/mobile/packages/design_system/lib/src/widgets/ui_step_indicator.dart b/apps/mobile/packages/design_system/lib/src/widgets/ui_step_indicator.dart index e26275a8..3388098d 100644 --- a/apps/mobile/packages/design_system/lib/src/widgets/ui_step_indicator.dart +++ b/apps/mobile/packages/design_system/lib/src/widgets/ui_step_indicator.dart @@ -35,7 +35,7 @@ class UiStepIndicator extends StatelessWidget { padding: const EdgeInsets.symmetric(vertical: UiConstants.space2), child: Row( mainAxisAlignment: MainAxisAlignment.center, - children: List.generate(stepIcons.length, (index) { + children: List.generate(stepIcons.length, (int index) { final bool isActive = index == currentStep; final bool isCompleted = index < currentStep; @@ -53,7 +53,7 @@ class UiStepIndicator extends StatelessWidget { } return Row( - children: [ + children: [ Container( width: 40, height: 40, diff --git a/apps/mobile/packages/design_system/lib/src/widgets/ui_text_field.dart b/apps/mobile/packages/design_system/lib/src/widgets/ui_text_field.dart index 0ea7cb09..868df5c8 100644 --- a/apps/mobile/packages/design_system/lib/src/widgets/ui_text_field.dart +++ b/apps/mobile/packages/design_system/lib/src/widgets/ui_text_field.dart @@ -81,8 +81,8 @@ class UiTextField extends StatelessWidget { return Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, - children: [ - if (label != null) ...[ + children: [ + if (label != null) ...[ Text(label!, style: UiTypography.body4m.textSecondary), const SizedBox(height: UiConstants.space1), ], diff --git a/apps/mobile/packages/features/client/authentication/lib/client_authentication.dart b/apps/mobile/packages/features/client/authentication/lib/client_authentication.dart index 2a5b3cde..f78c647f 100644 --- a/apps/mobile/packages/features/client/authentication/lib/client_authentication.dart +++ b/apps/mobile/packages/features/client/authentication/lib/client_authentication.dart @@ -23,7 +23,7 @@ export 'package:core_localization/core_localization.dart'; /// A [Module] for the client authentication feature. class ClientAuthenticationModule extends Module { @override - List get imports => [DataConnectModule()]; + List get imports => [DataConnectModule()]; @override void binds(Injector i) { @@ -59,7 +59,7 @@ class ClientAuthenticationModule extends Module { } @override - void routes(r) { + void routes(RouteManager r) { r.child('/', child: (_) => const ClientGetStartedPage()); r.child('/client-sign-in', child: (_) => const ClientSignInPage()); r.child('/client-sign-up', child: (_) => const ClientSignUpPage()); diff --git a/apps/mobile/packages/features/client/authentication/lib/src/data/repositories_impl/auth_repository_impl.dart b/apps/mobile/packages/features/client/authentication/lib/src/data/repositories_impl/auth_repository_impl.dart index 0756527f..bd88b3a1 100644 --- a/apps/mobile/packages/features/client/authentication/lib/src/data/repositories_impl/auth_repository_impl.dart +++ b/apps/mobile/packages/features/client/authentication/lib/src/data/repositories_impl/auth_repository_impl.dart @@ -1,4 +1,5 @@ import 'package:firebase_auth/firebase_auth.dart' as firebase; +import 'package:firebase_data_connect/src/core/ref.dart'; import 'package:krow_data_connect/krow_data_connect.dart' as dc; import 'package:krow_domain/krow_domain.dart' as domain; import '../../domain/repositories/auth_repository_interface.dart'; @@ -24,12 +25,12 @@ class AuthRepositoryImpl implements AuthRepositoryInterface { required String password, }) async { try { - final credential = await _firebaseAuth.signInWithEmailAndPassword( + final firebase.UserCredential credential = await _firebaseAuth.signInWithEmailAndPassword( email: email, password: password, ); - final firebaseUser = credential.user; + final firebase.User? firebaseUser = credential.user; if (firebaseUser == null) { throw Exception('Sign-in failed, no Firebase user received.'); } @@ -59,12 +60,12 @@ class AuthRepositoryImpl implements AuthRepositoryInterface { required String password, }) async { try { - final credential = await _firebaseAuth.createUserWithEmailAndPassword( + final firebase.UserCredential credential = await _firebaseAuth.createUserWithEmailAndPassword( email: email, password: password, ); - final firebaseUser = credential.user; + final firebase.User? firebaseUser = credential.user; if (firebaseUser == null) { throw Exception('Sign-up failed, Firebase user could not be created.'); } @@ -72,20 +73,20 @@ class AuthRepositoryImpl implements AuthRepositoryInterface { // Client-specific business logic: // 1. Create a `Business` entity. // 2. Create a `User` entity associated with the business. - final createBusinessResponse = await _dataConnect.createBusiness( + final OperationResult createBusinessResponse = await _dataConnect.createBusiness( businessName: companyName, userId: firebaseUser.uid, rateGroup: dc.BusinessRateGroup.STANDARD, status: dc.BusinessStatus.PENDING, ).execute(); - final businessData = createBusinessResponse.data?.business_insert; + final dc.CreateBusinessBusinessInsert? businessData = createBusinessResponse.data?.business_insert; if (businessData == null) { await firebaseUser.delete(); // Rollback if business creation fails throw Exception('Business creation failed after Firebase user registration.'); } - final createUserResponse = await _dataConnect.createUser( + final OperationResult createUserResponse = await _dataConnect.createUser( id: firebaseUser.uid, role: dc.UserBaseRole.USER, ) @@ -93,7 +94,7 @@ class AuthRepositoryImpl implements AuthRepositoryInterface { .userRole('BUSINESS') .execute(); - final newUserData = createUserResponse.data?.user_insert; + final dc.CreateUserUserInsert? newUserData = createUserResponse.data?.user_insert; if (newUserData == null) { await firebaseUser.delete(); // Rollback if user profile creation fails // TO-DO: Also delete the created Business if this fails @@ -137,27 +138,27 @@ class AuthRepositoryImpl implements AuthRepositoryInterface { required String firebaseUserId, required String? fallbackEmail, }) async { - final response = await _dataConnect.getUserById(id: firebaseUserId).execute(); - final user = response.data?.user; + final QueryResult response = await _dataConnect.getUserById(id: firebaseUserId).execute(); + final dc.GetUserByIdUser? user = response.data?.user; if (user == null) { throw Exception('Authenticated user profile not found in database.'); } - final email = user.email ?? fallbackEmail; + final String? email = user.email ?? fallbackEmail; if (email == null || email.isEmpty) { throw Exception('User email is missing in profile data.'); } - final domainUser = domain.User( + final domain.User domainUser = domain.User( id: user.id, email: email, role: user.role.stringValue, ); - final businessResponse = await _dataConnect.getBusinessesByUserId( + final QueryResult businessResponse = await _dataConnect.getBusinessesByUserId( userId: firebaseUserId, ).execute(); - final business = businessResponse.data.businesses.isNotEmpty + final dc.GetBusinessesByUserIdBusinesses? business = businessResponse.data.businesses.isNotEmpty ? businessResponse.data.businesses.first : null; diff --git a/apps/mobile/packages/features/client/authentication/lib/src/domain/arguments/sign_in_with_email_arguments.dart b/apps/mobile/packages/features/client/authentication/lib/src/domain/arguments/sign_in_with_email_arguments.dart index 4c3f15af..54904804 100644 --- a/apps/mobile/packages/features/client/authentication/lib/src/domain/arguments/sign_in_with_email_arguments.dart +++ b/apps/mobile/packages/features/client/authentication/lib/src/domain/arguments/sign_in_with_email_arguments.dart @@ -11,5 +11,5 @@ class SignInWithEmailArguments extends UseCaseArgument { const SignInWithEmailArguments({required this.email, required this.password}); @override - List get props => [email, password]; + List get props => [email, password]; } diff --git a/apps/mobile/packages/features/client/authentication/lib/src/domain/arguments/sign_in_with_social_arguments.dart b/apps/mobile/packages/features/client/authentication/lib/src/domain/arguments/sign_in_with_social_arguments.dart index f658a5ab..4ba83fc2 100644 --- a/apps/mobile/packages/features/client/authentication/lib/src/domain/arguments/sign_in_with_social_arguments.dart +++ b/apps/mobile/packages/features/client/authentication/lib/src/domain/arguments/sign_in_with_social_arguments.dart @@ -8,5 +8,5 @@ class SignInWithSocialArguments extends UseCaseArgument { const SignInWithSocialArguments({required this.provider}); @override - List get props => [provider]; + List get props => [provider]; } diff --git a/apps/mobile/packages/features/client/authentication/lib/src/domain/arguments/sign_up_with_email_arguments.dart b/apps/mobile/packages/features/client/authentication/lib/src/domain/arguments/sign_up_with_email_arguments.dart index f282d657..7e0e127a 100644 --- a/apps/mobile/packages/features/client/authentication/lib/src/domain/arguments/sign_up_with_email_arguments.dart +++ b/apps/mobile/packages/features/client/authentication/lib/src/domain/arguments/sign_up_with_email_arguments.dart @@ -18,5 +18,5 @@ class SignUpWithEmailArguments extends UseCaseArgument { }); @override - List get props => [companyName, email, password]; + List get props => [companyName, email, password]; } diff --git a/apps/mobile/packages/features/client/authentication/lib/src/presentation/blocs/client_auth_bloc.dart b/apps/mobile/packages/features/client/authentication/lib/src/presentation/blocs/client_auth_bloc.dart index 0e241ea2..120c075e 100644 --- a/apps/mobile/packages/features/client/authentication/lib/src/presentation/blocs/client_auth_bloc.dart +++ b/apps/mobile/packages/features/client/authentication/lib/src/presentation/blocs/client_auth_bloc.dart @@ -1,4 +1,5 @@ import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:krow_domain/src/entities/users/user.dart'; import '../../domain/arguments/sign_in_with_email_arguments.dart'; import '../../domain/arguments/sign_in_with_social_arguments.dart'; import '../../domain/arguments/sign_up_with_email_arguments.dart'; @@ -50,7 +51,7 @@ class ClientAuthBloc extends Bloc { ) async { emit(state.copyWith(status: ClientAuthStatus.loading)); try { - final user = await _signInWithEmail( + final User user = await _signInWithEmail( SignInWithEmailArguments(email: event.email, password: event.password), ); emit(state.copyWith(status: ClientAuthStatus.authenticated, user: user)); @@ -71,7 +72,7 @@ class ClientAuthBloc extends Bloc { ) async { emit(state.copyWith(status: ClientAuthStatus.loading)); try { - final user = await _signUpWithEmail( + final User user = await _signUpWithEmail( SignUpWithEmailArguments( companyName: event.companyName, email: event.email, @@ -96,7 +97,7 @@ class ClientAuthBloc extends Bloc { ) async { emit(state.copyWith(status: ClientAuthStatus.loading)); try { - final user = await _signInWithSocial( + final User user = await _signInWithSocial( SignInWithSocialArguments(provider: event.provider), ); emit(state.copyWith(status: ClientAuthStatus.authenticated, user: user)); diff --git a/apps/mobile/packages/features/client/authentication/lib/src/presentation/blocs/client_auth_event.dart b/apps/mobile/packages/features/client/authentication/lib/src/presentation/blocs/client_auth_event.dart index 1e8a6c92..5eb35db1 100644 --- a/apps/mobile/packages/features/client/authentication/lib/src/presentation/blocs/client_auth_event.dart +++ b/apps/mobile/packages/features/client/authentication/lib/src/presentation/blocs/client_auth_event.dart @@ -5,7 +5,7 @@ abstract class ClientAuthEvent extends Equatable { const ClientAuthEvent(); @override - List get props => []; + List get props => []; } /// Event dispatched when a user attempts to sign in with email and password. @@ -16,7 +16,7 @@ class ClientSignInRequested extends ClientAuthEvent { const ClientSignInRequested({required this.email, required this.password}); @override - List get props => [email, password]; + List get props => [email, password]; } /// Event dispatched when a user attempts to create a new business account. @@ -32,7 +32,7 @@ class ClientSignUpRequested extends ClientAuthEvent { }); @override - List get props => [companyName, email, password]; + List get props => [companyName, email, password]; } /// Event dispatched for third-party authentication (Google/Apple). @@ -42,7 +42,7 @@ class ClientSocialSignInRequested extends ClientAuthEvent { const ClientSocialSignInRequested({required this.provider}); @override - List get props => [provider]; + List get props => [provider]; } /// Event dispatched when the user requests to terminate their session. diff --git a/apps/mobile/packages/features/client/authentication/lib/src/presentation/blocs/client_auth_state.dart b/apps/mobile/packages/features/client/authentication/lib/src/presentation/blocs/client_auth_state.dart index 0c42096b..47573991 100644 --- a/apps/mobile/packages/features/client/authentication/lib/src/presentation/blocs/client_auth_state.dart +++ b/apps/mobile/packages/features/client/authentication/lib/src/presentation/blocs/client_auth_state.dart @@ -50,5 +50,5 @@ class ClientAuthState extends Equatable { } @override - List get props => [status, user, errorMessage]; + List get props => [status, user, errorMessage]; } diff --git a/apps/mobile/packages/features/client/authentication/lib/src/presentation/pages/client_get_started_page.dart b/apps/mobile/packages/features/client/authentication/lib/src/presentation/pages/client_get_started_page.dart index 380efaad..0c9f9f3c 100644 --- a/apps/mobile/packages/features/client/authentication/lib/src/presentation/pages/client_get_started_page.dart +++ b/apps/mobile/packages/features/client/authentication/lib/src/presentation/pages/client_get_started_page.dart @@ -11,7 +11,7 @@ class ClientGetStartedPage extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( body: Stack( - children: [ + children: [ // Background Illustration/Visuals from prototype Positioned( top: -100, @@ -28,7 +28,7 @@ class ClientGetStartedPage extends StatelessWidget { SafeArea( child: Column( - children: [ + children: [ const SizedBox(height: UiConstants.space10), // Logo Center( @@ -48,7 +48,7 @@ class ClientGetStartedPage extends StatelessWidget { horizontal: UiConstants.space6, ), child: Stack( - children: [ + children: [ // Representative cards from prototype Positioned( top: 20, @@ -76,7 +76,7 @@ class ClientGetStartedPage extends StatelessWidget { vertical: UiConstants.space10, ), child: Column( - children: [ + children: [ Text( t.client_authentication.get_started_page.title, textAlign: TextAlign.center, @@ -132,7 +132,7 @@ class _ShiftOrderCard extends StatelessWidget { decoration: BoxDecoration( color: UiColors.white, borderRadius: UiConstants.radiusLg, - boxShadow: [ + boxShadow: [ BoxShadow( color: UiColors.black.withOpacity(0.1), blurRadius: 10, @@ -143,9 +143,9 @@ class _ShiftOrderCard extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, - children: [ + children: [ Row( - children: [ + children: [ Container( padding: const EdgeInsets.all(UiConstants.space1), decoration: BoxDecoration( @@ -195,7 +195,7 @@ class _WorkerProfileCard extends StatelessWidget { decoration: BoxDecoration( color: UiColors.white, borderRadius: UiConstants.radiusLg, - boxShadow: [ + boxShadow: [ BoxShadow( color: UiColors.black.withOpacity(0.1), blurRadius: 10, @@ -204,7 +204,7 @@ class _WorkerProfileCard extends StatelessWidget { ], ), child: Row( - children: [ + children: [ CircleAvatar( radius: 16, backgroundColor: UiColors.primary.withOpacity(0.1), @@ -214,7 +214,7 @@ class _WorkerProfileCard extends StatelessWidget { Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, - children: [ + children: [ Text('Alex Thompson', style: UiTypography.footnote1b), Text( 'Professional Waiter β€’ 4.9β˜…', @@ -236,7 +236,7 @@ class _CalendarCard extends StatelessWidget { decoration: BoxDecoration( color: UiColors.accent, borderRadius: UiConstants.radiusMd, - boxShadow: [ + boxShadow: [ BoxShadow( color: UiColors.black.withOpacity(0.1), blurRadius: 10, diff --git a/apps/mobile/packages/features/client/authentication/lib/src/presentation/pages/client_sign_in_page.dart b/apps/mobile/packages/features/client/authentication/lib/src/presentation/pages/client_sign_in_page.dart index c63e6e7e..6bde0059 100644 --- a/apps/mobile/packages/features/client/authentication/lib/src/presentation/pages/client_sign_in_page.dart +++ b/apps/mobile/packages/features/client/authentication/lib/src/presentation/pages/client_sign_in_page.dart @@ -35,13 +35,13 @@ class ClientSignInPage extends StatelessWidget { @override Widget build(BuildContext context) { - final i18n = t.client_authentication.sign_in_page; - final authBloc = Modular.get(); + final TranslationsClientAuthenticationSignInPageEn i18n = t.client_authentication.sign_in_page; + final ClientAuthBloc authBloc = Modular.get(); return BlocProvider.value( value: authBloc, child: BlocConsumer( - listener: (context, state) { + listener: (BuildContext context, ClientAuthState state) { if (state.status == ClientAuthStatus.authenticated) { Modular.to.navigateClientHome(); } else if (state.status == ClientAuthStatus.error) { @@ -52,8 +52,8 @@ class ClientSignInPage extends StatelessWidget { ); } }, - builder: (context, state) { - final isLoading = state.status == ClientAuthStatus.loading; + builder: (BuildContext context, ClientAuthState state) { + final bool isLoading = state.status == ClientAuthStatus.loading; return Scaffold( appBar: const UiAppBar(showBackButton: true), @@ -69,14 +69,14 @@ class ClientSignInPage extends StatelessWidget { child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ + children: [ SectionTitle(title: i18n.title, subtitle: i18n.subtitle), const SizedBox(height: UiConstants.space8), // Sign In Form ClientSignInForm( isLoading: isLoading, - onSignIn: ({required email, required password}) => + onSignIn: ({required String email, required String password}) => _handleSignIn( context, email: email, @@ -99,7 +99,7 @@ class ClientSignInPage extends StatelessWidget { // Sign Up Link Row( mainAxisAlignment: MainAxisAlignment.center, - children: [ + children: [ Text( i18n.no_account, style: UiTypography.body2r.textSecondary, diff --git a/apps/mobile/packages/features/client/authentication/lib/src/presentation/pages/client_sign_up_page.dart b/apps/mobile/packages/features/client/authentication/lib/src/presentation/pages/client_sign_up_page.dart index 44467b2d..0df74969 100644 --- a/apps/mobile/packages/features/client/authentication/lib/src/presentation/pages/client_sign_up_page.dart +++ b/apps/mobile/packages/features/client/authentication/lib/src/presentation/pages/client_sign_up_page.dart @@ -39,13 +39,13 @@ class ClientSignUpPage extends StatelessWidget { @override Widget build(BuildContext context) { - final i18n = t.client_authentication.sign_up_page; - final authBloc = Modular.get(); + final TranslationsClientAuthenticationSignUpPageEn i18n = t.client_authentication.sign_up_page; + final ClientAuthBloc authBloc = Modular.get(); return BlocProvider.value( value: authBloc, child: BlocConsumer( - listener: (context, state) { + listener: (BuildContext context, ClientAuthState state) { if (state.status == ClientAuthStatus.authenticated) { Modular.to.navigateClientHome(); } else if (state.status == ClientAuthStatus.error) { @@ -56,8 +56,8 @@ class ClientSignUpPage extends StatelessWidget { ); } }, - builder: (context, state) { - final isLoading = state.status == ClientAuthStatus.loading; + builder: (BuildContext context, ClientAuthState state) { + final bool isLoading = state.status == ClientAuthStatus.loading; return Scaffold( appBar: const UiAppBar(showBackButton: true), @@ -73,7 +73,7 @@ class ClientSignUpPage extends StatelessWidget { child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ + children: [ SectionTitle(title: i18n.title, subtitle: i18n.subtitle), const SizedBox(height: UiConstants.space8), @@ -82,9 +82,9 @@ class ClientSignUpPage extends StatelessWidget { isLoading: isLoading, onSignUp: ({ - required companyName, - required email, - required password, + required String companyName, + required String email, + required String password, }) => _handleSignUp( context, companyName: companyName, @@ -108,7 +108,7 @@ class ClientSignUpPage extends StatelessWidget { // Sign In Link Row( mainAxisAlignment: MainAxisAlignment.center, - children: [ + children: [ Text( i18n.has_account, style: UiTypography.body2r.textSecondary, diff --git a/apps/mobile/packages/features/client/authentication/lib/src/presentation/widgets/client_sign_in_page/client_sign_in_form.dart b/apps/mobile/packages/features/client/authentication/lib/src/presentation/widgets/client_sign_in_page/client_sign_in_form.dart index 9887a9cb..bfa0a737 100644 --- a/apps/mobile/packages/features/client/authentication/lib/src/presentation/widgets/client_sign_in_page/client_sign_in_form.dart +++ b/apps/mobile/packages/features/client/authentication/lib/src/presentation/widgets/client_sign_in_page/client_sign_in_form.dart @@ -26,8 +26,8 @@ class ClientSignInForm extends StatefulWidget { } class _ClientSignInFormState extends State { - final _emailController = TextEditingController(); - final _passwordController = TextEditingController(); + final TextEditingController _emailController = TextEditingController(); + final TextEditingController _passwordController = TextEditingController(); bool _obscurePassword = true; @override @@ -46,10 +46,10 @@ class _ClientSignInFormState extends State { @override Widget build(BuildContext context) { - final i18n = t.client_authentication.sign_in_page; + final TranslationsClientAuthenticationSignInPageEn i18n = t.client_authentication.sign_in_page; return Column( - children: [ + children: [ // Email Field UiTextField( label: i18n.email_label, diff --git a/apps/mobile/packages/features/client/authentication/lib/src/presentation/widgets/client_sign_up_page/client_sign_up_form.dart b/apps/mobile/packages/features/client/authentication/lib/src/presentation/widgets/client_sign_up_page/client_sign_up_form.dart index 5ed213f3..504d2db8 100644 --- a/apps/mobile/packages/features/client/authentication/lib/src/presentation/widgets/client_sign_up_page/client_sign_up_form.dart +++ b/apps/mobile/packages/features/client/authentication/lib/src/presentation/widgets/client_sign_up_page/client_sign_up_form.dart @@ -30,10 +30,10 @@ class ClientSignUpForm extends StatefulWidget { } class _ClientSignUpFormState extends State { - final _companyController = TextEditingController(); - final _emailController = TextEditingController(); - final _passwordController = TextEditingController(); - final _confirmPasswordController = TextEditingController(); + final TextEditingController _companyController = TextEditingController(); + final TextEditingController _emailController = TextEditingController(); + final TextEditingController _passwordController = TextEditingController(); + final TextEditingController _confirmPasswordController = TextEditingController(); bool _obscurePassword = true; @override @@ -62,10 +62,10 @@ class _ClientSignUpFormState extends State { @override Widget build(BuildContext context) { - final i18n = t.client_authentication.sign_up_page; + final TranslationsClientAuthenticationSignUpPageEn i18n = t.client_authentication.sign_up_page; return Column( - children: [ + children: [ // Company Name Field UiTextField( label: i18n.company_label, diff --git a/apps/mobile/packages/features/client/authentication/lib/src/presentation/widgets/common/auth_divider.dart b/apps/mobile/packages/features/client/authentication/lib/src/presentation/widgets/common/auth_divider.dart index db898fcb..66148a8e 100644 --- a/apps/mobile/packages/features/client/authentication/lib/src/presentation/widgets/common/auth_divider.dart +++ b/apps/mobile/packages/features/client/authentication/lib/src/presentation/widgets/common/auth_divider.dart @@ -15,7 +15,7 @@ class AuthDivider extends StatelessWidget { @override Widget build(BuildContext context) { return Row( - children: [ + children: [ const Expanded(child: Divider()), Padding( padding: const EdgeInsets.symmetric(horizontal: UiConstants.space4), diff --git a/apps/mobile/packages/features/client/authentication/lib/src/presentation/widgets/common/section_titles.dart b/apps/mobile/packages/features/client/authentication/lib/src/presentation/widgets/common/section_titles.dart index 3c548c50..67243de8 100644 --- a/apps/mobile/packages/features/client/authentication/lib/src/presentation/widgets/common/section_titles.dart +++ b/apps/mobile/packages/features/client/authentication/lib/src/presentation/widgets/common/section_titles.dart @@ -15,7 +15,7 @@ class SectionTitle extends StatelessWidget { Widget build(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Text(title, style: UiTypography.headline1m), Text(subtitle, style: UiTypography.body2r.textSecondary), ], diff --git a/apps/mobile/packages/features/client/create_order/lib/src/data/repositories_impl/client_create_order_repository_impl.dart b/apps/mobile/packages/features/client/create_order/lib/src/data/repositories_impl/client_create_order_repository_impl.dart index c3c77f6c..b4e324cf 100644 --- a/apps/mobile/packages/features/client/create_order/lib/src/data/repositories_impl/client_create_order_repository_impl.dart +++ b/apps/mobile/packages/features/client/create_order/lib/src/data/repositories_impl/client_create_order_repository_impl.dart @@ -52,18 +52,18 @@ class ClientCreateOrderRepositoryImpl @override Future createOneTimeOrder(domain.OneTimeOrder order) async { - final businessId = dc.ClientSessionStore.instance.session?.business?.id; + final String? businessId = dc.ClientSessionStore.instance.session?.business?.id; if (businessId == null || businessId.isEmpty) { await _firebaseAuth.signOut(); throw Exception('Business is missing. Please sign in again.'); } - final vendorId = order.vendorId; + final String? vendorId = order.vendorId; if (vendorId == null || vendorId.isEmpty) { throw Exception('Vendor is missing.'); } - final orderTimestamp = _toTimestamp(order.date); - final orderResult = await _dataConnect + final fdc.Timestamp orderTimestamp = _toTimestamp(order.date); + final fdc.OperationResult orderResult = await _dataConnect .createOrder(businessId: businessId, orderType: dc.OrderType.ONE_TIME) .vendorId(vendorId) .location(order.location) @@ -71,19 +71,19 @@ class ClientCreateOrderRepositoryImpl .date(orderTimestamp) .execute(); - final orderId = orderResult.data?.order_insert.id; + final String? orderId = orderResult.data?.order_insert.id; if (orderId == null) { throw Exception('Order creation failed.'); } - final workersNeeded = order.positions.fold( + final int workersNeeded = order.positions.fold( 0, - (sum, position) => sum + position.count, + (int sum, domain.OneTimeOrderPosition position) => sum + position.count, ); - final shiftTitle = 'Shift 1 ${_formatDate(order.date)}'; - final shiftCost = _calculateShiftCost(order); + final String shiftTitle = 'Shift 1 ${_formatDate(order.date)}'; + final double shiftCost = _calculateShiftCost(order); - final shiftResult = await _dataConnect + final fdc.OperationResult shiftResult = await _dataConnect .createShift(title: shiftTitle, orderId: orderId) .date(orderTimestamp) .location(order.location) @@ -95,19 +95,19 @@ class ClientCreateOrderRepositoryImpl .cost(shiftCost) .execute(); - final shiftId = shiftResult.data?.shift_insert.id; + final String? shiftId = shiftResult.data?.shift_insert.id; if (shiftId == null) { throw Exception('Shift creation failed.'); } - for (final position in order.positions) { - final start = _parseTime(order.date, position.startTime); - final end = _parseTime(order.date, position.endTime); - final normalizedEnd = + for (final domain.OneTimeOrderPosition position in order.positions) { + final DateTime start = _parseTime(order.date, position.startTime); + final DateTime end = _parseTime(order.date, position.endTime); + final DateTime normalizedEnd = end.isBefore(start) ? end.add(const Duration(days: 1)) : end; - final hours = normalizedEnd.difference(start).inMinutes / 60.0; - final rate = order.roleRates[position.role] ?? 0; - final totalValue = rate * hours * position.count; + final double hours = normalizedEnd.difference(start).inMinutes / 60.0; + final double rate = order.roleRates[position.role] ?? 0; + final double totalValue = rate * hours * position.count; await _dataConnect .createShiftRole( @@ -136,13 +136,13 @@ class ClientCreateOrderRepositoryImpl double _calculateShiftCost(domain.OneTimeOrder order) { double total = 0; - for (final position in order.positions) { - final start = _parseTime(order.date, position.startTime); - final end = _parseTime(order.date, position.endTime); - final normalizedEnd = + for (final domain.OneTimeOrderPosition position in order.positions) { + final DateTime start = _parseTime(order.date, position.startTime); + final DateTime end = _parseTime(order.date, position.endTime); + final DateTime normalizedEnd = end.isBefore(start) ? end.add(const Duration(days: 1)) : end; - final hours = normalizedEnd.difference(start).inMinutes / 60.0; - final rate = order.roleRates[position.role] ?? 0; + final double hours = normalizedEnd.difference(start).inMinutes / 60.0; + final double rate = order.roleRates[position.role] ?? 0; total += rate * hours * position.count; } return total; @@ -170,16 +170,16 @@ class ClientCreateOrderRepositoryImpl } fdc.Timestamp _toTimestamp(DateTime dateTime) { - final utc = dateTime.toUtc(); - final seconds = utc.millisecondsSinceEpoch ~/ 1000; - final nanoseconds = (utc.microsecondsSinceEpoch % 1000000) * 1000; + final DateTime utc = dateTime.toUtc(); + final int seconds = utc.millisecondsSinceEpoch ~/ 1000; + final int nanoseconds = (utc.microsecondsSinceEpoch % 1000000) * 1000; return fdc.Timestamp(nanoseconds, seconds); } String _formatDate(DateTime dateTime) { - final year = dateTime.year.toString().padLeft(4, '0'); - final month = dateTime.month.toString().padLeft(2, '0'); - final day = dateTime.day.toString().padLeft(2, '0'); + final String year = dateTime.year.toString().padLeft(4, '0'); + final String month = dateTime.month.toString().padLeft(2, '0'); + final String day = dateTime.day.toString().padLeft(2, '0'); return '$year-$month-$day'; } } diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/one_time_order_bloc.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/one_time_order_bloc.dart index 6690a272..c106a596 100644 --- a/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/one_time_order_bloc.dart +++ b/apps/mobile/packages/features/client/create_order/lib/src/presentation/blocs/one_time_order_bloc.dart @@ -1,3 +1,4 @@ +import 'package:firebase_data_connect/src/core/ref.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:krow_data_connect/krow_data_connect.dart' as dc; import 'package:krow_domain/krow_domain.dart'; @@ -26,10 +27,10 @@ class OneTimeOrderBloc extends Bloc { Future _loadVendors() async { try { - final result = await _dataConnect.listVendors().execute(); - final vendors = result.data.vendors + final QueryResult result = await _dataConnect.listVendors().execute(); + final List vendors = result.data.vendors .map( - (vendor) => Vendor( + (dc.ListVendorsVendors vendor) => Vendor( id: vendor.id, name: vendor.companyName, rates: const {}, @@ -44,12 +45,12 @@ class OneTimeOrderBloc extends Bloc { Future _loadRolesForVendor(String vendorId) async { try { - final result = await _dataConnect.listRolesByVendorId( + final QueryResult result = await _dataConnect.listRolesByVendorId( vendorId: vendorId, ).execute(); - final roles = result.data.roles + final List roles = result.data.roles .map( - (role) => OneTimeOrderRoleOption( + (dc.ListRolesByVendorIdRoles role) => OneTimeOrderRoleOption( id: role.id, name: role.name, costPerHour: role.costPerHour, @@ -146,7 +147,7 @@ class OneTimeOrderBloc extends Bloc { emit(state.copyWith(status: OneTimeOrderStatus.loading)); try { final Map roleRates = { - for (final role in state.roles) role.id: role.costPerHour, + for (final OneTimeOrderRoleOption role in state.roles) role.id: role.costPerHour, }; final OneTimeOrder order = OneTimeOrder( date: state.date, diff --git a/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/one_time_order/one_time_order_position_card.dart b/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/one_time_order/one_time_order_position_card.dart index 0ea74c31..0c16bccc 100644 --- a/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/one_time_order/one_time_order_position_card.dart +++ b/apps/mobile/packages/features/client/create_order/lib/src/presentation/widgets/one_time_order/one_time_order_position_card.dart @@ -301,9 +301,9 @@ class OneTimeOrderPositionCard extends StatelessWidget { } List> _buildRoleItems() { - final items = roles + final List> items = roles .map( - (role) => DropdownMenuItem( + (OneTimeOrderRoleOption role) => DropdownMenuItem( value: role.id, child: Text( '${role.name} - \$${role.costPerHour.toStringAsFixed(0)}', @@ -313,7 +313,7 @@ class OneTimeOrderPositionCard extends StatelessWidget { ) .toList(); - final hasSelected = roles.any((role) => role.id == position.role); + final bool hasSelected = roles.any((OneTimeOrderRoleOption role) => role.id == position.role); if (position.role.isNotEmpty && !hasSelected) { items.add( DropdownMenuItem( diff --git a/apps/mobile/packages/features/client/home/lib/client_home.dart b/apps/mobile/packages/features/client/home/lib/client_home.dart index b6ca088d..9a61b3bb 100644 --- a/apps/mobile/packages/features/client/home/lib/client_home.dart +++ b/apps/mobile/packages/features/client/home/lib/client_home.dart @@ -18,7 +18,7 @@ export 'src/presentation/navigation/client_home_navigator.dart'; /// including repositories, use cases, and BLoCs. class ClientHomeModule extends Module { @override - List get imports => [DataConnectModule()]; + List get imports => [DataConnectModule()]; @override void binds(Injector i) { @@ -41,7 +41,7 @@ class ClientHomeModule extends Module { } @override - void routes(r) { + void routes(RouteManager r) { r.child('/', child: (_) => const ClientHomePage()); } } diff --git a/apps/mobile/packages/features/client/home/lib/src/data/repositories_impl/home_repository_impl.dart b/apps/mobile/packages/features/client/home/lib/src/data/repositories_impl/home_repository_impl.dart index 23c5ff01..db4b0dea 100644 --- a/apps/mobile/packages/features/client/home/lib/src/data/repositories_impl/home_repository_impl.dart +++ b/apps/mobile/packages/features/client/home/lib/src/data/repositories_impl/home_repository_impl.dart @@ -21,7 +21,7 @@ class HomeRepositoryImpl implements HomeRepositoryInterface { @override UserSessionData getUserSessionData() { - final (businessName, photoUrl) = _mock.getUserSession(); + final (String businessName, String? photoUrl) = _mock.getUserSession(); return UserSessionData( businessName: businessName, photoUrl: photoUrl, diff --git a/apps/mobile/packages/features/client/home/lib/src/presentation/blocs/client_home_bloc.dart b/apps/mobile/packages/features/client/home/lib/src/presentation/blocs/client_home_bloc.dart index 3fff1716..048b6ac5 100644 --- a/apps/mobile/packages/features/client/home/lib/src/presentation/blocs/client_home_bloc.dart +++ b/apps/mobile/packages/features/client/home/lib/src/presentation/blocs/client_home_bloc.dart @@ -1,4 +1,6 @@ +import 'package:client_home/src/domain/repositories/home_repository_interface.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:krow_domain/src/entities/home/home_dashboard_data.dart'; import '../../domain/usecases/get_dashboard_data_usecase.dart'; import '../../domain/usecases/get_user_session_data_usecase.dart'; import 'client_home_event.dart'; @@ -29,10 +31,10 @@ class ClientHomeBloc extends Bloc { emit(state.copyWith(status: ClientHomeStatus.loading)); try { // Get session data - final sessionData = _getUserSessionDataUseCase(); + final UserSessionData sessionData = _getUserSessionDataUseCase(); // Get dashboard data - final data = await _getDashboardDataUseCase(); + final HomeDashboardData data = await _getDashboardDataUseCase(); emit( state.copyWith( @@ -63,7 +65,7 @@ class ClientHomeBloc extends Bloc { ClientHomeWidgetVisibilityToggled event, Emitter emit, ) { - final newVisibility = Map.from(state.widgetVisibility); + final Map newVisibility = Map.from(state.widgetVisibility); newVisibility[event.widgetId] = !(newVisibility[event.widgetId] ?? true); emit(state.copyWith(widgetVisibility: newVisibility)); } @@ -72,14 +74,14 @@ class ClientHomeBloc extends Bloc { ClientHomeWidgetReordered event, Emitter emit, ) { - final newList = List.from(state.widgetOrder); + final List newList = List.from(state.widgetOrder); int oldIndex = event.oldIndex; int newIndex = event.newIndex; if (oldIndex < newIndex) { newIndex -= 1; } - final item = newList.removeAt(oldIndex); + final String item = newList.removeAt(oldIndex); newList.insert(newIndex, item); emit(state.copyWith(widgetOrder: newList)); @@ -91,14 +93,14 @@ class ClientHomeBloc extends Bloc { ) { emit( state.copyWith( - widgetOrder: const [ + widgetOrder: const [ 'actions', 'reorder', 'coverage', 'spending', 'liveActivity', ], - widgetVisibility: const { + widgetVisibility: const { 'actions': true, 'reorder': true, 'coverage': true, diff --git a/apps/mobile/packages/features/client/home/lib/src/presentation/blocs/client_home_event.dart b/apps/mobile/packages/features/client/home/lib/src/presentation/blocs/client_home_event.dart index 86524041..10eecaad 100644 --- a/apps/mobile/packages/features/client/home/lib/src/presentation/blocs/client_home_event.dart +++ b/apps/mobile/packages/features/client/home/lib/src/presentation/blocs/client_home_event.dart @@ -4,7 +4,7 @@ abstract class ClientHomeEvent extends Equatable { const ClientHomeEvent(); @override - List get props => []; + List get props => []; } class ClientHomeStarted extends ClientHomeEvent {} @@ -16,7 +16,7 @@ class ClientHomeWidgetVisibilityToggled extends ClientHomeEvent { const ClientHomeWidgetVisibilityToggled(this.widgetId); @override - List get props => [widgetId]; + List get props => [widgetId]; } class ClientHomeWidgetReordered extends ClientHomeEvent { @@ -25,7 +25,7 @@ class ClientHomeWidgetReordered extends ClientHomeEvent { const ClientHomeWidgetReordered(this.oldIndex, this.newIndex); @override - List get props => [oldIndex, newIndex]; + List get props => [oldIndex, newIndex]; } class ClientHomeLayoutReset extends ClientHomeEvent {} diff --git a/apps/mobile/packages/features/client/home/lib/src/presentation/blocs/client_home_state.dart b/apps/mobile/packages/features/client/home/lib/src/presentation/blocs/client_home_state.dart index 690b8c53..bfcd6d37 100644 --- a/apps/mobile/packages/features/client/home/lib/src/presentation/blocs/client_home_state.dart +++ b/apps/mobile/packages/features/client/home/lib/src/presentation/blocs/client_home_state.dart @@ -17,10 +17,10 @@ class ClientHomeState extends Equatable { const ClientHomeState({ this.status = ClientHomeStatus.initial, - this.widgetOrder = const [ + this.widgetOrder = const [ 'actions', ], - this.widgetVisibility = const { + this.widgetVisibility = const { 'actions': true, }, this.isEditMode = false, @@ -60,7 +60,7 @@ class ClientHomeState extends Equatable { } @override - List get props => [ + List get props => [ status, widgetOrder, widgetVisibility, diff --git a/apps/mobile/packages/features/client/home/lib/src/presentation/navigation/client_home_navigator.dart b/apps/mobile/packages/features/client/home/lib/src/presentation/navigation/client_home_navigator.dart index 97ab786e..1c421a36 100644 --- a/apps/mobile/packages/features/client/home/lib/src/presentation/navigation/client_home_navigator.dart +++ b/apps/mobile/packages/features/client/home/lib/src/presentation/navigation/client_home_navigator.dart @@ -31,10 +31,10 @@ class ClientHomeSheets { context: context, isScrollControlled: true, backgroundColor: Colors.transparent, - builder: (context) { + builder: (BuildContext context) { return ShiftOrderFormSheet( initialData: initialData, - onSubmit: (data) { + onSubmit: (Map data) { Navigator.pop(context); onSubmit(data); }, diff --git a/apps/mobile/packages/features/client/home/lib/src/presentation/pages/client_home_page.dart b/apps/mobile/packages/features/client/home/lib/src/presentation/pages/client_home_page.dart index 78189e06..e4e30728 100644 --- a/apps/mobile/packages/features/client/home/lib/src/presentation/pages/client_home_page.dart +++ b/apps/mobile/packages/features/client/home/lib/src/presentation/pages/client_home_page.dart @@ -21,20 +21,20 @@ class ClientHomePage extends StatelessWidget { @override Widget build(BuildContext context) { - final i18n = t.client_home; + final TranslationsClientHomeEn i18n = t.client_home; return BlocProvider( - create: (context) => + create: (BuildContext context) => Modular.get()..add(ClientHomeStarted()), child: Scaffold( body: SafeArea( child: Column( - children: [ + children: [ ClientHomeHeader(i18n: i18n), ClientHomeEditBanner(i18n: i18n), Flexible( child: BlocBuilder( - builder: (context, state) { + builder: (BuildContext context, ClientHomeState state) { if (state.isEditMode) { return _buildEditModeList(context, state); } @@ -58,12 +58,12 @@ class ClientHomePage extends StatelessWidget { UiConstants.space4, 100, ), - onReorder: (oldIndex, newIndex) { + onReorder: (int oldIndex, int newIndex) { BlocProvider.of(context).add( ClientHomeWidgetReordered(oldIndex, newIndex), ); }, - children: state.widgetOrder.map((id) { + children: state.widgetOrder.map((String id) { return Container( key: ValueKey(id), margin: const EdgeInsets.only(bottom: UiConstants.space4), @@ -86,7 +86,7 @@ class ClientHomePage extends StatelessWidget { UiConstants.space4, 100, ), - children: state.widgetOrder.map((id) { + children: state.widgetOrder.map((String id) { return Padding( padding: const EdgeInsets.only(bottom: UiConstants.space4), child: DashboardWidgetBuilder( diff --git a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/actions_widget.dart b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/actions_widget.dart index 784fdf6f..eeebff38 100644 --- a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/actions_widget.dart +++ b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/actions_widget.dart @@ -20,10 +20,10 @@ class ActionsWidget extends StatelessWidget { @override Widget build(BuildContext context) { // Check if client_home exists in t - final i18n = t.client_home.actions; + final TranslationsClientHomeActionsEn i18n = t.client_home.actions; return Row( - children: [ + children: [ Expanded( child: _ActionCard( title: i18n.rapid, @@ -96,7 +96,7 @@ class _ActionCard extends StatelessWidget { ), child: Column( mainAxisAlignment: MainAxisAlignment.center, - children: [ + children: [ Container( width: 36, height: 36, diff --git a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/client_home_edit_banner.dart b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/client_home_edit_banner.dart index d9437a3d..7db658d7 100644 --- a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/client_home_edit_banner.dart +++ b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/client_home_edit_banner.dart @@ -22,8 +22,8 @@ class ClientHomeEditBanner extends StatelessWidget { @override Widget build(BuildContext context) { return BlocBuilder( - buildWhen: (prev, curr) => prev.isEditMode != curr.isEditMode, - builder: (context, state) { + buildWhen: (ClientHomeState prev, ClientHomeState curr) => prev.isEditMode != curr.isEditMode, + builder: (BuildContext context, ClientHomeState state) { return AnimatedContainer( duration: const Duration(milliseconds: 300), height: state.isEditMode ? 76 : 0, @@ -40,13 +40,13 @@ class ClientHomeEditBanner extends StatelessWidget { ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ + children: [ const Icon(UiIcons.edit, size: 16, color: UiColors.primary), const SizedBox(width: UiConstants.space2), Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, - children: [ + children: [ Text( i18n.dashboard.edit_mode_active, style: UiTypography.footnote1b.copyWith( diff --git a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/client_home_header.dart b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/client_home_header.dart index 805f4213..12b6a222 100644 --- a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/client_home_header.dart +++ b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/client_home_header.dart @@ -25,10 +25,10 @@ class ClientHomeHeader extends StatelessWidget { @override Widget build(BuildContext context) { return BlocBuilder( - builder: (context, state) { - final businessName = state.businessName; - final photoUrl = state.photoUrl; - final avatarLetter = businessName.trim().isNotEmpty + builder: (BuildContext context, ClientHomeState state) { + final String businessName = state.businessName; + final String? photoUrl = state.photoUrl; + final String avatarLetter = businessName.trim().isNotEmpty ? businessName.trim()[0].toUpperCase() : 'C'; @@ -41,9 +41,9 @@ class ClientHomeHeader extends StatelessWidget { ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ + children: [ Row( - children: [ + children: [ Container( width: 40, height: 40, @@ -73,7 +73,7 @@ class ClientHomeHeader extends StatelessWidget { const SizedBox(width: UiConstants.space3), Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Text( i18n.dashboard.welcome_back, style: UiTypography.footnote2r.textSecondary, diff --git a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/coverage_dashboard.dart b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/coverage_dashboard.dart index ab203897..c40f0202 100644 --- a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/coverage_dashboard.dart +++ b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/coverage_dashboard.dart @@ -23,32 +23,32 @@ class CoverageDashboard extends StatelessWidget { double todayCost = 0; for (final s in shifts) { - final needed = s['workersNeeded'] as int? ?? 0; - final confirmed = s['filled'] as int? ?? 0; - final rate = s['hourlyRate'] as double? ?? 20.0; + final int needed = s['workersNeeded'] as int? ?? 0; + final int confirmed = s['filled'] as int? ?? 0; + final double rate = s['hourlyRate'] as double? ?? 20.0; totalNeeded += needed; totalConfirmed += confirmed; todayCost += rate * 8 * confirmed; } - final coveragePercent = totalNeeded > 0 + final int coveragePercent = totalNeeded > 0 ? ((totalConfirmed / totalNeeded) * 100).round() : 100; - final unfilledPositions = totalNeeded - totalConfirmed; + final int unfilledPositions = totalNeeded - totalConfirmed; - final checkedInCount = applications + final int checkedInCount = applications .where((a) => (a as Map)['checkInTime'] != null) .length; - final lateWorkersCount = applications + final int lateWorkersCount = applications .where((a) => (a as Map)['status'] == 'LATE') .length; - final isCoverageGood = coveragePercent >= 90; - final coverageBadgeColor = isCoverageGood + final bool isCoverageGood = coveragePercent >= 90; + final Color coverageBadgeColor = isCoverageGood ? const Color(0xFFD1FAE5) // TODO: Use design system color if available : const Color(0xFFFEF3C7); - final coverageTextColor = isCoverageGood + final Color coverageTextColor = isCoverageGood ? const Color(0xFF047857) : const Color(0xFFB45309); @@ -58,7 +58,7 @@ class CoverageDashboard extends StatelessWidget { color: UiColors.white, borderRadius: UiConstants.radiusLg, border: Border.all(color: UiColors.border), - boxShadow: [ + boxShadow: [ BoxShadow( color: UiColors.black.withValues(alpha: 0.02), blurRadius: 4, @@ -67,10 +67,10 @@ class CoverageDashboard extends StatelessWidget { ], ), child: Column( - children: [ + children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ + children: [ Text("Today's Status", style: UiTypography.body1m.textSecondary), Container( padding: const EdgeInsets.symmetric( @@ -94,17 +94,17 @@ class CoverageDashboard extends StatelessWidget { Row( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Expanded( child: Column( - children: [ + children: [ _StatusCard( label: 'Unfilled Today', value: '$unfilledPositions', icon: UiIcons.warning, isWarning: unfilledPositions > 0, ), - if (lateWorkersCount > 0) ...[ + if (lateWorkersCount > 0) ...[ const SizedBox(height: UiConstants.space2), _StatusCard( label: 'Running Late', @@ -119,7 +119,7 @@ class CoverageDashboard extends StatelessWidget { const SizedBox(width: UiConstants.space2), Expanded( child: Column( - children: [ + children: [ _StatusCard( label: 'Checked In', value: '$checkedInCount/$totalConfirmed', @@ -194,9 +194,9 @@ class _StatusCard extends StatelessWidget { ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Row( - children: [ + children: [ Icon(icon, size: 16, color: iconColor), const SizedBox(width: UiConstants.space2), Expanded( diff --git a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/coverage_widget.dart b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/coverage_widget.dart index fea90fb1..9e812804 100644 --- a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/coverage_widget.dart +++ b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/coverage_widget.dart @@ -23,10 +23,10 @@ class CoverageWidget extends StatelessWidget { @override Widget build(BuildContext context) { return Column( - children: [ + children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ + children: [ Text( "TODAY'S COVERAGE", style: UiTypography.footnote1b.copyWith( @@ -55,7 +55,7 @@ class CoverageWidget extends StatelessWidget { ), const SizedBox(height: UiConstants.space2), Row( - children: [ + children: [ Expanded( child: _MetricCard( icon: UiIcons.target, @@ -114,7 +114,7 @@ class _MetricCard extends StatelessWidget { color: UiColors.cardViewBackground, borderRadius: UiConstants.radiusLg, border: Border.all(color: UiColors.border), - boxShadow: [ + boxShadow: [ BoxShadow( color: UiColors.black.withValues(alpha: 0.02), blurRadius: 2, @@ -123,9 +123,9 @@ class _MetricCard extends StatelessWidget { ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Row( - children: [ + children: [ Icon(icon, size: 14, color: iconColor), const SizedBox(width: 6), // 6px Text( diff --git a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/dashboard_widget_builder.dart b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/dashboard_widget_builder.dart index 488d0464..9c3426db 100644 --- a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/dashboard_widget_builder.dart +++ b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/dashboard_widget_builder.dart @@ -34,8 +34,8 @@ class DashboardWidgetBuilder extends StatelessWidget { @override Widget build(BuildContext context) { - final i18n = t.client_home.widgets; - final widgetContent = _buildWidgetContent(context); + final TranslationsClientHomeWidgetsEn i18n = t.client_home.widgets; + final Widget widgetContent = _buildWidgetContent(context); if (isEditMode) { return DraggableWidgetWrapper( @@ -64,11 +64,11 @@ class DashboardWidgetBuilder extends StatelessWidget { ); case 'reorder': return ReorderWidget( - onReorderPressed: (data) { + onReorderPressed: (Map data) { ClientHomeSheets.showOrderFormSheet( context, data, - onSubmit: (submittedData) { + onSubmit: (Map submittedData) { // Handle form submission if needed }, ); diff --git a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/draggable_widget_wrapper.dart b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/draggable_widget_wrapper.dart index 57131f9e..3f82a79e 100644 --- a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/draggable_widget_wrapper.dart +++ b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/draggable_widget_wrapper.dart @@ -34,9 +34,9 @@ class DraggableWidgetWrapper extends StatelessWidget { Widget build(BuildContext context) { return Column( spacing: UiConstants.space2, - children: [ + children: [ Row( - children: [ + children: [ Container( padding: const EdgeInsets.symmetric( horizontal: UiConstants.space2, @@ -48,7 +48,7 @@ class DraggableWidgetWrapper extends StatelessWidget { border: Border.all(color: UiColors.border), ), child: Row( - children: [ + children: [ const Icon( UiIcons.gripVertical, size: 14, diff --git a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/header_icon_button.dart b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/header_icon_button.dart index 41f42615..b093130d 100644 --- a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/header_icon_button.dart +++ b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/header_icon_button.dart @@ -33,14 +33,14 @@ class HeaderIconButton extends StatelessWidget { onTap: onTap, child: Stack( clipBehavior: Clip.none, - children: [ + children: [ Container( width: 32, height: 32, decoration: BoxDecoration( color: isActive ? UiColors.primary : UiColors.white, borderRadius: UiConstants.radiusMd, - boxShadow: [ + boxShadow: [ BoxShadow( color: Colors.black.withValues(alpha: 0.05), blurRadius: 2, diff --git a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/live_activity_widget.dart b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/live_activity_widget.dart index 037eb7d2..47bbcfb9 100644 --- a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/live_activity_widget.dart +++ b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/live_activity_widget.dart @@ -13,18 +13,18 @@ class LiveActivityWidget extends StatelessWidget { @override Widget build(BuildContext context) { - final i18n = t.client_home; + final TranslationsClientHomeEn i18n = t.client_home; // Mock data - final shifts = [ - { + final List> shifts = >[ + { 'workersNeeded': 5, 'filled': 4, 'hourlyRate': 20.0, 'status': 'OPEN', 'date': DateTime.now().toIso8601String().split('T')[0], }, - { + { 'workersNeeded': 5, 'filled': 5, 'hourlyRate': 22.0, @@ -32,18 +32,18 @@ class LiveActivityWidget extends StatelessWidget { 'date': DateTime.now().toIso8601String().split('T')[0], }, ]; - final applications = [ - {'status': 'CONFIRMED', 'checkInTime': '09:00'}, - {'status': 'CONFIRMED', 'checkInTime': '09:05'}, - {'status': 'CONFIRMED'}, - {'status': 'LATE'}, + final List> applications = >[ + {'status': 'CONFIRMED', 'checkInTime': '09:00'}, + {'status': 'CONFIRMED', 'checkInTime': '09:05'}, + {'status': 'CONFIRMED'}, + {'status': 'LATE'}, ]; return Column( - children: [ + children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ + children: [ Text( i18n.widgets.live_activity.toUpperCase(), style: UiTypography.footnote1b.textSecondary.copyWith( diff --git a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/reorder_widget.dart b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/reorder_widget.dart index eccf3281..c9f72fb9 100644 --- a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/reorder_widget.dart +++ b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/reorder_widget.dart @@ -12,11 +12,11 @@ class ReorderWidget extends StatelessWidget { @override Widget build(BuildContext context) { - final i18n = t.client_home.reorder; + final TranslationsClientHomeReorderEn i18n = t.client_home.reorder; // Mock recent orders - final recentOrders = [ - { + final List> recentOrders = >[ + { 'title': 'Server', 'location': 'Downtown Restaurant', 'hourlyRate': 18.0, @@ -24,7 +24,7 @@ class ReorderWidget extends StatelessWidget { 'workers': 3, 'type': 'One Day', }, - { + { 'title': 'Bartender', 'location': 'Rooftop Bar', 'hourlyRate': 22.0, @@ -32,7 +32,7 @@ class ReorderWidget extends StatelessWidget { 'workers': 2, 'type': 'One Day', }, - { + { 'title': 'Event Staff', 'location': 'Convention Center', 'hourlyRate': 20.0, @@ -44,7 +44,7 @@ class ReorderWidget extends StatelessWidget { return Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Text( i18n.title, style: UiTypography.footnote1b.textSecondary.copyWith( @@ -57,11 +57,11 @@ class ReorderWidget extends StatelessWidget { child: ListView.separated( scrollDirection: Axis.horizontal, itemCount: recentOrders.length, - separatorBuilder: (context, index) => + separatorBuilder: (BuildContext context, int index) => const SizedBox(width: UiConstants.space3), - itemBuilder: (context, index) { - final order = recentOrders[index]; - final totalCost = + itemBuilder: (BuildContext context, int index) { + final Map order = recentOrders[index]; + final double totalCost = (order['hourlyRate'] as double) * (order['hours'] as int) * (order['workers'] as int); @@ -73,7 +73,7 @@ class ReorderWidget extends StatelessWidget { color: UiColors.white, borderRadius: UiConstants.radiusLg, border: Border.all(color: UiColors.border), - boxShadow: [ + boxShadow: [ BoxShadow( color: UiColors.black.withValues(alpha: 0.02), blurRadius: 4, @@ -82,13 +82,13 @@ class ReorderWidget extends StatelessWidget { ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ + children: [ Expanded( child: Row( - children: [ + children: [ Container( width: 36, height: 36, @@ -108,7 +108,7 @@ class ReorderWidget extends StatelessWidget { Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Text( order['title'] as String, style: UiTypography.body2b, @@ -128,7 +128,7 @@ class ReorderWidget extends StatelessWidget { ), Column( crossAxisAlignment: CrossAxisAlignment.end, - children: [ + children: [ Text( '\$${totalCost.toStringAsFixed(0)}', style: UiTypography.body1b, @@ -146,7 +146,7 @@ class ReorderWidget extends StatelessWidget { ), const SizedBox(height: UiConstants.space3), Row( - children: [ + children: [ _Badge( icon: UiIcons.success, text: order['type'] as String, @@ -222,7 +222,7 @@ class _Badge extends StatelessWidget { decoration: BoxDecoration(color: bg, borderRadius: UiConstants.radiusSm), child: Row( mainAxisSize: MainAxisSize.min, - children: [ + children: [ Icon(icon, size: 10, color: bg == textColor ? UiColors.white : color), const SizedBox(width: UiConstants.space1), Text(text, style: UiTypography.footnote2b.copyWith(color: textColor)), diff --git a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/shift_order_form_sheet.dart b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/shift_order_form_sheet.dart index c7cc5f99..c05ed644 100644 --- a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/shift_order_form_sheet.dart +++ b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/shift_order_form_sheet.dart @@ -34,7 +34,7 @@ class _ShiftOrderFormSheetState extends State { late List> _positions; - final List _roles = [ + final List _roles = [ 'Server', 'Bartender', 'Cook', @@ -48,11 +48,11 @@ class _ShiftOrderFormSheetState extends State { ]; // Vendor options - final List> _vendors = [ - { + final List> _vendors = >[ + { 'id': 'v1', 'name': 'Elite Staffing', - 'rates': { + 'rates': { 'Server': 25.0, 'Bartender': 30.0, 'Cook': 28.0, @@ -63,10 +63,10 @@ class _ShiftOrderFormSheetState extends State { 'Event Staff': 19.0, }, }, - { + { 'id': 'v2', 'name': 'Premier Workforce', - 'rates': { + 'rates': { 'Server': 22.0, 'Bartender': 28.0, 'Cook': 25.0, @@ -81,7 +81,7 @@ class _ShiftOrderFormSheetState extends State { String? _selectedVendorId; - final List _lunchBreakOptions = [0, 30, 45, 60]; + final List _lunchBreakOptions = [0, 30, 45, 60]; @override void initState() { @@ -427,7 +427,7 @@ class _ShiftOrderFormSheetState extends State { style: UiTypography.body2r.textPrimary, items: _vendors .map( - (vendor) => DropdownMenuItem( + (Map vendor) => DropdownMenuItem( value: vendor['id'], child: Text(vendor['name']), ), @@ -565,7 +565,7 @@ class _ShiftOrderFormSheetState extends State { items: _roles, itemBuilder: (dynamic role) { final Map? vendor = _vendors.firstWhere( - (v) => v['id'] == _selectedVendorId, + (Map v) => v['id'] == _selectedVendorId, orElse: () => _vendors.first, ); final Map? rates = vendor?['rates'] as Map?; diff --git a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/spending_widget.dart b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/spending_widget.dart index 50e8e0ef..18ee5cd7 100644 --- a/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/spending_widget.dart +++ b/apps/mobile/packages/features/client/home/lib/src/presentation/widgets/spending_widget.dart @@ -27,11 +27,11 @@ class SpendingWidget extends StatelessWidget { @override Widget build(BuildContext context) { - final i18n = t.client_home; + final TranslationsClientHomeEn i18n = t.client_home; return Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Text( i18n.widgets.spending.toUpperCase(), style: UiTypography.footnote1b.textSecondary.copyWith( @@ -43,12 +43,12 @@ class SpendingWidget extends StatelessWidget { padding: const EdgeInsets.all(UiConstants.space3), decoration: BoxDecoration( gradient: const LinearGradient( - colors: [UiColors.primary, Color(0xFF0830B8)], + colors: [UiColors.primary, Color(0xFF0830B8)], begin: Alignment.topLeft, end: Alignment.bottomRight, ), borderRadius: UiConstants.radiusLg, - boxShadow: [ + boxShadow: [ BoxShadow( color: UiColors.primary.withValues(alpha: 0.3), blurRadius: 4, @@ -57,13 +57,13 @@ class SpendingWidget extends StatelessWidget { ], ), child: Column( - children: [ + children: [ Row( - children: [ + children: [ Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ const Text( 'This Week', style: TextStyle(color: Colors.white70, fontSize: 9), @@ -89,7 +89,7 @@ class SpendingWidget extends StatelessWidget { Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.end, - children: [ + children: [ const Text( 'Next 7 Days', style: TextStyle(color: Colors.white70, fontSize: 9), @@ -122,7 +122,7 @@ class SpendingWidget extends StatelessWidget { ), child: Row( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Container( width: 24, height: 24, @@ -142,7 +142,7 @@ class SpendingWidget extends StatelessWidget { Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Text( 'πŸ’‘ ' + i18n.dashboard.insight_lightbulb(amount: '180'), diff --git a/apps/mobile/packages/features/client/hubs/lib/client_hubs.dart b/apps/mobile/packages/features/client/hubs/lib/client_hubs.dart index 09f92652..6a427c37 100644 --- a/apps/mobile/packages/features/client/hubs/lib/client_hubs.dart +++ b/apps/mobile/packages/features/client/hubs/lib/client_hubs.dart @@ -17,7 +17,7 @@ export 'src/presentation/pages/client_hubs_page.dart'; /// A [Module] for the client hubs feature. class ClientHubsModule extends Module { @override - List get imports => [DataConnectModule()]; + List get imports => [DataConnectModule()]; @override void binds(Injector i) { diff --git a/apps/mobile/packages/features/client/hubs/lib/src/data/repositories_impl/hub_repository_impl.dart b/apps/mobile/packages/features/client/hubs/lib/src/data/repositories_impl/hub_repository_impl.dart index 3de1e29a..f231f273 100644 --- a/apps/mobile/packages/features/client/hubs/lib/src/data/repositories_impl/hub_repository_impl.dart +++ b/apps/mobile/packages/features/client/hubs/lib/src/data/repositories_impl/hub_repository_impl.dart @@ -1,4 +1,5 @@ import 'package:firebase_auth/firebase_auth.dart' as firebase; +import 'package:firebase_data_connect/src/core/ref.dart'; import 'package:krow_data_connect/krow_data_connect.dart' as dc; import 'package:krow_domain/krow_domain.dart' as domain; import '../../domain/repositories/hub_repository_interface.dart'; @@ -16,8 +17,8 @@ class HubRepositoryImpl implements HubRepositoryInterface { @override Future> getHubs() async { - final business = await _getBusinessForCurrentUser(); - final teamId = await _getOrCreateTeamId(business); + final dc.GetBusinessesByUserIdBusinesses business = await _getBusinessForCurrentUser(); + final String teamId = await _getOrCreateTeamId(business); return _fetchHubsForTeam(teamId: teamId, businessId: business.id); } @@ -26,11 +27,11 @@ class HubRepositoryImpl implements HubRepositoryInterface { required String name, required String address, }) async { - final business = await _getBusinessForCurrentUser(); - final teamId = await _getOrCreateTeamId(business); - final city = business.city; + final dc.GetBusinessesByUserIdBusinesses business = await _getBusinessForCurrentUser(); + final String teamId = await _getOrCreateTeamId(business); + final String? city = business.city; - final result = await _dataConnect + final OperationResult result = await _dataConnect .createTeamHub( teamId: teamId, hubName: name, @@ -38,17 +39,17 @@ class HubRepositoryImpl implements HubRepositoryInterface { ) .city(city?.isNotEmpty == true ? city : '') .execute(); - final createdId = result.data?.teamHub_insert.id; + final String? createdId = result.data?.teamHub_insert.id; if (createdId == null) { throw Exception('Hub creation failed.'); } - final hubs = await _fetchHubsForTeam( + final List hubs = await _fetchHubsForTeam( teamId: teamId, businessId: business.id, ); domain.Hub? createdHub; - for (final hub in hubs) { + for (final domain.Hub hub in hubs) { if (hub.id == createdId) { createdHub = hub; break; @@ -79,8 +80,8 @@ class HubRepositoryImpl implements HubRepositoryInterface { } Future _getBusinessForCurrentUser() async { - final session = dc.ClientSessionStore.instance.session; - final cachedBusiness = session?.business; + final dc.ClientSession? session = dc.ClientSessionStore.instance.session; + final dc.ClientBusinessSession? cachedBusiness = session?.business; if (cachedBusiness != null) { return dc.GetBusinessesByUserIdBusinesses( id: cachedBusiness.id, @@ -103,12 +104,12 @@ class HubRepositoryImpl implements HubRepositoryInterface { ); } - final user = _firebaseAuth.currentUser; + final firebase.User? user = _firebaseAuth.currentUser; if (user == null) { throw Exception('User is not authenticated.'); } - final result = await _dataConnect.getBusinessesByUserId( + final QueryResult result = await _dataConnect.getBusinessesByUserId( userId: user.uid, ).execute(); if (result.data.businesses.isEmpty) { @@ -116,7 +117,7 @@ class HubRepositoryImpl implements HubRepositoryInterface { throw Exception('No business found for this user. Please sign in again.'); } - final business = result.data.businesses.first; + final dc.GetBusinessesByUserIdBusinesses business = result.data.businesses.first; if (session != null) { dc.ClientSessionStore.instance.setSession( dc.ClientSession( @@ -140,14 +141,14 @@ class HubRepositoryImpl implements HubRepositoryInterface { Future _getOrCreateTeamId( dc.GetBusinessesByUserIdBusinesses business, ) async { - final teamsResult = await _dataConnect.getTeamsByOwnerId( + final QueryResult teamsResult = await _dataConnect.getTeamsByOwnerId( ownerId: business.id, ).execute(); if (teamsResult.data.teams.isNotEmpty) { return teamsResult.data.teams.first.id; } - final createTeamBuilder = _dataConnect.createTeam( + final dc.CreateTeamVariablesBuilder createTeamBuilder = _dataConnect.createTeam( teamName: '${business.businessName} Team', ownerId: business.id, ownerName: business.contactName ?? '', @@ -157,8 +158,8 @@ class HubRepositoryImpl implements HubRepositoryInterface { createTeamBuilder.email(business.email); } - final createTeamResult = await createTeamBuilder.execute(); - final teamId = createTeamResult.data?.team_insert.id; + final OperationResult createTeamResult = await createTeamBuilder.execute(); + final String? teamId = createTeamResult.data?.team_insert.id; if (teamId == null) { throw Exception('Team creation failed.'); } @@ -170,13 +171,13 @@ class HubRepositoryImpl implements HubRepositoryInterface { required String teamId, required String businessId, }) async { - final hubsResult = await _dataConnect.getTeamHubsByTeamId( + final QueryResult hubsResult = await _dataConnect.getTeamHubsByTeamId( teamId: teamId, ).execute(); return hubsResult.data.teamHubs .map( - (hub) => domain.Hub( + (dc.GetTeamHubsByTeamIdTeamHubs hub) => domain.Hub( id: hub.id, businessId: businessId, name: hub.hubName, diff --git a/apps/mobile/packages/features/client/hubs/lib/src/domain/arguments/assign_nfc_tag_arguments.dart b/apps/mobile/packages/features/client/hubs/lib/src/domain/arguments/assign_nfc_tag_arguments.dart index 250b0d2b..ded2d2fb 100644 --- a/apps/mobile/packages/features/client/hubs/lib/src/domain/arguments/assign_nfc_tag_arguments.dart +++ b/apps/mobile/packages/features/client/hubs/lib/src/domain/arguments/assign_nfc_tag_arguments.dart @@ -16,5 +16,5 @@ class AssignNfcTagArguments extends UseCaseArgument { const AssignNfcTagArguments({required this.hubId, required this.nfcTagId}); @override - List get props => [hubId, nfcTagId]; + List get props => [hubId, nfcTagId]; } diff --git a/apps/mobile/packages/features/client/hubs/lib/src/domain/arguments/create_hub_arguments.dart b/apps/mobile/packages/features/client/hubs/lib/src/domain/arguments/create_hub_arguments.dart index e24c33b2..a978f3a2 100644 --- a/apps/mobile/packages/features/client/hubs/lib/src/domain/arguments/create_hub_arguments.dart +++ b/apps/mobile/packages/features/client/hubs/lib/src/domain/arguments/create_hub_arguments.dart @@ -16,5 +16,5 @@ class CreateHubArguments extends UseCaseArgument { const CreateHubArguments({required this.name, required this.address}); @override - List get props => [name, address]; + List get props => [name, address]; } diff --git a/apps/mobile/packages/features/client/hubs/lib/src/domain/arguments/delete_hub_arguments.dart b/apps/mobile/packages/features/client/hubs/lib/src/domain/arguments/delete_hub_arguments.dart index 5ed5b9af..6a08630d 100644 --- a/apps/mobile/packages/features/client/hubs/lib/src/domain/arguments/delete_hub_arguments.dart +++ b/apps/mobile/packages/features/client/hubs/lib/src/domain/arguments/delete_hub_arguments.dart @@ -13,5 +13,5 @@ class DeleteHubArguments extends UseCaseArgument { const DeleteHubArguments({required this.hubId}); @override - List get props => [hubId]; + List get props => [hubId]; } diff --git a/apps/mobile/packages/features/client/hubs/lib/src/presentation/blocs/client_hubs_bloc.dart b/apps/mobile/packages/features/client/hubs/lib/src/presentation/blocs/client_hubs_bloc.dart index 57366632..0d0b9379 100644 --- a/apps/mobile/packages/features/client/hubs/lib/src/presentation/blocs/client_hubs_bloc.dart +++ b/apps/mobile/packages/features/client/hubs/lib/src/presentation/blocs/client_hubs_bloc.dart @@ -1,5 +1,6 @@ import 'package:bloc/bloc.dart'; import 'package:flutter_modular/flutter_modular.dart'; +import 'package:krow_domain/src/entities/business/hub.dart'; import '../../domain/arguments/assign_nfc_tag_arguments.dart'; import '../../domain/arguments/create_hub_arguments.dart'; import '../../domain/arguments/delete_hub_arguments.dart'; @@ -64,7 +65,7 @@ class ClientHubsBloc extends Bloc ) async { emit(state.copyWith(status: ClientHubsStatus.loading)); try { - final hubs = await _getHubsUseCase(); + final List hubs = await _getHubsUseCase(); emit(state.copyWith(status: ClientHubsStatus.success, hubs: hubs)); } catch (e) { emit( @@ -85,7 +86,7 @@ class ClientHubsBloc extends Bloc await _createHubUseCase( CreateHubArguments(name: event.name, address: event.address), ); - final hubs = await _getHubsUseCase(); + final List hubs = await _getHubsUseCase(); emit( state.copyWith( status: ClientHubsStatus.actionSuccess, @@ -111,7 +112,7 @@ class ClientHubsBloc extends Bloc emit(state.copyWith(status: ClientHubsStatus.actionInProgress)); try { await _deleteHubUseCase(DeleteHubArguments(hubId: event.hubId)); - final hubs = await _getHubsUseCase(); + final List hubs = await _getHubsUseCase(); emit( state.copyWith( status: ClientHubsStatus.actionSuccess, @@ -138,7 +139,7 @@ class ClientHubsBloc extends Bloc await _assignNfcTagUseCase( AssignNfcTagArguments(hubId: event.hubId, nfcTagId: event.nfcTagId), ); - final hubs = await _getHubsUseCase(); + final List hubs = await _getHubsUseCase(); emit( state.copyWith( status: ClientHubsStatus.actionSuccess, diff --git a/apps/mobile/packages/features/client/hubs/lib/src/presentation/blocs/client_hubs_event.dart b/apps/mobile/packages/features/client/hubs/lib/src/presentation/blocs/client_hubs_event.dart index bc3cdc79..a42a4843 100644 --- a/apps/mobile/packages/features/client/hubs/lib/src/presentation/blocs/client_hubs_event.dart +++ b/apps/mobile/packages/features/client/hubs/lib/src/presentation/blocs/client_hubs_event.dart @@ -6,7 +6,7 @@ abstract class ClientHubsEvent extends Equatable { const ClientHubsEvent(); @override - List get props => []; + List get props => []; } /// Event triggered to fetch the list of hubs. @@ -22,7 +22,7 @@ class ClientHubsAddRequested extends ClientHubsEvent { const ClientHubsAddRequested({required this.name, required this.address}); @override - List get props => [name, address]; + List get props => [name, address]; } /// Event triggered to delete a hub. @@ -32,7 +32,7 @@ class ClientHubsDeleteRequested extends ClientHubsEvent { const ClientHubsDeleteRequested(this.hubId); @override - List get props => [hubId]; + List get props => [hubId]; } /// Event triggered to assign an NFC tag to a hub. @@ -46,7 +46,7 @@ class ClientHubsNfcTagAssignRequested extends ClientHubsEvent { }); @override - List get props => [hubId, nfcTagId]; + List get props => [hubId, nfcTagId]; } /// Event triggered to clear any error or success messages. @@ -61,7 +61,7 @@ class ClientHubsAddDialogToggled extends ClientHubsEvent { const ClientHubsAddDialogToggled({required this.visible}); @override - List get props => [visible]; + List get props => [visible]; } /// Event triggered to toggle the visibility of the "Identify NFC" dialog. @@ -71,5 +71,5 @@ class ClientHubsIdentifyDialogToggled extends ClientHubsEvent { const ClientHubsIdentifyDialogToggled({this.hub}); @override - List get props => [hub]; + List get props => [hub]; } diff --git a/apps/mobile/packages/features/client/hubs/lib/src/presentation/blocs/client_hubs_state.dart b/apps/mobile/packages/features/client/hubs/lib/src/presentation/blocs/client_hubs_state.dart index cc037f57..efccca99 100644 --- a/apps/mobile/packages/features/client/hubs/lib/src/presentation/blocs/client_hubs_state.dart +++ b/apps/mobile/packages/features/client/hubs/lib/src/presentation/blocs/client_hubs_state.dart @@ -28,7 +28,7 @@ class ClientHubsState extends Equatable { const ClientHubsState({ this.status = ClientHubsStatus.initial, - this.hubs = const [], + this.hubs = const [], this.errorMessage, this.successMessage, this.showAddHubDialog = false, @@ -57,7 +57,7 @@ class ClientHubsState extends Equatable { } @override - List get props => [ + List get props => [ status, hubs, errorMessage, diff --git a/apps/mobile/packages/features/client/hubs/lib/src/presentation/pages/client_hubs_page.dart b/apps/mobile/packages/features/client/hubs/lib/src/presentation/pages/client_hubs_page.dart index 29cdfd63..096a39c6 100644 --- a/apps/mobile/packages/features/client/hubs/lib/src/presentation/pages/client_hubs_page.dart +++ b/apps/mobile/packages/features/client/hubs/lib/src/presentation/pages/client_hubs_page.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_modular/flutter_modular.dart'; import 'package:core_localization/core_localization.dart'; +import 'package:krow_domain/src/entities/business/hub.dart'; import '../blocs/client_hubs_bloc.dart'; import '../blocs/client_hubs_event.dart'; import '../blocs/client_hubs_state.dart'; @@ -23,10 +24,10 @@ class ClientHubsPage extends StatelessWidget { @override Widget build(BuildContext context) { return BlocProvider( - create: (context) => + create: (BuildContext context) => Modular.get()..add(const ClientHubsFetched()), child: BlocConsumer( - listener: (context, state) { + listener: (BuildContext context, ClientHubsState state) { if (state.errorMessage != null) { ScaffoldMessenger.of( context, @@ -44,7 +45,7 @@ class ClientHubsPage extends StatelessWidget { ).add(const ClientHubsMessageCleared()); } }, - builder: (context, state) { + builder: (BuildContext context, ClientHubsState state) { return Scaffold( backgroundColor: UiColors.bgMenu, floatingActionButton: FloatingActionButton( @@ -67,7 +68,7 @@ class ClientHubsPage extends StatelessWidget { vertical: UiConstants.space5, ).copyWith(bottom: 100), sliver: SliverList( - delegate: SliverChildListDelegate([ + delegate: SliverChildListDelegate([ if (state.status == ClientHubsStatus.loading) const Center(child: CircularProgressIndicator()) else if (state.hubs.isEmpty) @@ -79,9 +80,9 @@ class ClientHubsPage extends StatelessWidget { ), ), ) - else ...[ + else ...[ ...state.hubs.map( - (hub) => HubCard( + (Hub hub) => HubCard( hub: hub, onNfcPressed: () => BlocProvider.of( @@ -105,7 +106,7 @@ class ClientHubsPage extends StatelessWidget { ), if (state.showAddHubDialog) AddHubDialog( - onCreate: (name, address) { + onCreate: (String name, String address) { BlocProvider.of(context).add( ClientHubsAddRequested(name: name, address: address), ); @@ -117,7 +118,7 @@ class ClientHubsPage extends StatelessWidget { if (state.hubToIdentify != null) IdentifyNfcDialog( hub: state.hubToIdentify!, - onAssign: (tagId) { + onAssign: (String tagId) { BlocProvider.of(context).add( ClientHubsNfcTagAssignRequested( hubId: state.hubToIdentify!.id, @@ -159,7 +160,7 @@ class ClientHubsPage extends StatelessWidget { ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ GestureDetector( onTap: () => Modular.to.pop(), child: Container( diff --git a/apps/mobile/packages/features/client/hubs/lib/src/presentation/widgets/add_hub_dialog.dart b/apps/mobile/packages/features/client/hubs/lib/src/presentation/widgets/add_hub_dialog.dart index 478cd1ba..2a4dd8e9 100644 --- a/apps/mobile/packages/features/client/hubs/lib/src/presentation/widgets/add_hub_dialog.dart +++ b/apps/mobile/packages/features/client/hubs/lib/src/presentation/widgets/add_hub_dialog.dart @@ -51,14 +51,14 @@ class _AddHubDialogState extends State { decoration: BoxDecoration( color: UiColors.bgPopup, borderRadius: BorderRadius.circular(UiConstants.radiusBase), - boxShadow: const [ + boxShadow: const [ BoxShadow(color: UiColors.popupShadow, blurRadius: 20), ], ), child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ + children: [ Text( t.client_hubs.add_hub_dialog.title, style: UiTypography.headline3m.textPrimary, @@ -83,7 +83,7 @@ class _AddHubDialogState extends State { ), const SizedBox(height: UiConstants.space8), Row( - children: [ + children: [ Expanded( child: UiButton.secondary( onPressed: widget.onCancel, diff --git a/apps/mobile/packages/features/client/hubs/lib/src/presentation/widgets/hub_card.dart b/apps/mobile/packages/features/client/hubs/lib/src/presentation/widgets/hub_card.dart index 71812723..446620e6 100644 --- a/apps/mobile/packages/features/client/hubs/lib/src/presentation/widgets/hub_card.dart +++ b/apps/mobile/packages/features/client/hubs/lib/src/presentation/widgets/hub_card.dart @@ -31,7 +31,7 @@ class HubCard extends StatelessWidget { decoration: BoxDecoration( color: UiColors.white, borderRadius: BorderRadius.circular(UiConstants.radiusBase), - boxShadow: const [ + boxShadow: const [ BoxShadow( color: UiColors.popupShadow, blurRadius: 10, @@ -42,7 +42,7 @@ class HubCard extends StatelessWidget { child: Padding( padding: const EdgeInsets.all(UiConstants.space4), child: Row( - children: [ + children: [ Container( width: 52, height: 52, @@ -60,13 +60,13 @@ class HubCard extends StatelessWidget { Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Text(hub.name, style: UiTypography.body1b.textPrimary), if (hub.address.isNotEmpty) Padding( padding: const EdgeInsets.only(top: UiConstants.space1), child: Row( - children: [ + children: [ const Icon( UiIcons.mapPin, size: 12, @@ -99,7 +99,7 @@ class HubCard extends StatelessWidget { ), ), Row( - children: [ + children: [ IconButton( onPressed: onDeletePressed, icon: const Icon( diff --git a/apps/mobile/packages/features/client/hubs/lib/src/presentation/widgets/hub_empty_state.dart b/apps/mobile/packages/features/client/hubs/lib/src/presentation/widgets/hub_empty_state.dart index 252e4cb7..e9b7f8c3 100644 --- a/apps/mobile/packages/features/client/hubs/lib/src/presentation/widgets/hub_empty_state.dart +++ b/apps/mobile/packages/features/client/hubs/lib/src/presentation/widgets/hub_empty_state.dart @@ -17,7 +17,7 @@ class HubEmptyState extends StatelessWidget { decoration: BoxDecoration( color: UiColors.bgBanner, borderRadius: BorderRadius.circular(UiConstants.radiusBase), - boxShadow: const [ + boxShadow: const [ BoxShadow( color: UiColors.popupShadow, blurRadius: 10, @@ -26,7 +26,7 @@ class HubEmptyState extends StatelessWidget { ], ), child: Column( - children: [ + children: [ Container( width: 64, height: 64, diff --git a/apps/mobile/packages/features/client/hubs/lib/src/presentation/widgets/hub_info_card.dart b/apps/mobile/packages/features/client/hubs/lib/src/presentation/widgets/hub_info_card.dart index a7357944..013e533c 100644 --- a/apps/mobile/packages/features/client/hubs/lib/src/presentation/widgets/hub_info_card.dart +++ b/apps/mobile/packages/features/client/hubs/lib/src/presentation/widgets/hub_info_card.dart @@ -17,13 +17,13 @@ class HubInfoCard extends StatelessWidget { ), child: Row( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ const Icon(UiIcons.nfc, size: 20, color: UiColors.primary), const SizedBox(width: UiConstants.space3), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Text( t.client_hubs.about_hubs.title, style: UiTypography.body2b.textPrimary, diff --git a/apps/mobile/packages/features/client/hubs/lib/src/presentation/widgets/identify_nfc_dialog.dart b/apps/mobile/packages/features/client/hubs/lib/src/presentation/widgets/identify_nfc_dialog.dart index 823ba768..df815a6c 100644 --- a/apps/mobile/packages/features/client/hubs/lib/src/presentation/widgets/identify_nfc_dialog.dart +++ b/apps/mobile/packages/features/client/hubs/lib/src/presentation/widgets/identify_nfc_dialog.dart @@ -48,13 +48,13 @@ class _IdentifyNfcDialogState extends State { decoration: BoxDecoration( color: UiColors.bgPopup, borderRadius: BorderRadius.circular(UiConstants.radiusBase), - boxShadow: const [ + boxShadow: const [ BoxShadow(color: UiColors.popupShadow, blurRadius: 20), ], ), child: Column( mainAxisSize: MainAxisSize.min, - children: [ + children: [ Text( t.client_hubs.nfc_dialog.title, style: UiTypography.headline3m.textPrimary, @@ -87,7 +87,7 @@ class _IdentifyNfcDialogState extends State { text: t.client_hubs.nfc_dialog.scan_button, leadingIcon: UiIcons.nfc, ), - if (_nfcTagId != null) ...[ + if (_nfcTagId != null) ...[ const SizedBox(height: UiConstants.space6), Container( padding: const EdgeInsets.all(UiConstants.space4), @@ -98,10 +98,10 @@ class _IdentifyNfcDialogState extends State { ), ), child: Column( - children: [ + children: [ Row( mainAxisSize: MainAxisSize.min, - children: [ + children: [ const Icon( UiIcons.success, size: 20, @@ -141,7 +141,7 @@ class _IdentifyNfcDialogState extends State { ], const SizedBox(height: UiConstants.space8), Row( - children: [ + children: [ Expanded( child: UiButton.secondary( onPressed: widget.onCancel, diff --git a/apps/mobile/packages/features/client/settings/lib/client_settings.dart b/apps/mobile/packages/features/client/settings/lib/client_settings.dart index aff02a92..d5506dc9 100644 --- a/apps/mobile/packages/features/client/settings/lib/client_settings.dart +++ b/apps/mobile/packages/features/client/settings/lib/client_settings.dart @@ -25,7 +25,7 @@ class ClientSettingsModule extends Module { } @override - void routes(r) { + void routes(RouteManager r) { r.child('/', child: (_) => const ClientSettingsPage()); } } diff --git a/apps/mobile/packages/features/client/settings/lib/src/presentation/blocs/client_settings_event.dart b/apps/mobile/packages/features/client/settings/lib/src/presentation/blocs/client_settings_event.dart index c32f8ad3..8eb6c424 100644 --- a/apps/mobile/packages/features/client/settings/lib/src/presentation/blocs/client_settings_event.dart +++ b/apps/mobile/packages/features/client/settings/lib/src/presentation/blocs/client_settings_event.dart @@ -4,7 +4,7 @@ abstract class ClientSettingsEvent extends Equatable { const ClientSettingsEvent(); @override - List get props => []; + List get props => []; } class ClientSettingsSignOutRequested extends ClientSettingsEvent { diff --git a/apps/mobile/packages/features/client/settings/lib/src/presentation/blocs/client_settings_state.dart b/apps/mobile/packages/features/client/settings/lib/src/presentation/blocs/client_settings_state.dart index 5588fa0a..c83bb91f 100644 --- a/apps/mobile/packages/features/client/settings/lib/src/presentation/blocs/client_settings_state.dart +++ b/apps/mobile/packages/features/client/settings/lib/src/presentation/blocs/client_settings_state.dart @@ -4,7 +4,7 @@ abstract class ClientSettingsState extends Equatable { const ClientSettingsState(); @override - List get props => []; + List get props => []; } class ClientSettingsInitial extends ClientSettingsState { @@ -25,5 +25,5 @@ class ClientSettingsError extends ClientSettingsState { const ClientSettingsError(this.message); @override - List get props => [message]; + List get props => [message]; } diff --git a/apps/mobile/packages/features/client/settings/lib/src/presentation/widgets/client_settings_page/settings_profile_header.dart b/apps/mobile/packages/features/client/settings/lib/src/presentation/widgets/client_settings_page/settings_profile_header.dart index 9f795f35..fc05ccf6 100644 --- a/apps/mobile/packages/features/client/settings/lib/src/presentation/widgets/client_settings_page/settings_profile_header.dart +++ b/apps/mobile/packages/features/client/settings/lib/src/presentation/widgets/client_settings_page/settings_profile_header.dart @@ -12,13 +12,13 @@ class SettingsProfileHeader extends StatelessWidget { @override /// Builds the profile header UI. Widget build(BuildContext context) { - final labels = t.client_settings.profile; - final session = dc.ClientSessionStore.instance.session; - final businessName = + final TranslationsClientSettingsProfileEn labels = t.client_settings.profile; + final dc.ClientSession? session = dc.ClientSessionStore.instance.session; + final String businessName = session?.business?.businessName ?? 'Your Company'; - final email = session?.user.email ?? 'client@example.com'; - final photoUrl = session?.userPhotoUrl; - final avatarLetter = businessName.trim().isNotEmpty + final String email = session?.user.email ?? 'client@example.com'; + final String? photoUrl = session?.userPhotoUrl; + final String avatarLetter = businessName.trim().isNotEmpty ? businessName.trim()[0].toUpperCase() : 'C'; @@ -40,7 +40,7 @@ class SettingsProfileHeader extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.start, spacing: UiConstants.space4, - children: [ + children: [ Container( width: 64, height: 64, @@ -69,13 +69,13 @@ class SettingsProfileHeader extends StatelessWidget { Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, - children: [ + children: [ Text(businessName, style: UiTypography.body1b.textPrimary), const SizedBox(height: UiConstants.space1), Row( mainAxisAlignment: MainAxisAlignment.start, spacing: UiConstants.space1, - children: [ + children: [ Icon( UiIcons.mail, size: 14, diff --git a/apps/mobile/packages/features/client/settings/lib/src/presentation/widgets/client_settings_page/settings_quick_links.dart b/apps/mobile/packages/features/client/settings/lib/src/presentation/widgets/client_settings_page/settings_quick_links.dart index 036380e0..ea0bf9cc 100644 --- a/apps/mobile/packages/features/client/settings/lib/src/presentation/widgets/client_settings_page/settings_quick_links.dart +++ b/apps/mobile/packages/features/client/settings/lib/src/presentation/widgets/client_settings_page/settings_quick_links.dart @@ -12,7 +12,7 @@ class SettingsQuickLinks extends StatelessWidget { @override /// Builds the quick links UI. Widget build(BuildContext context) { - final labels = t.client_settings.profile; + final TranslationsClientSettingsProfileEn labels = t.client_settings.profile; return SliverPadding( padding: const EdgeInsets.all(UiConstants.space5), @@ -28,7 +28,7 @@ class SettingsQuickLinks extends StatelessWidget { padding: const EdgeInsets.all(UiConstants.space4), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Text( labels.quick_links, style: UiTypography.footnote1b.textPrimary, @@ -85,9 +85,9 @@ class _QuickLinkItem extends StatelessWidget { ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ + children: [ Row( - children: [ + children: [ Icon(icon, size: 20, color: UiColors.iconSecondary), const SizedBox(width: UiConstants.space3), Text(title, style: UiTypography.footnote1m.textPrimary), diff --git a/apps/mobile/packages/features/client/view_orders/lib/src/data/repositories/view_orders_repository_impl.dart b/apps/mobile/packages/features/client/view_orders/lib/src/data/repositories/view_orders_repository_impl.dart index b9b2ccb5..34dbe02b 100644 --- a/apps/mobile/packages/features/client/view_orders/lib/src/data/repositories/view_orders_repository_impl.dart +++ b/apps/mobile/packages/features/client/view_orders/lib/src/data/repositories/view_orders_repository_impl.dart @@ -21,15 +21,15 @@ class ViewOrdersRepositoryImpl implements IViewOrdersRepository { required DateTime start, required DateTime end, }) async { - final businessId = dc.ClientSessionStore.instance.session?.business?.id; + final String? businessId = dc.ClientSessionStore.instance.session?.business?.id; if (businessId == null || businessId.isEmpty) { await _firebaseAuth.signOut(); throw Exception('Business is missing. Please sign in again.'); } - final startTimestamp = _toTimestamp(_startOfDay(start)); - final endTimestamp = _toTimestamp(_endOfDay(end)); - final result = await _dataConnect + final fdc.Timestamp startTimestamp = _toTimestamp(_startOfDay(start)); + final fdc.Timestamp endTimestamp = _toTimestamp(_endOfDay(end)); + final fdc.QueryResult result = await _dataConnect .listShiftRolesByBusinessAndDateRange( businessId: businessId, start: startTimestamp, @@ -37,28 +37,28 @@ class ViewOrdersRepositoryImpl implements IViewOrdersRepository { ) .execute(); - final businessName = + final String businessName = dc.ClientSessionStore.instance.session?.business?.businessName ?? 'Your Company'; - return result.data.shiftRoles.map((shiftRole) { + return result.data.shiftRoles.map((dc.ListShiftRolesByBusinessAndDateRangeShiftRoles shiftRole) { print( 'ViewOrders shiftRole: shiftId=${shiftRole.shiftId} roleId=${shiftRole.roleId} ' 'startTime=${shiftRole.startTime?.toJson()} endTime=${shiftRole.endTime?.toJson()} ' 'hours=${shiftRole.hours} totalValue=${shiftRole.totalValue}', ); - final shiftDate = shiftRole.shift.date?.toDateTime(); - final dateStr = shiftDate == null + final DateTime? shiftDate = shiftRole.shift.date?.toDateTime(); + final String dateStr = shiftDate == null ? '' : DateFormat('yyyy-MM-dd').format(shiftDate); - final startTime = _formatTime(shiftRole.startTime); - final endTime = _formatTime(shiftRole.endTime); - final filled = shiftRole.assigned ?? 0; - final workersNeeded = shiftRole.count; - final hours = shiftRole.hours ?? 0; - final totalValue = shiftRole.totalValue ?? 0; - final hourlyRate = _hourlyRate(shiftRole.totalValue, shiftRole.hours); - final status = filled >= workersNeeded ? 'filled' : 'open'; + final String startTime = _formatTime(shiftRole.startTime); + final String endTime = _formatTime(shiftRole.endTime); + final int filled = shiftRole.assigned ?? 0; + final int workersNeeded = shiftRole.count; + final double hours = shiftRole.hours ?? 0; + final double totalValue = shiftRole.totalValue ?? 0; + final double hourlyRate = _hourlyRate(shiftRole.totalValue, shiftRole.hours); + final String status = filled >= workersNeeded ? 'filled' : 'open'; return domain.OrderItem( id: _shiftRoleKey(shiftRole.shiftId, shiftRole.roleId), @@ -84,15 +84,15 @@ class ViewOrdersRepositoryImpl implements IViewOrdersRepository { Future>>> getAcceptedApplicationsForDay( DateTime day, ) async { - final businessId = dc.ClientSessionStore.instance.session?.business?.id; + final String? businessId = dc.ClientSessionStore.instance.session?.business?.id; if (businessId == null || businessId.isEmpty) { await _firebaseAuth.signOut(); throw Exception('Business is missing. Please sign in again.'); } - final dayStart = _toTimestamp(_startOfDay(day)); - final dayEnd = _toTimestamp(_endOfDay(day)); - final result = await _dataConnect + final fdc.Timestamp dayStart = _toTimestamp(_startOfDay(day)); + final fdc.Timestamp dayEnd = _toTimestamp(_endOfDay(day)); + final fdc.QueryResult result = await _dataConnect .listAcceptedApplicationsByBusinessForDay( businessId: businessId, dayStart: dayStart, @@ -100,13 +100,13 @@ class ViewOrdersRepositoryImpl implements IViewOrdersRepository { ) .execute(); - final Map>> grouped = {}; - for (final application in result.data.applications) { + final Map>> grouped = >>{}; + for (final dc.ListAcceptedApplicationsByBusinessForDayApplications application in result.data.applications) { print( 'ViewOrders app: shiftId=${application.shiftId} roleId=${application.roleId} ' 'checkIn=${application.checkInTime?.toJson()} checkOut=${application.checkOutTime?.toJson()}', ); - final key = _shiftRoleKey(application.shiftId, application.roleId); + final String key = _shiftRoleKey(application.shiftId, application.roleId); grouped.putIfAbsent(key, () => >[]); grouped[key]!.add({ 'id': application.id, @@ -124,9 +124,9 @@ class ViewOrdersRepositoryImpl implements IViewOrdersRepository { } fdc.Timestamp _toTimestamp(DateTime dateTime) { - final utc = dateTime.toUtc(); - final seconds = utc.millisecondsSinceEpoch ~/ 1000; - final nanoseconds = (utc.microsecondsSinceEpoch % 1000000) * 1000; + final DateTime utc = dateTime.toUtc(); + final int seconds = utc.millisecondsSinceEpoch ~/ 1000; + final int nanoseconds = (utc.microsecondsSinceEpoch % 1000000) * 1000; return fdc.Timestamp(nanoseconds, seconds); } @@ -142,7 +142,7 @@ class ViewOrdersRepositoryImpl implements IViewOrdersRepository { if (timestamp == null) { return ''; } - final dateTime = timestamp.toDateTime(); + final DateTime dateTime = timestamp.toDateTime(); return DateFormat('HH:mm').format(dateTime); } diff --git a/apps/mobile/packages/features/client/view_orders/lib/src/presentation/blocs/view_orders_cubit.dart b/apps/mobile/packages/features/client/view_orders/lib/src/presentation/blocs/view_orders_cubit.dart index 3845b99d..0e3bef8d 100644 --- a/apps/mobile/packages/features/client/view_orders/lib/src/presentation/blocs/view_orders_cubit.dart +++ b/apps/mobile/packages/features/client/view_orders/lib/src/presentation/blocs/view_orders_cubit.dart @@ -38,7 +38,7 @@ class ViewOrdersCubit extends Cubit { final List orders = await _getOrdersUseCase( OrdersRangeArguments(start: rangeStart, end: rangeEnd), ); - final apps = await _getAcceptedAppsUseCase( + final Map>> apps = await _getAcceptedAppsUseCase( OrdersDayArguments(day: dayForApps), ); final List updatedOrders = _applyApplications(orders, apps); @@ -70,7 +70,7 @@ class ViewOrdersCubit extends Cubit { final DateTime? selectedDate = state.selectedDate; final DateTime updatedSelectedDate = selectedDate != null && - calendarDays.any((day) => _isSameDay(day, selectedDate)) + calendarDays.any((DateTime day) => _isSameDay(day, selectedDate)) ? selectedDate : calendarDays.first; emit( @@ -106,7 +106,7 @@ class ViewOrdersCubit extends Cubit { Future _refreshAcceptedApplications(DateTime day) async { try { - final apps = await _getAcceptedAppsUseCase( + final Map>> apps = await _getAcceptedAppsUseCase( OrdersDayArguments(day: day), ); final List updatedOrders = @@ -122,14 +122,14 @@ class ViewOrdersCubit extends Cubit { List orders, Map>> apps, ) { - return orders.map((order) { - final confirmed = apps[order.id] ?? const >[]; + return orders.map((OrderItem order) { + final List> confirmed = apps[order.id] ?? const >[]; if (confirmed.isEmpty) { return order; } - final filled = confirmed.length; - final status = + final int filled = confirmed.length; + final String status = filled >= order.workersNeeded ? 'filled' : order.status; return OrderItem( id: order.id, diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/data/repositories_impl/auth_repository_impl.dart b/apps/mobile/packages/features/staff/authentication/lib/src/data/repositories_impl/auth_repository_impl.dart index a399956d..0f2d95f4 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/data/repositories_impl/auth_repository_impl.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/data/repositories_impl/auth_repository_impl.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:firebase_auth/firebase_auth.dart' as firebase; +import 'package:firebase_data_connect/src/core/ref.dart'; import 'package:krow_data_connect/krow_data_connect.dart' as dc; import 'package:krow_domain/krow_domain.dart' as domain; import '../../domain/repositories/auth_repository_interface.dart'; @@ -19,7 +20,7 @@ class AuthRepositoryImpl implements AuthRepositoryInterface { @override Stream get currentUser => _firebaseAuth .authStateChanges() - .map((firebaseUser) { + .map((firebase.User? firebaseUser) { if (firebaseUser == null) { return null; } @@ -35,24 +36,24 @@ class AuthRepositoryImpl implements AuthRepositoryInterface { /// Signs in with a phone number and returns a verification ID. @override Future signInWithPhone({required String phoneNumber}) async { - final completer = Completer(); + final Completer completer = Completer(); await _firebaseAuth.verifyPhoneNumber( phoneNumber: phoneNumber, verificationCompleted: (_) {}, - verificationFailed: (e) { + verificationFailed: (firebase.FirebaseAuthException e) { if (!completer.isCompleted) { completer.completeError( Exception(e.message ?? 'Phone verification failed.'), ); } }, - codeSent: (verificationId, _) { + codeSent: (String verificationId, _) { if (!completer.isCompleted) { completer.complete(verificationId); } }, - codeAutoRetrievalTimeout: (verificationId) { + codeAutoRetrievalTimeout: (String verificationId) { if (!completer.isCompleted) { completer.complete(verificationId); } @@ -74,20 +75,20 @@ class AuthRepositoryImpl implements AuthRepositoryInterface { required String verificationId, required String smsCode, }) async { - final credential = firebase.PhoneAuthProvider.credential( + final firebase.PhoneAuthCredential credential = firebase.PhoneAuthProvider.credential( verificationId: verificationId, smsCode: smsCode, ); - final userCredential = await _firebaseAuth.signInWithCredential(credential); - final firebaseUser = userCredential.user; + final firebase.UserCredential userCredential = await _firebaseAuth.signInWithCredential(credential); + final firebase.User? firebaseUser = userCredential.user; if (firebaseUser == null) { throw Exception('Phone verification failed, no Firebase user received.'); } - final response = await _dataConnect.getUserById( + final QueryResult response = await _dataConnect.getUserById( id: firebaseUser.uid, ).execute(); - final user = response.data?.user; + final dc.GetUserByIdUser? user = response.data?.user; if (user == null) { await _firebaseAuth.signOut(); throw Exception('Authenticated user profile not found in database.'); @@ -97,7 +98,7 @@ class AuthRepositoryImpl implements AuthRepositoryInterface { throw Exception('User is not authorized for this app.'); } - final email = user.email ?? ''; + final String email = user.email ?? ''; if (email.isEmpty) { await _firebaseAuth.signOut(); throw Exception('User email is missing in profile data.'); diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/domain/arguments/sign_in_with_phone_arguments.dart b/apps/mobile/packages/features/staff/authentication/lib/src/domain/arguments/sign_in_with_phone_arguments.dart index 08d95047..2811adb5 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/domain/arguments/sign_in_with_phone_arguments.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/domain/arguments/sign_in_with_phone_arguments.dart @@ -13,5 +13,5 @@ class SignInWithPhoneArguments extends UseCaseArgument { const SignInWithPhoneArguments({required this.phoneNumber}); @override - List get props => [phoneNumber]; + List get props => [phoneNumber]; } diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/domain/arguments/verify_otp_arguments.dart b/apps/mobile/packages/features/staff/authentication/lib/src/domain/arguments/verify_otp_arguments.dart index b5797126..74053d31 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/domain/arguments/verify_otp_arguments.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/domain/arguments/verify_otp_arguments.dart @@ -20,5 +20,5 @@ class VerifyOtpArguments extends UseCaseArgument { }); @override - List get props => [verificationId, smsCode]; + List get props => [verificationId, smsCode]; } diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/blocs/auth_event.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/blocs/auth_event.dart index ad47bfc6..2b0c3f65 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/blocs/auth_event.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/blocs/auth_event.dart @@ -5,7 +5,7 @@ import 'package:staff_authentication/src/domain/ui_entities/auth_mode.dart'; abstract class AuthEvent extends Equatable { const AuthEvent(); @override - List get props => []; + List get props => []; } /// Event for requesting a sign-in with a phone number. @@ -19,7 +19,7 @@ class AuthSignInRequested extends AuthEvent { const AuthSignInRequested({this.phoneNumber, required this.mode}); @override - List get props => [mode]; + List get props => [mode]; } /// Event for submitting an OTP (One-Time Password) for verification. @@ -36,7 +36,7 @@ class AuthOtpSubmitted extends AuthEvent { const AuthOtpSubmitted({required this.verificationId, required this.smsCode}); @override - List get props => [verificationId, smsCode]; + List get props => [verificationId, smsCode]; } /// Event for clearing any authentication error in the state. @@ -50,7 +50,7 @@ class AuthOtpUpdated extends AuthEvent { const AuthOtpUpdated(this.otp); @override - List get props => [otp]; + List get props => [otp]; } /// Event for updating the current draft phone number in the state. @@ -61,5 +61,5 @@ class AuthPhoneUpdated extends AuthEvent { const AuthPhoneUpdated(this.phoneNumber); @override - List get props => [phoneNumber]; + List get props => [phoneNumber]; } diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/blocs/auth_state.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/blocs/auth_state.dart index 8e6248ba..edcbfe3a 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/blocs/auth_state.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/blocs/auth_state.dart @@ -54,7 +54,7 @@ class AuthState extends Equatable { }); @override - List get props => [ + List get props => [ status, verificationId, mode, diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/blocs/profile_setup/profile_setup_event.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/blocs/profile_setup/profile_setup_event.dart index 59acfa1b..39fac246 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/blocs/profile_setup/profile_setup_event.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/blocs/profile_setup/profile_setup_event.dart @@ -5,7 +5,7 @@ abstract class ProfileSetupEvent extends Equatable { const ProfileSetupEvent(); @override - List get props => []; + List get props => []; } /// Event triggered when the full name changes. @@ -17,7 +17,7 @@ class ProfileSetupFullNameChanged extends ProfileSetupEvent { const ProfileSetupFullNameChanged(this.fullName); @override - List get props => [fullName]; + List get props => [fullName]; } /// Event triggered when the bio changes. @@ -29,7 +29,7 @@ class ProfileSetupBioChanged extends ProfileSetupEvent { const ProfileSetupBioChanged(this.bio); @override - List get props => [bio]; + List get props => [bio]; } /// Event triggered when the preferred locations change. @@ -41,7 +41,7 @@ class ProfileSetupLocationsChanged extends ProfileSetupEvent { const ProfileSetupLocationsChanged(this.locations); @override - List get props => [locations]; + List get props => [locations]; } /// Event triggered when the max distance changes. @@ -53,7 +53,7 @@ class ProfileSetupDistanceChanged extends ProfileSetupEvent { const ProfileSetupDistanceChanged(this.distance); @override - List get props => [distance]; + List get props => [distance]; } /// Event triggered when the skills change. @@ -65,7 +65,7 @@ class ProfileSetupSkillsChanged extends ProfileSetupEvent { const ProfileSetupSkillsChanged(this.skills); @override - List get props => [skills]; + List get props => [skills]; } /// Event triggered when the industries change. @@ -77,7 +77,7 @@ class ProfileSetupIndustriesChanged extends ProfileSetupEvent { const ProfileSetupIndustriesChanged(this.industries); @override - List get props => [industries]; + List get props => [industries]; } /// Event triggered when the profile submission is requested. diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/blocs/profile_setup/profile_setup_state.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/blocs/profile_setup/profile_setup_state.dart index bcfc7832..2406d5c8 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/blocs/profile_setup/profile_setup_state.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/blocs/profile_setup/profile_setup_state.dart @@ -33,10 +33,10 @@ class ProfileSetupState extends Equatable { const ProfileSetupState({ this.fullName = '', this.bio = '', - this.preferredLocations = const [], + this.preferredLocations = const [], this.maxDistanceMiles = 25, - this.skills = const [], - this.industries = const [], + this.skills = const [], + this.industries = const [], this.status = ProfileSetupStatus.initial, this.errorMessage, }); @@ -65,7 +65,7 @@ class ProfileSetupState extends Equatable { } @override - List get props => [ + List get props => [ fullName, bio, preferredLocations, diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/navigation/auth_navigator.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/navigation/auth_navigator.dart index 66cfd92a..e2a87fbe 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/navigation/auth_navigator.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/navigation/auth_navigator.dart @@ -6,7 +6,7 @@ import '../../domain/ui_entities/auth_mode.dart'; extension AuthNavigator on IModularNavigator { /// Navigates to the phone verification page. void pushPhoneVerification(AuthMode mode) { - pushNamed('./phone-verification', arguments: {'mode': mode.name}); + pushNamed('./phone-verification', arguments: {'mode': mode.name}); } /// Navigates to the profile setup page, replacing the current route. diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/pages/get_started_page.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/pages/get_started_page.dart index 9132ab92..f1ef9619 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/pages/get_started_page.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/pages/get_started_page.dart @@ -30,7 +30,7 @@ class GetStartedPage extends StatelessWidget { return Scaffold( body: SafeArea( child: Column( - children: [ + children: [ // Background const Expanded(child: GetStartedBackground()), @@ -40,7 +40,7 @@ class GetStartedPage extends StatelessWidget { child: Column( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ + children: [ // Main text and actions const GetStartedHeader(), diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/pages/phone_verification_page.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/pages/phone_verification_page.dart index 68efe765..8fcdc3fc 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/pages/phone_verification_page.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/pages/phone_verification_page.dart @@ -61,11 +61,11 @@ class PhoneVerificationPage extends StatelessWidget { @override Widget build(BuildContext context) { return BlocProvider( - create: (context) => Modular.get(), + create: (BuildContext context) => Modular.get(), child: Builder( - builder: (context) { + builder: (BuildContext context) { return BlocListener( - listener: (context, state) { + listener: (BuildContext context, AuthState state) { if (state.status == AuthStatus.authenticated) { if (state.mode == AuthMode.signup) { Modular.to.pushReplacementProfileSetup(); @@ -75,7 +75,7 @@ class PhoneVerificationPage extends StatelessWidget { } }, child: BlocBuilder( - builder: (context, state) { + builder: (BuildContext context, AuthState state) { // Check if we are in the OTP step final bool isOtpStep = state.status == AuthStatus.codeSent || @@ -93,7 +93,7 @@ class PhoneVerificationPage extends StatelessWidget { child: isOtpStep ? OtpVerification( state: state, - onOtpSubmitted: (otp) => _onOtpSubmitted( + onOtpSubmitted: (String otp) => _onOtpSubmitted( context: context, otp: otp, verificationId: state.verificationId ?? '', diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/pages/profile_setup_page.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/pages/profile_setup_page.dart index 0704f6d4..3a3cc342 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/pages/profile_setup_page.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/pages/profile_setup_page.dart @@ -24,18 +24,18 @@ class _ProfileSetupPageState extends State { int _currentStep = 0; /// List of steps in the profile setup process. - List> get _steps => [ - { + List> get _steps => >[ + { 'id': 'basic', 'title': t.staff_authentication.profile_setup_page.steps.basic, 'icon': UiIcons.user, }, - { + { 'id': 'location', 'title': t.staff_authentication.profile_setup_page.steps.location, 'icon': UiIcons.mapPin, }, - { + { 'id': 'experience', 'title': t.staff_authentication.profile_setup_page.steps.experience, 'icon': UiIcons.briefcase, @@ -83,15 +83,15 @@ class _ProfileSetupPageState extends State { @override /// Builds the profile setup page UI. Widget build(BuildContext context) { - final steps = _steps; + final List> steps = _steps; // Calculate progress final double progress = (_currentStep + 1) / steps.length; return BlocProvider( - create: (context) => Modular.get(), + create: (BuildContext context) => Modular.get(), child: BlocConsumer( - listener: (context, state) { + listener: (BuildContext context, ProfileSetupState state) { if (state.status == ProfileSetupStatus.success) { Modular.to.pushWorkerHome(); } else if (state.status == ProfileSetupStatus.failure) { @@ -105,13 +105,13 @@ class _ProfileSetupPageState extends State { ); } }, - builder: (context, state) { - final isCreatingProfile = state.status == ProfileSetupStatus.loading; + builder: (BuildContext context, ProfileSetupState state) { + final bool isCreatingProfile = state.status == ProfileSetupStatus.loading; return Scaffold( body: SafeArea( child: Column( - children: [ + children: [ // Progress Bar LinearProgressIndicator(value: progress), @@ -125,7 +125,7 @@ class _ProfileSetupPageState extends State { // Step Indicators UiStepIndicator( stepIcons: steps - .map((step) => step['icon'] as IconData) + .map((Map step) => step['icon'] as IconData) .toList(), currentStep: _currentStep, ), @@ -200,10 +200,10 @@ class _ProfileSetupPageState extends State { return ProfileSetupBasicInfo( fullName: state.fullName, bio: state.bio, - onFullNameChanged: (val) => BlocProvider.of( + onFullNameChanged: (String val) => BlocProvider.of( context, ).add(ProfileSetupFullNameChanged(val)), - onBioChanged: (val) => BlocProvider.of( + onBioChanged: (String val) => BlocProvider.of( context, ).add(ProfileSetupBioChanged(val)), ); @@ -211,10 +211,10 @@ class _ProfileSetupPageState extends State { return ProfileSetupLocation( preferredLocations: state.preferredLocations, maxDistanceMiles: state.maxDistanceMiles, - onLocationsChanged: (val) => BlocProvider.of( + onLocationsChanged: (List val) => BlocProvider.of( context, ).add(ProfileSetupLocationsChanged(val)), - onDistanceChanged: (val) => BlocProvider.of( + onDistanceChanged: (double val) => BlocProvider.of( context, ).add(ProfileSetupDistanceChanged(val)), ); @@ -222,10 +222,10 @@ class _ProfileSetupPageState extends State { return ProfileSetupExperience( skills: state.skills, industries: state.industries, - onSkillsChanged: (val) => BlocProvider.of( + onSkillsChanged: (List val) => BlocProvider.of( context, ).add(ProfileSetupSkillsChanged(val)), - onIndustriesChanged: (val) => BlocProvider.of( + onIndustriesChanged: (List val) => BlocProvider.of( context, ).add(ProfileSetupIndustriesChanged(val)), ); diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/common/auth_trouble_link.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/common/auth_trouble_link.dart index 8adf684f..95b6dff8 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/common/auth_trouble_link.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/common/auth_trouble_link.dart @@ -12,7 +12,7 @@ class AuthTroubleLink extends StatelessWidget { return Row( mainAxisAlignment: MainAxisAlignment.center, spacing: UiConstants.space1, - children: [ + children: [ Text( t.staff_authentication.common.trouble_question, style: UiTypography.body2r.textSecondary, diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/common/section_title_subtitle.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/common/section_title_subtitle.dart index e4e75e76..0b1beba1 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/common/section_title_subtitle.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/common/section_title_subtitle.dart @@ -20,7 +20,7 @@ class SectionTitleSubtitle extends StatelessWidget { return Column( crossAxisAlignment: CrossAxisAlignment.start, spacing: UiConstants.space1, - children: [ + children: [ // Title Text(title, style: UiTypography.headline1m), diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/get_started_page/get_started_actions.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/get_started_page/get_started_actions.dart index ac8878b0..8d1ac228 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/get_started_page/get_started_actions.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/get_started_page/get_started_actions.dart @@ -22,7 +22,7 @@ class GetStartedActions extends StatelessWidget { Widget build(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ + children: [ // Sign Up Button UiButton.primary( text: t.staff_authentication.get_started_page.sign_up_button, diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/get_started_page/get_started_background.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/get_started_page/get_started_background.dart index bd9c6376..18cc18c6 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/get_started_page/get_started_background.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/get_started_page/get_started_background.dart @@ -11,14 +11,14 @@ class GetStartedBackground extends StatelessWidget { return Padding( padding: const EdgeInsets.only(top: 24.0), child: Column( - children: [ + children: [ // Logo Image.asset(UiImageAssets.logoBlue, height: 40), Expanded( child: Column( mainAxisAlignment: MainAxisAlignment.center, - children: [ + children: [ // Hero Image Container( width: 288, diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/get_started_page/get_started_header.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/get_started_page/get_started_header.dart index 4ef77b9e..94528237 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/get_started_page/get_started_header.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/get_started_page/get_started_header.dart @@ -11,12 +11,12 @@ class GetStartedHeader extends StatelessWidget { Widget build(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ + children: [ RichText( textAlign: TextAlign.center, text: TextSpan( style: UiTypography.displayM, - children: [ + children: [ TextSpan( text: t.staff_authentication.get_started_page.title_part1, ), diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/otp_verification.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/otp_verification.dart index daf95684..4df7987e 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/otp_verification.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/otp_verification.dart @@ -32,7 +32,7 @@ class OtpVerification extends StatelessWidget { @override Widget build(BuildContext context) { return Column( - children: [ + children: [ Expanded( child: SingleChildScrollView( padding: const EdgeInsets.symmetric( @@ -41,7 +41,7 @@ class OtpVerification extends StatelessWidget { ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ OtpVerificationHeader(phoneNumber: state.phoneNumber), const SizedBox(height: UiConstants.space8), OtpInputField( diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/otp_verification/otp_input_field.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/otp_verification/otp_input_field.dart index 78c2d4ba..70b11165 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/otp_verification/otp_input_field.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/otp_verification/otp_input_field.dart @@ -36,17 +36,17 @@ class _OtpInputFieldState extends State { @override void dispose() { - for (final controller in _controllers) { + for (final TextEditingController controller in _controllers) { controller.dispose(); } - for (final node in _focusNodes) { + for (final FocusNode node in _focusNodes) { node.dispose(); } super.dispose(); } /// Helper getter to compute the current OTP code from all controllers. - String get _otpCode => _controllers.map((c) => c.text).join(); + String get _otpCode => _controllers.map((TextEditingController c) => c.text).join(); /// Handles changes to the OTP input fields. void _onChanged({ @@ -69,10 +69,10 @@ class _OtpInputFieldState extends State { @override Widget build(BuildContext context) { return Column( - children: [ + children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: List.generate(6, (index) { + children: List.generate(6, (int index) { return SizedBox( width: 56, height: 56, @@ -80,7 +80,7 @@ class _OtpInputFieldState extends State { controller: _controllers[index], focusNode: _focusNodes[index], keyboardType: TextInputType.number, - inputFormatters: [FilteringTextInputFormatter.digitsOnly], + inputFormatters: [FilteringTextInputFormatter.digitsOnly], textAlign: TextAlign.center, maxLength: 1, style: UiTypography.headline3m, @@ -108,7 +108,7 @@ class _OtpInputFieldState extends State { ), ), ), - onChanged: (value) => + onChanged: (String value) => _onChanged(context: context, index: index, value: value), ), ); diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/otp_verification/otp_resend_section.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/otp_verification/otp_resend_section.dart index c6fecde7..12fadb8c 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/otp_verification/otp_resend_section.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/otp_verification/otp_resend_section.dart @@ -45,7 +45,7 @@ class _OtpResendSectionState extends State { return Center( child: Text.rich( TextSpan( - children: [ + children: [ TextSpan( text: widget.hasError ? '' diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/otp_verification/otp_verification_actions.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/otp_verification/otp_verification_actions.dart index ed9ad086..a307b6df 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/otp_verification/otp_verification_actions.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/otp_verification/otp_verification_actions.dart @@ -33,7 +33,7 @@ class OtpVerificationActions extends StatelessWidget { ), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ + children: [ isLoading ? ElevatedButton( onPressed: null, diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/otp_verification/otp_verification_header.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/otp_verification/otp_verification_header.dart index ecc9a953..50837e68 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/otp_verification/otp_verification_header.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/otp_verification/otp_verification_header.dart @@ -14,7 +14,7 @@ class OtpVerificationHeader extends StatelessWidget { Widget build(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Text( t.staff_authentication.phone_verification_page.enter_code_title, style: UiTypography.headline1m, @@ -27,7 +27,7 @@ class OtpVerificationHeader extends StatelessWidget { .phone_verification_page .code_sent_message, style: UiTypography.body2r.textSecondary, - children: [ + children: [ TextSpan(text: '+1 $phoneNumber', style: UiTypography.body2b), TextSpan( text: t diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/phone_input.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/phone_input.dart index 082b09a7..01be5bf4 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/phone_input.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/phone_input.dart @@ -22,7 +22,7 @@ class PhoneInput extends StatelessWidget { @override Widget build(BuildContext context) { return Column( - children: [ + children: [ Expanded( child: SingleChildScrollView( padding: const EdgeInsets.symmetric( @@ -31,13 +31,13 @@ class PhoneInput extends StatelessWidget { ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ const PhoneInputHeader(), const SizedBox(height: UiConstants.space8), PhoneInputFormField( initialValue: state.phoneNumber, error: state.errorMessage ?? '', - onChanged: (value) { + onChanged: (String value) { BlocProvider.of( context, ).add(AuthPhoneUpdated(value)); diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/phone_input/phone_input_actions.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/phone_input/phone_input_actions.dart index 8d321eb3..dcbe0d06 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/phone_input/phone_input_actions.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/phone_input/phone_input_actions.dart @@ -27,7 +27,7 @@ class PhoneInputActions extends StatelessWidget { ), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ + children: [ isLoading ? UiButton.secondary( onPressed: null, diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/phone_input/phone_input_form_field.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/phone_input/phone_input_form_field.dart index 5e13a8ee..4fa8104f 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/phone_input/phone_input_form_field.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/phone_input/phone_input_form_field.dart @@ -47,21 +47,21 @@ class _PhoneInputFormFieldState extends State { Widget build(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Text( t.staff_authentication.phone_input.label, style: UiTypography.footnote1m.textSecondary, ), const SizedBox(height: UiConstants.space2), Row( - children: [ + children: [ Container( width: 100, height: 48, alignment: Alignment.center, child: Row( mainAxisAlignment: MainAxisAlignment.center, - children: [ + children: [ Text('πŸ‡ΊπŸ‡Έ', style: UiTypography.headline2m), const SizedBox(width: UiConstants.space1), Text('+1', style: UiTypography.body1m), @@ -73,7 +73,7 @@ class _PhoneInputFormFieldState extends State { child: TextField( controller: _controller, keyboardType: TextInputType.phone, - inputFormatters: [ + inputFormatters: [ FilteringTextInputFormatter.digitsOnly, LengthLimitingTextInputFormatter(10), ], diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/phone_input/phone_input_header.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/phone_input/phone_input_header.dart index 2b8360c1..5b86b6e3 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/phone_input/phone_input_header.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/phone_verification_page/phone_input/phone_input_header.dart @@ -11,7 +11,7 @@ class PhoneInputHeader extends StatelessWidget { Widget build(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ Text( t.staff_authentication.phone_input.title, style: UiTypography.headline1m, diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/profile_setup_page/profile_setup_basic_info.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/profile_setup_page/profile_setup_basic_info.dart index c7b1e46b..4d9ad36c 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/profile_setup_page/profile_setup_basic_info.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/profile_setup_page/profile_setup_basic_info.dart @@ -31,7 +31,7 @@ class ProfileSetupBasicInfo extends StatelessWidget { Widget build(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ SectionTitleSubtitle( title: t.staff_authentication.profile_setup_page.basic_info.title, subtitle: @@ -42,7 +42,7 @@ class ProfileSetupBasicInfo extends StatelessWidget { // Photo Upload Center( child: Stack( - children: [ + children: [ Container( width: 120, height: 120, diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/profile_setup_page/profile_setup_experience.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/profile_setup_page/profile_setup_experience.dart index 7babdb60..73612bdc 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/profile_setup_page/profile_setup_experience.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/profile_setup_page/profile_setup_experience.dart @@ -17,7 +17,7 @@ class ProfileSetupExperience extends StatelessWidget { /// Callback for when industries change. final ValueChanged> onIndustriesChanged; - static const List _allSkillKeys = [ + static const List _allSkillKeys = [ 'food_service', 'bartending', 'warehouse', @@ -30,7 +30,7 @@ class ProfileSetupExperience extends StatelessWidget { 'cooking', ]; - static const List _allIndustryKeys = [ + static const List _allIndustryKeys = [ 'hospitality', 'food_service', 'warehouse', @@ -50,7 +50,7 @@ class ProfileSetupExperience extends StatelessWidget { /// Toggles a skill. void _toggleSkill({required String skill}) { - final updatedList = List.from(skills); + final List updatedList = List.from(skills); if (updatedList.contains(skill)) { updatedList.remove(skill); } else { @@ -61,7 +61,7 @@ class ProfileSetupExperience extends StatelessWidget { /// Toggles an industry. void _toggleIndustry({required String industry}) { - final updatedList = List.from(industries); + final List updatedList = List.from(industries); if (updatedList.contains(industry)) { updatedList.remove(industry); } else { @@ -75,7 +75,7 @@ class ProfileSetupExperience extends StatelessWidget { Widget build(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ SectionTitleSubtitle( title: t.staff_authentication.profile_setup_page.experience.title, subtitle: @@ -92,10 +92,10 @@ class ProfileSetupExperience extends StatelessWidget { Wrap( spacing: UiConstants.space2, runSpacing: UiConstants.space2, - children: _allSkillKeys.map((key) { - final isSelected = skills.contains(key); + children: _allSkillKeys.map((String key) { + final bool isSelected = skills.contains(key); // Dynamic translation access - final label = _getSkillLabel(key); + final String label = _getSkillLabel(key); return UiChip( label: label, @@ -118,9 +118,9 @@ class ProfileSetupExperience extends StatelessWidget { Wrap( spacing: UiConstants.space2, runSpacing: UiConstants.space2, - children: _allIndustryKeys.map((key) { - final isSelected = industries.contains(key); - final label = _getIndustryLabel(key); + children: _allIndustryKeys.map((String key) { + final bool isSelected = industries.contains(key); + final String label = _getIndustryLabel(key); return UiChip( label: label, diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/profile_setup_page/profile_setup_header.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/profile_setup_page/profile_setup_header.dart index 738e7539..5f727d48 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/profile_setup_page/profile_setup_header.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/profile_setup_page/profile_setup_header.dart @@ -31,7 +31,7 @@ class ProfileSetupHeader extends StatelessWidget { ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ + children: [ if (currentStep > 0 && onBackTap != null) GestureDetector( onTap: onBackTap, diff --git a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/profile_setup_page/profile_setup_location.dart b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/profile_setup_page/profile_setup_location.dart index 9e3f6c76..b62b953a 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/profile_setup_page/profile_setup_location.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/src/presentation/widgets/profile_setup_page/profile_setup_location.dart @@ -41,9 +41,9 @@ class _ProfileSetupLocationState extends State { /// Adds the current text from the controller as a location. void _addLocation() { - final loc = _locationController.text.trim(); + final String loc = _locationController.text.trim(); if (loc.isNotEmpty && !widget.preferredLocations.contains(loc)) { - final updatedList = List.from(widget.preferredLocations) + final List updatedList = List.from(widget.preferredLocations) ..add(loc); widget.onLocationsChanged(updatedList); _locationController.clear(); @@ -55,7 +55,7 @@ class _ProfileSetupLocationState extends State { Widget build(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ SectionTitleSubtitle( title: t.staff_authentication.profile_setup_page.location.title, subtitle: t.staff_authentication.profile_setup_page.location.subtitle, @@ -66,7 +66,7 @@ class _ProfileSetupLocationState extends State { Row( crossAxisAlignment: CrossAxisAlignment.end, spacing: UiConstants.space2, - children: [ + children: [ Expanded( child: UiTextField( label: t @@ -102,7 +102,7 @@ class _ProfileSetupLocationState extends State { Wrap( spacing: UiConstants.space2, runSpacing: UiConstants.space2, - children: widget.preferredLocations.map((loc) { + children: widget.preferredLocations.map((String loc) { return UiChip( label: loc, leadingIcon: UiIcons.mapPin, @@ -132,7 +132,7 @@ class _ProfileSetupLocationState extends State { padding: const EdgeInsets.symmetric(horizontal: UiConstants.space2), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ + children: [ Text( t .staff_authentication @@ -158,7 +158,7 @@ class _ProfileSetupLocationState extends State { /// Removes the specified [location] from the list. void _removeLocation({required String location}) { - final updatedList = List.from(widget.preferredLocations) + final List updatedList = List.from(widget.preferredLocations) ..remove(location); widget.onLocationsChanged(updatedList); } diff --git a/apps/mobile/packages/features/staff/authentication/lib/staff_authentication.dart b/apps/mobile/packages/features/staff/authentication/lib/staff_authentication.dart index ab9bc99a..dea01247 100644 --- a/apps/mobile/packages/features/staff/authentication/lib/staff_authentication.dart +++ b/apps/mobile/packages/features/staff/authentication/lib/staff_authentication.dart @@ -1,5 +1,6 @@ library staff_authentication; +import 'package:flutter/src/widgets/framework.dart'; import 'package:flutter_modular/flutter_modular.dart'; import 'package:krow_data_connect/krow_data_connect.dart'; import 'package:firebase_auth/firebase_auth.dart' as firebase; @@ -23,7 +24,7 @@ export 'package:core_localization/core_localization.dart'; /// A [Module] for the staff authentication feature. class StaffAuthenticationModule extends Module { @override - List get imports => [DataConnectModule()]; + List get imports => [DataConnectModule()]; @override void binds(Injector i) { @@ -50,15 +51,15 @@ class StaffAuthenticationModule extends Module { } @override - void routes(r) { + void routes(RouteManager r) { r.child('/', child: (_) => const GetStartedPage()); r.child( '/phone-verification', - child: (context) { + child: (BuildContext context) { final Map? data = r.args.data; final String? modeName = data?['mode']; final AuthMode mode = AuthMode.values.firstWhere( - (e) => e.name == modeName, + (AuthMode e) => e.name == modeName, orElse: () => AuthMode.login, ); return PhoneVerificationPage(mode: mode);