From bd00e07c1391c3ab4bcf3e250ffe82a6e78a4c66 Mon Sep 17 00:00:00 2001 From: mobileteam Date: Mon, 21 Sep 2026 02:30:10 -0700 Subject: [PATCH] Updates & fixes --- lib/core/service/client/base_app_client.dart | 2 +- lib/pages/BookAppointment/BookingOptions.dart | 11 +- .../ContactUs/findus/hospitrals_page.dart | 122 +++++++++--------- .../ContactUs/findus/pharmacies_page.dart | 122 +++++++++--------- lib/pages/ErService/ErOptions.dart | 63 +++++---- .../insurance/insurance_card_screen.dart | 14 +- lib/pages/medical/allergies_page.dart | 2 +- .../prescription_items_page.dart | 2 +- lib/uitl/location_util.dart | 70 +++++++--- lib/uitl/utils.dart | 20 +-- 10 files changed, 236 insertions(+), 192 deletions(-) diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index edce26ff..3f530204 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -187,7 +187,7 @@ class BaseAppClient { // body['IdentificationNo'] = 1023854217; // body['MobileNo'] = "531940021"; //0560717232 - // body['PatientID'] = 5690832; //4609100 + // body['PatientID'] = 10714; //4609100 // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 diff --git a/lib/pages/BookAppointment/BookingOptions.dart b/lib/pages/BookAppointment/BookingOptions.dart index 791631dc..84829e30 100644 --- a/lib/pages/BookAppointment/BookingOptions.dart +++ b/lib/pages/BookAppointment/BookingOptions.dart @@ -19,10 +19,13 @@ class _BookingOptionsState extends State { @override void initState() { - locationUtils = - new LocationUtils(isShowConfirmDialog: true, context: context); - WidgetsBinding.instance - .addPostFrameCallback((_) => locationUtils.getCurrentLocation()); + locationUtils = new LocationUtils( + isShowConfirmDialog: false, + isShowLocationTimeoutDialog: false, + context: context); + WidgetsBinding.instance.addPostFrameCallback((_) => + locationUtils.getCurrentLocation( + isShowConfirmDialog: false, isShowLocationTimeoutDialog: false)); super.initState(); } diff --git a/lib/pages/ContactUs/findus/hospitrals_page.dart b/lib/pages/ContactUs/findus/hospitrals_page.dart index 6f48deb6..98a6439d 100644 --- a/lib/pages/ContactUs/findus/hospitrals_page.dart +++ b/lib/pages/ContactUs/findus/hospitrals_page.dart @@ -29,67 +29,67 @@ class _HospitalsPageState extends State { itemBuilder: (context, index) => HospitalLocation(widget.findusHospitalModelList[index]), itemCount: widget.findusHospitalModelList.length, ), - Container( - margin: EdgeInsets.only(top: 14), - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - boxShadow: [ - BoxShadow( - color: Color(0xff000000).withOpacity(.05), - //spreadRadius: 5, - blurRadius: 27, - offset: Offset(0, -3), - ), - ], - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - IconButton( - icon: new Image.asset('assets/images/new-design/youtube.png'), - iconSize: 48, - tooltip: 'Youtube', - onPressed: () { - setState(() { - launch("https://www.youtube.com/c/DrsulaimanAlhabibHospitals"); - }); - }, - ), - IconButton( - icon: new Image.asset('assets/images/new-design/linkedin.png'), - tooltip: 'LinkedIn', - iconSize: 48, - onPressed: () { - setState(() { - launch("https://www.linkedin.com/company/drsulaiman-alhabib-medical-group"); - }); - }, - ), - IconButton( - icon: new Image.asset('assets/images/new-design/twitter.png'), - tooltip: 'Twitter', - iconSize: 48, - onPressed: () { - setState(() { - launch("https://twitter.com/HMG"); - }); - }, - ), - IconButton( - icon: new Image.asset('assets/images/new-design/facebook.png'), - tooltip: 'facebook', - iconSize: 48, - onPressed: () { - setState(() { - launch("https://www.facebook.com/DrSulaimanAlHabib?ref=tn_tnmn"); - }); - }, - ), - ], - ), - ), + // Container( + // margin: EdgeInsets.only(top: 14), + // decoration: BoxDecoration( + // borderRadius: BorderRadius.all( + // Radius.circular(10.0), + // ), + // boxShadow: [ + // BoxShadow( + // color: Color(0xff000000).withOpacity(.05), + // //spreadRadius: 5, + // blurRadius: 27, + // offset: Offset(0, -3), + // ), + // ], + // color: Colors.white), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceEvenly, + // children: [ + // IconButton( + // icon: new Image.asset('assets/images/new-design/youtube.png'), + // iconSize: 48, + // tooltip: 'Youtube', + // onPressed: () { + // setState(() { + // launch("https://www.youtube.com/c/DrsulaimanAlhabibHospitals"); + // }); + // }, + // ), + // IconButton( + // icon: new Image.asset('assets/images/new-design/linkedin.png'), + // tooltip: 'LinkedIn', + // iconSize: 48, + // onPressed: () { + // setState(() { + // launch("https://www.linkedin.com/company/drsulaiman-alhabib-medical-group"); + // }); + // }, + // ), + // IconButton( + // icon: new Image.asset('assets/images/new-design/twitter.png'), + // tooltip: 'Twitter', + // iconSize: 48, + // onPressed: () { + // setState(() { + // launch("https://twitter.com/HMG"); + // }); + // }, + // ), + // IconButton( + // icon: new Image.asset('assets/images/new-design/facebook.png'), + // tooltip: 'facebook', + // iconSize: 48, + // onPressed: () { + // setState(() { + // launch("https://www.facebook.com/DrSulaimanAlHabib?ref=tn_tnmn"); + // }); + // }, + // ), + // ], + // ), + // ), ], ), ); diff --git a/lib/pages/ContactUs/findus/pharmacies_page.dart b/lib/pages/ContactUs/findus/pharmacies_page.dart index 529319f1..adc578a9 100644 --- a/lib/pages/ContactUs/findus/pharmacies_page.dart +++ b/lib/pages/ContactUs/findus/pharmacies_page.dart @@ -29,67 +29,67 @@ class _PharmaciesPageState extends State { itemBuilder: (context, index) => HospitalLocation(widget.findusPharmaciesModelList[index], showCity: true), itemCount: widget.findusPharmaciesModelList.length, ), - Container( - margin: EdgeInsets.only(top: 14), - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - boxShadow: [ - BoxShadow( - color: Color(0xff000000).withOpacity(.05), - //spreadRadius: 5, - blurRadius: 27, - offset: Offset(0, -3), - ), - ], - color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - IconButton( - icon: new Image.asset('assets/images/new-design/youtube.png'), - iconSize: 48, - tooltip: 'Youtube', - onPressed: () { - setState(() { - launch("https://www.youtube.com/c/DrsulaimanAlhabibHospitals"); - }); - }, - ), - IconButton( - icon: new Image.asset('assets/images/new-design/linkedin.png'), - tooltip: 'LinkedIn', - iconSize: 48, - onPressed: () { - setState(() { - launch("https://www.linkedin.com/company/drsulaiman-alhabib-medical-group"); - }); - }, - ), - IconButton( - icon: new Image.asset('assets/images/new-design/twitter.png'), - tooltip: 'Twitter', - iconSize: 48, - onPressed: () { - setState(() { - launch("https://twitter.com/HMG"); - }); - }, - ), - IconButton( - icon: new Image.asset('assets/images/new-design/facebook.png'), - tooltip: 'facebook', - iconSize: 48, - onPressed: () { - setState(() { - launch("https://www.facebook.com/DrSulaimanAlHabib?ref=tn_tnmn"); - }); - }, - ), - ], - ), - ), + // Container( + // margin: EdgeInsets.only(top: 14), + // decoration: BoxDecoration( + // borderRadius: BorderRadius.all( + // Radius.circular(10.0), + // ), + // boxShadow: [ + // BoxShadow( + // color: Color(0xff000000).withOpacity(.05), + // //spreadRadius: 5, + // blurRadius: 27, + // offset: Offset(0, -3), + // ), + // ], + // color: Colors.white), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceEvenly, + // children: [ + // IconButton( + // icon: new Image.asset('assets/images/new-design/youtube.png'), + // iconSize: 48, + // tooltip: 'Youtube', + // onPressed: () { + // setState(() { + // launch("https://www.youtube.com/c/DrsulaimanAlhabibHospitals"); + // }); + // }, + // ), + // IconButton( + // icon: new Image.asset('assets/images/new-design/linkedin.png'), + // tooltip: 'LinkedIn', + // iconSize: 48, + // onPressed: () { + // setState(() { + // launch("https://www.linkedin.com/company/drsulaiman-alhabib-medical-group"); + // }); + // }, + // ), + // IconButton( + // icon: new Image.asset('assets/images/new-design/twitter.png'), + // tooltip: 'Twitter', + // iconSize: 48, + // onPressed: () { + // setState(() { + // launch("https://twitter.com/HMG"); + // }); + // }, + // ), + // IconButton( + // icon: new Image.asset('assets/images/new-design/facebook.png'), + // tooltip: 'facebook', + // iconSize: 48, + // onPressed: () { + // setState(() { + // launch("https://www.facebook.com/DrSulaimanAlHabib?ref=tn_tnmn"); + // }); + // }, + // ), + // ], + // ), + // ), ], ), ); diff --git a/lib/pages/ErService/ErOptions.dart b/lib/pages/ErService/ErOptions.dart index 9253dd52..a5079aeb 100644 --- a/lib/pages/ErService/ErOptions.dart +++ b/lib/pages/ErService/ErOptions.dart @@ -27,8 +27,10 @@ class _ErOptionsState extends State { @override void initState() { - locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); - WidgetsBinding.instance.addPostFrameCallback((_) => locationUtils.getCurrentLocation()); + locationUtils = + new LocationUtils(isShowConfirmDialog: true, context: context); + WidgetsBinding.instance + .addPostFrameCallback((_) => locationUtils.getCurrentLocation()); super.initState(); } @@ -46,23 +48,27 @@ class _ErOptionsState extends State { showNewAppBarTitle: true, backgroundColor: Color(0xffF8F8F8), body: GridView( - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, + childAspectRatio: 2 / 2, + crossAxisSpacing: 12, + mainAxisSpacing: 12), physics: NeverScrollableScrollPhysics(), padding: EdgeInsets.all(21), shrinkWrap: true, children: [ - InkWell( - onTap: () { - if (projectViewModel.havePrivilege(63)) Navigator.push(context, FadePage(page: AmbulanceReq())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).ambulancerequest, - imagePath: 'assets/images/new-design/AM.PNG', - subTitle: TranslationBase.of(context).requestA, - isPngImage: true, - isEnable: projectViewModel.havePrivilege(63), - ), - ), + // InkWell( + // onTap: () { + // if (projectViewModel.havePrivilege(63)) Navigator.push(context, FadePage(page: AmbulanceReq())); + // }, + // child: MedicalProfileItem( + // title: TranslationBase.of(context).ambulancerequest, + // imagePath: 'assets/images/new-design/AM.PNG', + // subTitle: TranslationBase.of(context).requestA, + // isPngImage: true, + // isEnable: projectViewModel.havePrivilege(63), + // ), + // ), InkWell( onTap: () { Navigator.push(context, FadePage(page: NearestEr())); @@ -74,21 +80,22 @@ class _ErOptionsState extends State { isPngImage: true, ), ), + // InkWell( + // onTap: () { + // if (rrtLocked) Navigator.push(context, FadePage(page: RRTMainScreen())); + // }, + // child: MedicalProfileItem( + // title: TranslationBase.of(context).RRTTitle, + // imagePath: 'assets/images/new-design/AM.PNG', + // subTitle: TranslationBase.of(context).RRTSubTitle, + // isPngImage: true, + // isEnable: rrtLocked, + // ), + // ), InkWell( onTap: () { - if (rrtLocked) Navigator.push(context, FadePage(page: RRTMainScreen())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).RRTTitle, - imagePath: 'assets/images/new-design/AM.PNG', - subTitle: TranslationBase.of(context).RRTSubTitle, - isPngImage: true, - isEnable: rrtLocked, - ), - ), - InkWell( - onTap: () { - if (projectViewModel.havePrivilege(81)) Navigator.push(context, FadePage(page: DdServicesPage())); + if (projectViewModel.havePrivilege(81)) + Navigator.push(context, FadePage(page: DdServicesPage())); // Navigator.push(context, FadePage(page: DdServicesPage())); }, child: MedicalProfileItem( diff --git a/lib/pages/insurance/insurance_card_screen.dart b/lib/pages/insurance/insurance_card_screen.dart index fbe0c87e..c8ec9470 100644 --- a/lib/pages/insurance/insurance_card_screen.dart +++ b/lib/pages/insurance/insurance_card_screen.dart @@ -49,13 +49,13 @@ class _InsuranceCardState extends State { showNewAppBar: true, showNewAppBarTitle: true, backgroundColor: CustomColors.appBackgroudGreyColor, - floatingActionButton: FloatingActionButton.extended( - onPressed: () { - Navigator.push(context, FadePage(page: InsuranceUpdate())); - }, - backgroundColor: CustomColors.accentColor, - label: Text(TranslationBase.of(context).update, style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.bold)), - ), + // floatingActionButton: FloatingActionButton.extended( + // onPressed: () { + // Navigator.push(context, FadePage(page: InsuranceUpdate())); + // }, + // backgroundColor: CustomColors.accentColor, + // label: Text(TranslationBase.of(context).update, style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.bold)), + // ), body: Container( child: ListView.separated( itemCount: model.insurance == null ? 0 : model.insurance.length, diff --git a/lib/pages/medical/allergies_page.dart b/lib/pages/medical/allergies_page.dart index 599d91b0..344b27f0 100644 --- a/lib/pages/medical/allergies_page.dart +++ b/lib/pages/medical/allergies_page.dart @@ -47,7 +47,7 @@ class AllergiesPage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(TranslationBase.of(context).remarks+" :"), + Texts(TranslationBase.of(context).remarks+" : " + model.allergies[index].remarks! ?? ''), Texts(TranslationBase.of(context).description + ": " + model.allergies[index].description! ?? ''), ], ), diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index 70ce271a..f34db3c7 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -72,7 +72,7 @@ class PrescriptionItemsPage extends StatelessWidget { prescriptions.doctorRate, prescriptions.actualDoctorRate, prescriptions.noOfPatientsRate, - projectViewModel.user.emailAddress!, + projectViewModel.user.emailAddress ?? "", ), isNeedToShowButton: (model.prescriptionReportListINP.length > 0 || model.prescriptionReportEnhList.length > 0) ? projectViewModel.havePrivilege(13) : false, buttonTitle: TranslationBase.of(context).download, diff --git a/lib/uitl/location_util.dart b/lib/uitl/location_util.dart index 6c170710..8ffed26e 100644 --- a/lib/uitl/location_util.dart +++ b/lib/uitl/location_util.dart @@ -22,19 +22,35 @@ class LocationUtils { bool isHuawei; final GeolocatorPlatform _geolocatorPlatform = GeolocatorPlatform.instance; - LocationUtils({required this.isShowConfirmDialog, required this.context, this.isHuawei = false, this.isShowLocationTimeoutDialog = true}); + LocationUtils( + {required this.isShowConfirmDialog, + required this.context, + this.isHuawei = false, + this.isShowLocationTimeoutDialog = true}); + + void getCurrentLocation( + {bool isShowConfirmDialog = false, + bool isShowLocationTimeoutDialog = false, + Function(LatLng)? callBack}) async { + + this.isShowConfirmDialog = isShowConfirmDialog; + this.isShowLocationTimeoutDialog = isShowLocationTimeoutDialog; - void getCurrentLocation({Function(LatLng)? callBack}) async { if (Platform.isAndroid && isHuawei) { _getHMSCurrentLocation(callBack!); } else { Geolocator.isLocationServiceEnabled().then((value) async { if (value) { await Geolocator.checkPermission().then((permission) async { - if (permission == LocationPermission.always || permission == LocationPermission.whileInUse) { - Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.medium, timeLimit: Duration(seconds: 5)).then((value) { + if (permission == LocationPermission.always || + permission == LocationPermission.whileInUse) { + Geolocator.getCurrentPosition( + desiredAccuracy: LocationAccuracy.medium, + timeLimit: Duration(seconds: 5)) + .then((value) { setLocation(value); - if (callBack != null) callBack(LatLng(value.latitude, value.longitude)); + if (callBack != null) + callBack(LatLng(value.latitude, value.longitude)); }).catchError((err) { print(err); if (isShowConfirmDialog && isShowLocationTimeoutDialog) { @@ -45,17 +61,25 @@ class LocationUtils { }); } - if (permission == LocationPermission.denied || permission == LocationPermission.deniedForever) { + if (permission == LocationPermission.denied || + permission == LocationPermission.deniedForever) { if (Platform.isAndroid) { - Utils.showPermissionConsentDialog(context, TranslationBase.of(context).locationPermissionDialog, () async { + Utils.showPermissionConsentDialog(context, + TranslationBase.of(context).locationPermissionDialog, + () async { final hasPermission = await _handlePermission(); if (hasPermission) { - Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.medium, timeLimit: Duration(seconds: 10)).then((value) { + Geolocator.getCurrentPosition( + desiredAccuracy: LocationAccuracy.medium, + timeLimit: Duration(seconds: 10)) + .then((value) { setLocation(value); - if (callBack != null) callBack(LatLng(value.latitude, value.longitude)); + if (callBack != null) + callBack(LatLng(value.latitude, value.longitude)); }); } else { - if (isShowConfirmDialog) showErrorLocationDialog(false, failureCallBack: () {}); + if (isShowConfirmDialog) + showErrorLocationDialog(false, failureCallBack: () {}); } }); } else { @@ -63,7 +87,8 @@ class LocationUtils { getCurrentLocation(callBack: callBack); } else { setZeroLocation(); - if (isShowConfirmDialog) showErrorLocationDialog(false, failureCallBack: () {}); + if (isShowConfirmDialog) + showErrorLocationDialog(false, failureCallBack: () {}); } } } @@ -71,7 +96,8 @@ class LocationUtils { print(err); }); } else { - if (isShowConfirmDialog) showErrorLocationDialog(false, failureCallBack: () {}); + if (isShowConfirmDialog) + showErrorLocationDialog(false, failureCallBack: () {}); } }).catchError((err) { print(err); @@ -134,14 +160,20 @@ class LocationUtils { int _locationUpdateCbId = 0; doIt() { - FusedLocationProviderClient locationService = FusedLocationProviderClient(); + FusedLocationProviderClient locationService = + FusedLocationProviderClient(); LocationRequest locationRequest = LocationRequest(); locationRequest.priority = LocationRequest.PRIORITY_HIGH_ACCURACY; locationRequest.interval = 1000; - List locationRequestList = [locationRequest]; - LocationSettingsRequest locationSettingsRequest = LocationSettingsRequest(requests: locationRequestList); + List locationRequestList = [ + locationRequest + ]; + LocationSettingsRequest locationSettingsRequest = + LocationSettingsRequest(requests: locationRequestList); - locationService.checkLocationSettings(locationSettingsRequest).then((settings) async { + locationService + .checkLocationSettings(locationSettingsRequest) + .then((settings) async { _locationUpdateCbId = await locationService.requestLocationUpdatesCb( locationRequest, LocationCallback(onLocationResult: (locationResult) { @@ -208,7 +240,8 @@ class LocationUtils { return dialog.showAlertDialog(context); } - showErrorLocationDialog(bool isPermissionError, {Function()? failureCallBack}) { + showErrorLocationDialog(bool isPermissionError, + {Function()? failureCallBack}) { setLocation(null); ConfirmDialog dialog = new ConfirmDialog( context: context, @@ -251,6 +284,7 @@ class LocationUtils { var result = await [ Permission.location, ].request(); - return (result[Permission.location]!.isGranted || result[Permission.locationAlways]!.isGranted); + return (result[Permission.location]!.isGranted || + result[Permission.locationAlways]!.isGranted); } } diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index dfbe532f..580424e7 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -460,16 +460,16 @@ class Utils { ), )); - medical.add(InkWell( - onTap: () { - Navigator.push(context, FadePage(page: InsuranceUpdate())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).updateInsurance, - imagePath: 'insurance_card.svg', - subTitle: TranslationBase.of(context).updateInsuranceSubtitle, - ), - )); + // medical.add(InkWell( + // onTap: () { + // Navigator.push(context, FadePage(page: InsuranceUpdate())); + // }, + // child: MedicalProfileItem( + // title: TranslationBase.of(context).updateInsurance, + // imagePath: 'insurance_card.svg', + // subTitle: TranslationBase.of(context).updateInsuranceSubtitle, + // ), + // )); medical.add(InkWell( onTap: () => projectViewModel.havePrivilege(18)