From 9ed016ad8b80593fb86f15371d60b5ab35a229c0 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 5 Feb 2026 16:43:04 +0300 Subject: [PATCH] updates & fixes --- lib/core/api/api_client.dart | 2 +- lib/core/api_consts.dart | 2 +- .../authentication_view_model.dart | 2 ++ .../book_appointments_view_model.dart | 1 + .../symptoms_checker_view_model.dart | 4 +++ .../appointment_details_page.dart | 20 +++++++++++--- .../review_appointment_page.dart | 14 +++++++++- .../cmc_selection_review_page.dart | 26 ++++++++++++++----- .../contact_us/widgets/find_us_item_card.dart | 18 ++++++++++--- .../hhc_selection_review_page.dart | 18 ++++++++++--- lib/presentation/parking/parking_slot.dart | 18 ++++++++++--- .../symptoms_checker/user_info_selection.dart | 1 + lib/widgets/map/location_map_widget.dart | 18 ++++++++++--- pubspec.yaml | 2 +- 14 files changed, 118 insertions(+), 28 deletions(-) diff --git a/lib/core/api/api_client.dart b/lib/core/api/api_client.dart index 4286618..0ec385e 100644 --- a/lib/core/api/api_client.dart +++ b/lib/core/api/api_client.dart @@ -188,7 +188,7 @@ class ApiClientImp implements ApiClient { // body['SessionID'] = "45786230487560q"; } - // body['IsNewFlutterApp'] = true; + body['IsNewFlutterApp'] = true; body.removeWhere((key, value) => value == null); } diff --git a/lib/core/api_consts.dart b/lib/core/api_consts.dart index 87ca2f8..e833ea9 100644 --- a/lib/core/api_consts.dart +++ b/lib/core/api_consts.dart @@ -904,7 +904,7 @@ class ApiConsts { static String getPatientBloodAgreement = "Services/PatientVarification.svc/REST/CheckUserAgreementForBloodDonation"; // ************ static values for Api **************** - static final double appVersionID = 50.3; + static final double appVersionID = 19.7; static final int appChannelId = 3; static final String appIpAddress = "10.20.10.20"; static final String appGeneralId = "Cs2020@2016\$2958"; diff --git a/lib/features/authentication/authentication_view_model.dart b/lib/features/authentication/authentication_view_model.dart index b48912d..689b0b4 100644 --- a/lib/features/authentication/authentication_view_model.dart +++ b/lib/features/authentication/authentication_view_model.dart @@ -7,6 +7,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart' show rootBundle; import 'package:get_it/get_it.dart'; import 'package:hijri_gregorian_calendar/hijri_gregorian_calendar.dart'; +import 'package:hmg_patient_app_new/core/api_consts.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/cache_consts.dart'; import 'package:hmg_patient_app_new/core/common_models/nationality_country_model.dart'; @@ -1045,6 +1046,7 @@ class AuthenticationViewModel extends ChangeNotifier { } Future getServicePrivilege() async { + ApiConsts.setBackendURLs(); final resultEither = await _authenticationRepo.getServicePrivilege(); List privilegeModelList = []; List vidaPlusProjectListModel = []; diff --git a/lib/features/book_appointments/book_appointments_view_model.dart b/lib/features/book_appointments/book_appointments_view_model.dart index 34858b4..8da3a2f 100644 --- a/lib/features/book_appointments/book_appointments_view_model.dart +++ b/lib/features/book_appointments/book_appointments_view_model.dart @@ -806,6 +806,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { result.fold( (failure) async { print(failure); + onError!(failure.message); }, (apiResponse) { if (apiResponse.messageStatus == 2) { diff --git a/lib/features/symptoms_checker/symptoms_checker_view_model.dart b/lib/features/symptoms_checker/symptoms_checker_view_model.dart index ed82451..4180d36 100644 --- a/lib/features/symptoms_checker/symptoms_checker_view_model.dart +++ b/lib/features/symptoms_checker/symptoms_checker_view_model.dart @@ -104,6 +104,10 @@ class SymptomsCheckerViewModel extends ChangeNotifier { int? get selectedAge => _selectedAge; + setSelectedAge(int age) { + _selectedAge = age; + } + double? get selectedHeight => _selectedHeight; bool get isHeightCm => _isHeightCm; diff --git a/lib/presentation/appointments/appointment_details_page.dart b/lib/presentation/appointments/appointment_details_page.dart index 023bdee..953fd4a 100644 --- a/lib/presentation/appointments/appointment_details_page.dart +++ b/lib/presentation/appointments/appointment_details_page.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:io'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; @@ -38,7 +39,7 @@ import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; -import 'package:maps_launcher/maps_launcher.dart'; +import 'package:map_launcher/map_launcher.dart'; import 'package:provider/provider.dart'; import '../medical_file/widgets/medical_file_card.dart'; @@ -228,9 +229,20 @@ class _AppointmentDetailsPageState extends State { child: SizedBox( width: MediaQuery.of(context).size.width * 0.785, child: CustomButton( - onPressed: () { - MapsLauncher.launchCoordinates(double.parse(widget.patientAppointmentHistoryResponseModel.latitude!), - double.parse(widget.patientAppointmentHistoryResponseModel.longitude!), widget.patientAppointmentHistoryResponseModel.projectName); + onPressed: () async { + await MapLauncher.showMarker( + mapType: MapType.google, + coords: Coords(double.parse(widget.patientAppointmentHistoryResponseModel.latitude!), + double.parse(widget.patientAppointmentHistoryResponseModel.longitude!)), + title: widget.patientAppointmentHistoryResponseModel.projectName ?? "Habib Hospital", + ).catchError((err) { + MapLauncher.showMarker( + mapType: Platform.isIOS ? MapType.apple : MapType.google, + coords: Coords(double.parse(widget.patientAppointmentHistoryResponseModel.latitude!), + double.parse(widget.patientAppointmentHistoryResponseModel.longitude!)), + title: widget.patientAppointmentHistoryResponseModel.projectName ?? "Habib Hospital", + ); + }); }, text: LocaleKeys.getDirections.tr(context: context), backgroundColor: AppColors.textColor.withValues(alpha: 0.8), diff --git a/lib/presentation/book_appointment/review_appointment_page.dart b/lib/presentation/book_appointment/review_appointment_page.dart index b874e16..f82295a 100644 --- a/lib/presentation/book_appointment/review_appointment_page.dart +++ b/lib/presentation/book_appointment/review_appointment_page.dart @@ -286,8 +286,20 @@ class _ReviewAppointmentPageState extends State { } else { //TODO: Add patient Derma package check API Here await bookAppointmentsViewModel.insertSpecificAppointment(onError: (err) { - print(err.data["ErrorEndUserMessage"]); + // print(err.data["ErrorEndUserMessage"]); LoadingUtils.hideFullScreenLoader(); + showCommonBottomSheetWithoutHeight( + title: LocaleKeys.notice.tr(context: context), + context, + child: Utils.getErrorWidget(loadingText: err.toString()), + callBackFunc: () { + myAppointmentsViewModel.initAppointmentsViewModel(); + myAppointmentsViewModel.getPatientAppointments(true, false); + // Navigator.pop(context); + }, + isFullScreen: false, + isCloseButtonVisible: true, + ); }, onSuccess: (apiResp) async { LoadingUtils.hideFullScreenLoader(); await Future.delayed(Duration(milliseconds: 50)).then((value) async { diff --git a/lib/presentation/comprehensive_checkup/cmc_selection_review_page.dart b/lib/presentation/comprehensive_checkup/cmc_selection_review_page.dart index 9b78eca..840d38c 100644 --- a/lib/presentation/comprehensive_checkup/cmc_selection_review_page.dart +++ b/lib/presentation/comprehensive_checkup/cmc_selection_review_page.dart @@ -1,4 +1,5 @@ import 'dart:developer'; +import 'dart:io'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; @@ -22,7 +23,7 @@ import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; import 'package:hmg_patient_app_new/widgets/map/location_map_widget.dart'; -import 'package:maps_launcher/maps_launcher.dart'; +import 'package:map_launcher/map_launcher.dart'; import 'package:provider/provider.dart'; class CmcSelectionReviewPage extends StatefulWidget { @@ -319,16 +320,27 @@ class _CmcSelectionReviewPageState extends State { CmcUiSelectionHelper.showHospitalSelectionBottomSheet(context: context, onHospitalSelected: (hospital) => context.pop()); } - void _launchDirections(HospitalsModel selectedHospital) { + void _launchDirections(HospitalsModel selectedHospital) async { final double lat = double.parse(selectedHospital.latitude ?? "0.0"); final double lng = double.parse(selectedHospital.longitude ?? "0.0"); if (lat != 0.0 && lng != 0.0) { - MapsLauncher.launchCoordinates( - lat, - lng, - selectedHospital.name ?? "Hospital", - ); + await MapLauncher.showMarker( + mapType: MapType.google, + coords: Coords(lat, lng), + title: selectedHospital.name ?? "Hospital", + ).catchError((err) { + MapLauncher.showMarker( + mapType: Platform.isIOS ? MapType.apple : MapType.google, + coords: Coords(lat, lng), + title: selectedHospital.name ?? "Hospital", + ); + }); + // MapsLauncher.launchCoordinates( + // lat, + // lng, + // selectedHospital.name ?? "Hospital", + // ); } } diff --git a/lib/presentation/contact_us/widgets/find_us_item_card.dart b/lib/presentation/contact_us/widgets/find_us_item_card.dart index 6e295e0..1774404 100644 --- a/lib/presentation/contact_us/widgets/find_us_item_card.dart +++ b/lib/presentation/contact_us/widgets/find_us_item_card.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; @@ -10,7 +12,7 @@ import 'package:hmg_patient_app_new/features/contact_us/models/resp_models/get_h import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; -import 'package:maps_launcher/maps_launcher.dart'; +import 'package:map_launcher/map_launcher.dart'; import 'package:url_launcher/url_launcher.dart'; class FindUsItemCard extends StatelessWidget { @@ -82,8 +84,18 @@ class FindUsItemCard extends StatelessWidget { iconColor: AppColors.whiteColor, backgroundColor: AppColors.textColor.withValues(alpha: 0.8), textColor: AppColors.whiteColor, - onChipTap: () { - MapsLauncher.launchCoordinates(double.parse(getHMGLocationsModel.latitude ?? "0.0"), double.parse(getHMGLocationsModel.longitude ?? "0.0"), getHMGLocationsModel.locationName!); + onChipTap: () async { + await MapLauncher.showMarker( + mapType: MapType.google, + coords: Coords(double.parse(getHMGLocationsModel.latitude ?? "0.0"), double.parse(getHMGLocationsModel.longitude ?? "0.0")), + title: getHMGLocationsModel.locationName ?? "Hospital", + ).catchError((err) { + MapLauncher.showMarker( + mapType: Platform.isIOS ? MapType.apple : MapType.google, + coords: Coords(double.parse(getHMGLocationsModel.latitude ?? "0.0"), double.parse(getHMGLocationsModel.longitude ?? "0.0")), + title: getHMGLocationsModel.locationName ?? "Hospital", + ); + }); }, ), SizedBox(width: 4.w), diff --git a/lib/presentation/home_health_care/hhc_selection_review_page.dart b/lib/presentation/home_health_care/hhc_selection_review_page.dart index ae2430a..9a9342d 100644 --- a/lib/presentation/home_health_care/hhc_selection_review_page.dart +++ b/lib/presentation/home_health_care/hhc_selection_review_page.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; @@ -19,7 +21,7 @@ import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; import 'package:hmg_patient_app_new/widgets/map/location_map_widget.dart'; -import 'package:maps_launcher/maps_launcher.dart'; +import 'package:map_launcher/map_launcher.dart'; import 'package:provider/provider.dart'; class HhcSelectionReviewPage extends StatefulWidget { @@ -142,9 +144,19 @@ class _HhcSelectionReviewPageState extends State { ); } - void _launchDirectionsToLocation(double lat, double lng, String locationName) { + void _launchDirectionsToLocation(double lat, double lng, String locationName) async { if (lat != 0.0 && lng != 0.0) { - MapsLauncher.launchCoordinates(lat, lng, locationName); + await MapLauncher.showMarker( + mapType: MapType.google, + coords: Coords(lat, lng), + title: locationName, + ).catchError((err) { + MapLauncher.showMarker( + mapType: Platform.isIOS ? MapType.apple : MapType.google, + coords: Coords(lat, lng), + title: locationName, + ); + }); } } diff --git a/lib/presentation/parking/parking_slot.dart b/lib/presentation/parking/parking_slot.dart index 52ab181..e8c4f09 100644 --- a/lib/presentation/parking/parking_slot.dart +++ b/lib/presentation/parking/parking_slot.dart @@ -1,4 +1,4 @@ - +import 'dart:io'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; @@ -7,12 +7,12 @@ import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/qr_parking/models/qr_parking_response_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:map_launcher/map_launcher.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/chip/app_custom_chip_widget.dart'; -import 'package:maps_launcher/maps_launcher.dart'; import 'package:provider/provider.dart'; import '../../widgets/routes/custom_page_route.dart'; @@ -29,7 +29,7 @@ class ParkingSlot extends StatefulWidget { } class _ParkingSlotState extends State { - void _openDirection() { + void _openDirection() async { final lat = widget.model.latitude; final lng = widget.model.longitude; @@ -48,7 +48,17 @@ class _ParkingSlotState extends State { return; } - MapsLauncher.launchCoordinates(lat, lng); + await MapLauncher.showMarker( + mapType: MapType.google, + coords: Coords(lat, lng), + title: "Parking Location", + ).catchError((err) { + MapLauncher.showMarker( + mapType: Platform.isIOS ? MapType.apple : MapType.google, + coords: Coords(lat, lng), + title: "Parking Location", + ); + }); } diff --git a/lib/presentation/symptoms_checker/user_info_selection.dart b/lib/presentation/symptoms_checker/user_info_selection.dart index c8d8cde..c0b5f7a 100644 --- a/lib/presentation/symptoms_checker/user_info_selection.dart +++ b/lib/presentation/symptoms_checker/user_info_selection.dart @@ -144,6 +144,7 @@ class _UserInfoSelectionPageState extends State { age--; } userAgeFromDOB = age; + getIt.get().setSelectedAge(userAgeFromDOB); } catch (e) { // If date parsing fails, ignore } diff --git a/lib/widgets/map/location_map_widget.dart b/lib/widgets/map/location_map_widget.dart index 2a1ea65..e3139a9 100644 --- a/lib/widgets/map/location_map_widget.dart +++ b/lib/widgets/map/location_map_widget.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/api_consts.dart'; @@ -8,7 +10,7 @@ import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; -import 'package:maps_launcher/maps_launcher.dart'; +import 'package:map_launcher/map_launcher.dart'; /// A reusable location map widget that displays a static map with address and directions button /// Can be used in any review screen (HHC, CMC, etc.) @@ -56,9 +58,19 @@ class LocationMapWidget extends StatelessWidget { this.padding, }); - void _defaultLaunchDirections() { + void _defaultLaunchDirections() async { if (latitude != 0.0 && longitude != 0.0) { - MapsLauncher.launchCoordinates(latitude, longitude, address); + await MapLauncher.showMarker( + mapType: MapType.google, + coords: Coords(latitude, longitude), + title: address, + ).catchError((err) { + MapLauncher.showMarker( + mapType: Platform.isIOS ? MapType.apple : MapType.google, + coords: Coords(latitude, longitude), + title: address, + ); + }); } } diff --git a/pubspec.yaml b/pubspec.yaml index 02acec8..19acdf3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -73,7 +73,7 @@ dependencies: web: any flutter_staggered_animations: ^1.1.1 smooth_corner: ^1.1.1 - maps_launcher: ^3.0.0+1 + map_launcher: ^4.4.3 amazon_payfort: ^1.1.4 network_info_plus: ^6.1.4 flutter_nfc_kit: ^3.6.0