From c2785c5f68204898bb1fe1a928eab021edb66014 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 12 Mar 2025 15:22:23 +0300 Subject: [PATCH] Updates & fixes --- .../components/SearchByClinic.dart | 2 +- lib/pages/landing/landing_page.dart | 2 +- .../clinic_services/get_clinic_service.dart | 2 +- lib/uitl/location_util.dart | 18 ++++++++++++------ .../bottom_navigation_item.dart | 8 +++++--- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 158f2c49..cab8e507 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -70,7 +70,7 @@ class _SearchByClinicState extends State { @override void initState() { - locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); + locationUtils = new LocationUtils(isShowConfirmDialog: true, isShowLocationTimeoutDialog: false, context: context); WidgetsBinding.instance.addPostFrameCallback((_) => getClinicsList()); checkPVM(); super.initState(); diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 05d90571..b58921a6 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -663,7 +663,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { setState(() { if (value != null) { notificationCount = value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'] > 99 ? '99+' : value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString(); - model.setState(model.count, 0, true, notificationCount); + model.setState(model.count, model.ancillaryCount, true, notificationCount); sharedPref.setString(NOTIFICATION_COUNT, notificationCount); // FlutterAppIconBadge.updateBadge(int.parse(notificationCount)); } diff --git a/lib/services/clinic_services/get_clinic_service.dart b/lib/services/clinic_services/get_clinic_service.dart index e1bda009..4737756c 100644 --- a/lib/services/clinic_services/get_clinic_service.dart +++ b/lib/services/clinic_services/get_clinic_service.dart @@ -429,7 +429,7 @@ class ClinicListService extends BaseService { localRes = response; }, onFailure: (String error, int statusCode) { throw error; - }, body: request); + }, body: request, isAllowAny: true); return Future.value(localRes); } diff --git a/lib/uitl/location_util.dart b/lib/uitl/location_util.dart index 90119490..17ccd145 100644 --- a/lib/uitl/location_util.dart +++ b/lib/uitl/location_util.dart @@ -18,11 +18,12 @@ class LocationUtils { AppSharedPreferences sharedPref = new AppSharedPreferences(); bool isShowConfirmDialog; + bool isShowLocationTimeoutDialog; BuildContext context; bool isHuawei; final GeolocatorPlatform _geolocatorPlatform = GeolocatorPlatform.instance; - LocationUtils({required this.isShowConfirmDialog, required this.context, this.isHuawei = false}); + LocationUtils({required this.isShowConfirmDialog, required this.context, this.isHuawei = false, this.isShowLocationTimeoutDialog = true}); void getCurrentLocation({Function(LatLng)? callBack}) async { if (Platform.isAndroid && isHuawei) { @@ -32,12 +33,15 @@ class LocationUtils { if (value) { await Geolocator.checkPermission().then((permission) async { if (permission == LocationPermission.always || permission == LocationPermission.whileInUse) { - Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.best, timeLimit: Duration(seconds: 5)).then((value) { + Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.medium, timeLimit: Duration(seconds: 5)).then((value) { setLocation(value); if (callBack != null) callBack(LatLng(value.latitude, value.longitude)); }).catchError((err) { print(err); - if (isShowConfirmDialog) showLocationTimeOutDialog(failureCallBack: (){}); + if (isShowConfirmDialog && isShowLocationTimeoutDialog) + showLocationTimeOutDialog(failureCallBack: () { + Geolocator.openAppSettings(); + }); }); } @@ -51,7 +55,7 @@ class LocationUtils { if (callBack != null) callBack(LatLng(value.latitude, value.longitude)); }); } else { - if (isShowConfirmDialog) showErrorLocationDialog(false, failureCallBack: (){}); + if (isShowConfirmDialog) showErrorLocationDialog(false, failureCallBack: () {}); } }); } else { @@ -59,7 +63,7 @@ class LocationUtils { getCurrentLocation(callBack: callBack); } else { setZeroLocation(); - if (isShowConfirmDialog) showErrorLocationDialog(false, failureCallBack: (){}); + if (isShowConfirmDialog) showErrorLocationDialog(false, failureCallBack: () {}); } } } @@ -130,7 +134,9 @@ class LocationUtils { accuracy: 1.0, heading: 0.0, speed: 0.0, - speedAccuracy: 1, altitudeAccuracy: 0.0, headingAccuracy: 0.0, + speedAccuracy: 1, + altitudeAccuracy: 0.0, + headingAccuracy: 0.0, // altitudeAccuracy: 0.0, // headingAccuracy: 0.0, // altitudeAccuracy: 0, diff --git a/lib/widgets/bottom_navigation/bottom_navigation_item.dart b/lib/widgets/bottom_navigation/bottom_navigation_item.dart index 00d3700b..22c27384 100644 --- a/lib/widgets/bottom_navigation/bottom_navigation_item.dart +++ b/lib/widgets/bottom_navigation/bottom_navigation_item.dart @@ -20,13 +20,15 @@ class BottomNavigationItem extends StatelessWidget { final String? name; final bool? isDisabled; + late ToDoCountProviderModel toDoProvider; + AuthenticatedUserObject authenticatedUserObject = locator(); BottomNavigationItem({this.icon, this.activeIcon, this.changeIndex, this.index, this.currentIndex, this.name, this.isDisabled = false}); @override Widget build(BuildContext context) { - var model = Provider.of(context); + toDoProvider = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context); return Expanded( child: SizedBox( @@ -72,7 +74,7 @@ class BottomNavigationItem extends StatelessWidget { ), ], ) - : (authenticatedUserObject.isLogin && model.isShowBadge) + : (authenticatedUserObject.isLogin && toDoProvider.isShowBadge) ? Stack( alignment: AlignmentDirectional.center, children: [ @@ -120,7 +122,7 @@ class BottomNavigationItem extends StatelessWidget { // borderRadius: BorderRadius.circular(8), badgeContent: Container( padding: EdgeInsets.all(2.0), - child: Text((model.count! + model.ancillaryCount!).toString(), style: TextStyle(color: Colors.white, fontSize: 14.0)), + child: Text((toDoProvider.count! + toDoProvider.ancillaryCount!).toString(), style: TextStyle(color: Colors.white, fontSize: 14.0)), ), ), ),