From 69666a6f6cdf18c7e1a5a24f76f565e7c3ad457f Mon Sep 17 00:00:00 2001 From: "Fatimah.Alshammari" Date: Tue, 13 Jan 2026 12:25:27 +0300 Subject: [PATCH 1/2] fixed button --- lib/core/dependencies.dart | 25 ++++----- lib/presentation/parking/paking_page.dart | 63 +++++++++++++--------- lib/presentation/parking/parking_slot.dart | 44 +++++++++------ pubspec.yaml | 2 +- 4 files changed, 79 insertions(+), 55 deletions(-) diff --git a/lib/core/dependencies.dart b/lib/core/dependencies.dart index e8d3071..f6d5471 100644 --- a/lib/core/dependencies.dart +++ b/lib/core/dependencies.dart @@ -72,6 +72,7 @@ import 'package:local_auth/local_auth.dart'; import 'package:logger/web.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import '../features/monthly_reports/monthly_reports_repo.dart'; import '../features/qr_parking/qr_parking_view_model.dart'; import '../presentation/health_calculators_and_converts/health_calculator_view_model.dart'; @@ -290,11 +291,11 @@ class AppDependencies { getIt.registerLazySingleton(() => MyInvoicesViewModel(myInvoicesRepo: getIt(), errorHandlerService: getIt(), navServices: getIt())); getIt.registerLazySingleton(() => MonthlyReportViewModel(errorHandlerService: getIt(), monthlyReportRepo: getIt())); - getIt.registerLazySingleton(() => MyInvoicesViewModel( - myInvoicesRepo: getIt(), - errorHandlerService: getIt(), - navServices: getIt(), - )); + // getIt.registerLazySingleton(() => MyInvoicesViewModel( + // myInvoicesRepo: getIt(), + // errorHandlerService: getIt(), + // navServices: getIt(), + // )); getIt.registerLazySingleton(() => HealthTrackersViewModel(healthTrackersRepo: getIt(), errorHandlerService: getIt())); getIt.registerLazySingleton( () => ActivePrescriptionsViewModel( @@ -302,13 +303,13 @@ class AppDependencies { activePrescriptionsRepo: getIt() ), ); - getIt.registerFactory( - () => QrParkingViewModel( - qrParkingRepo: getIt(), - errorHandlerService: getIt(), - cacheService: getIt(), - ), - ); + // getIt.registerFactory( + // () => QrParkingViewModel( + // qrParkingRepo: getIt(), + // errorHandlerService: getIt(), + // cacheService: getIt(), + // ), + // ); } } diff --git a/lib/presentation/parking/paking_page.dart b/lib/presentation/parking/paking_page.dart index cd1e8bc..f112d51 100644 --- a/lib/presentation/parking/paking_page.dart +++ b/lib/presentation/parking/paking_page.dart @@ -10,6 +10,7 @@ import 'package:provider/provider.dart'; import '../../features/qr_parking/qr_parking_view_model.dart'; import '../../theme/colors.dart'; import '../../widgets/appbar/app_bar_widget.dart'; +import '../../widgets/buttons/custom_button.dart'; import '../../widgets/routes/custom_page_route.dart'; @@ -110,32 +111,42 @@ class _ParkingPageState extends State { child: SizedBox( width: double.infinity, height: 56, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: AppColors.primaryRedColor, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - ), - ), - onPressed: vm.isLoading ? null : () => _readQR(context), - child: vm.isLoading - ? const SizedBox( - width: 22, - height: 22, - child: CircularProgressIndicator( - strokeWidth: 2, - color: Colors.white, - ), - ) - : const Text( - "Read Barcodes", - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - color: Colors.white, - ), - ), - ), + child: CustomButton( + text: "Read Barcodes".needTranslation, + onPressed: () => _readQR(context), // ALWAYS non-null + isDisabled: vm.isLoading, // control disabled state here + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + fontSize: 18, + fontWeight: FontWeight.bold, + ) + + // ElevatedButton( + // style: ElevatedButton.styleFrom( + // backgroundColor: AppColors.primaryRedColor, + // shape: RoundedRectangleBorder( + // borderRadius: BorderRadius.circular(10), + // ), + // ), + // onPressed: vm.isLoading ? null : () => _readQR(context), + // child: vm.isLoading + // ? const SizedBox( + // width: 22, + // height: 22, + // child: CircularProgressIndicator( + // strokeWidth: 2, + // color: Colors.white, + // ), + // ) + // : const Text( + // "Read Barcodes", + // style: TextStyle( + // fontSize: 18, + // fontWeight: FontWeight.bold, + // color: Colors.white, + // ), + // ), + // ), ), ), ), diff --git a/lib/presentation/parking/parking_slot.dart b/lib/presentation/parking/parking_slot.dart index 013bb6f..ce13dad 100644 --- a/lib/presentation/parking/parking_slot.dart +++ b/lib/presentation/parking/parking_slot.dart @@ -9,6 +9,7 @@ import 'package:hmg_patient_app_new/features/qr_parking/models/qr_parking_respon import '../../features/qr_parking/qr_parking_view_model.dart'; import '../../theme/colors.dart'; import '../../widgets/appbar/app_bar_widget.dart'; +import '../../widgets/buttons/custom_button.dart'; import '../../widgets/chip/app_custom_chip_widget.dart'; import 'package:maps_launcher/maps_launcher.dart'; import 'package:provider/provider.dart'; @@ -184,23 +185,34 @@ class _ParkingSlotState extends State { SizedBox( width: double.infinity, height: 48.h, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: AppColors.primaryRedColor, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - ), - ), + child:CustomButton( + text: "Get Direction".needTranslation, onPressed: _openDirection, - child: Text( - "Get Direction".needTranslation, - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - color: AppColors.whiteColor, - ), - ), - ), + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + textColor: AppColors.whiteColor, + fontSize: 18, + fontWeight: FontWeight.bold, + borderRadius: 10, + ) + + // ElevatedButton( + // style: ElevatedButton.styleFrom( + // backgroundColor: AppColors.primaryRedColor, + // shape: RoundedRectangleBorder( + // borderRadius: BorderRadius.circular(10), + // ), + // ), + // onPressed: _openDirection, + // child: Text( + // "Get Direction".needTranslation, + // style: TextStyle( + // fontSize: 18, + // fontWeight: FontWeight.bold, + // color: AppColors.whiteColor, + // ), + // ), + // ), ), // const Spacer(), diff --git a/pubspec.yaml b/pubspec.yaml index 461d3ab..cdad394 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -77,7 +77,7 @@ dependencies: amazon_payfort: ^1.1.4 network_info_plus: ^6.1.4 flutter_nfc_kit: ^3.6.0 - barcode_scan2: ^4.5.1 + barcode_scan2: ^4.6.0 keyboard_actions: ^4.2.0 path_provider: ^2.0.8 open_filex: ^4.7.0 From 287e2b956289e5d86e46c6d879f6a6e75b92a318 Mon Sep 17 00:00:00 2001 From: "Fatimah.Alshammari" Date: Wed, 14 Jan 2026 10:42:50 +0300 Subject: [PATCH 2/2] fixed QR --- lib/core/api/api_client.dart | 2 +- lib/core/dependencies.dart | 10 +++++----- lib/routes/app_routes.dart | 23 ++++++++++++----------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/lib/core/api/api_client.dart b/lib/core/api/api_client.dart index 039787b..722a45e 100644 --- a/lib/core/api/api_client.dart +++ b/lib/core/api/api_client.dart @@ -19,7 +19,7 @@ abstract class ApiClient { Future post( String endPoint, { - required dynamic body, + required Map body, required Function(dynamic response, int statusCode, {int? messageStatus, String? errorMessage}) onSuccess, required Function(String error, int statusCode, {int? messageStatus, Failure? failureType}) onFailure, bool isAllowAny, diff --git a/lib/core/dependencies.dart b/lib/core/dependencies.dart index d70191b..5f2444f 100644 --- a/lib/core/dependencies.dart +++ b/lib/core/dependencies.dart @@ -292,11 +292,11 @@ class AppDependencies { // getIt.registerLazySingleton(() => MyInvoicesViewModel(myInvoicesRepo: getIt(), errorHandlerService: getIt(), navServices: getIt())); getIt.registerLazySingleton(() => MonthlyReportViewModel(errorHandlerService: getIt(), monthlyReportRepo: getIt())); - // getIt.registerLazySingleton(() => MyInvoicesViewModel( - // myInvoicesRepo: getIt(), - // errorHandlerService: getIt(), - // navServices: getIt(), - // )); + getIt.registerLazySingleton(() => MyInvoicesViewModel( + myInvoicesRepo: getIt(), + errorHandlerService: getIt(), + navServices: getIt(), + )); getIt.registerLazySingleton(() => HealthTrackersViewModel(healthTrackersRepo: getIt(), errorHandlerService: getIt())); getIt.registerLazySingleton( () => ActivePrescriptionsViewModel( diff --git a/lib/routes/app_routes.dart b/lib/routes/app_routes.dart index 059969c..632463f 100644 --- a/lib/routes/app_routes.dart +++ b/lib/routes/app_routes.dart @@ -126,17 +126,18 @@ class AppRoutes { return HealthTrackerDetailPage( trackerType: args ?? HealthTrackerTypeEnum.bloodSugar, ); - - monthlyReports: (context) => ChangeNotifierProvider( - create: (_) => MonthlyReportsViewModel( - monthlyReportsRepo: getIt(), - errorHandlerService: getIt(), - ), - child: const MonthlyReportsPage(), - ), - qrParking: (context) => ChangeNotifierProvider( - create: (_) => getIt(), - child: const ParkingPage(), }, + + monthlyReports: (context) => ChangeNotifierProvider( + create: (_) => MonthlyReportsViewModel( + monthlyReportsRepo: getIt(), + errorHandlerService: getIt(), + ), + child: const MonthlyReportsPage(), + ), + qrParking: (context) => ChangeNotifierProvider( + create: (_) => getIt(), + child: const ParkingPage(), + ), }; }