Updates & fixes

merge-update-with-lab-changes
haroon amjad 9 months ago
parent 7ed401fb1c
commit c2785c5f68

@ -70,7 +70,7 @@ class _SearchByClinicState extends State<SearchByClinic> {
@override @override
void initState() { void initState() {
locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); locationUtils = new LocationUtils(isShowConfirmDialog: true, isShowLocationTimeoutDialog: false, context: context);
WidgetsBinding.instance.addPostFrameCallback((_) => getClinicsList()); WidgetsBinding.instance.addPostFrameCallback((_) => getClinicsList());
checkPVM(); checkPVM();
super.initState(); super.initState();

@ -663,7 +663,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
setState(() { setState(() {
if (value != null) { if (value != null) {
notificationCount = value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'] > 99 ? '99+' : value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString(); 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); sharedPref.setString(NOTIFICATION_COUNT, notificationCount);
// FlutterAppIconBadge.updateBadge(int.parse(notificationCount)); // FlutterAppIconBadge.updateBadge(int.parse(notificationCount));
} }

@ -429,7 +429,7 @@ class ClinicListService extends BaseService {
localRes = response; localRes = response;
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
throw error; throw error;
}, body: request); }, body: request, isAllowAny: true);
return Future.value(localRes); return Future.value(localRes);
} }

@ -18,11 +18,12 @@ class LocationUtils {
AppSharedPreferences sharedPref = new AppSharedPreferences(); AppSharedPreferences sharedPref = new AppSharedPreferences();
bool isShowConfirmDialog; bool isShowConfirmDialog;
bool isShowLocationTimeoutDialog;
BuildContext context; BuildContext context;
bool isHuawei; bool isHuawei;
final GeolocatorPlatform _geolocatorPlatform = GeolocatorPlatform.instance; 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 { void getCurrentLocation({Function(LatLng)? callBack}) async {
if (Platform.isAndroid && isHuawei) { if (Platform.isAndroid && isHuawei) {
@ -32,12 +33,15 @@ class LocationUtils {
if (value) { if (value) {
await Geolocator.checkPermission().then((permission) async { await Geolocator.checkPermission().then((permission) async {
if (permission == LocationPermission.always || permission == LocationPermission.whileInUse) { 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); setLocation(value);
if (callBack != null) callBack(LatLng(value.latitude, value.longitude)); if (callBack != null) callBack(LatLng(value.latitude, value.longitude));
}).catchError((err) { }).catchError((err) {
print(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)); if (callBack != null) callBack(LatLng(value.latitude, value.longitude));
}); });
} else { } else {
if (isShowConfirmDialog) showErrorLocationDialog(false, failureCallBack: (){}); if (isShowConfirmDialog) showErrorLocationDialog(false, failureCallBack: () {});
} }
}); });
} else { } else {
@ -59,7 +63,7 @@ class LocationUtils {
getCurrentLocation(callBack: callBack); getCurrentLocation(callBack: callBack);
} else { } else {
setZeroLocation(); setZeroLocation();
if (isShowConfirmDialog) showErrorLocationDialog(false, failureCallBack: (){}); if (isShowConfirmDialog) showErrorLocationDialog(false, failureCallBack: () {});
} }
} }
} }
@ -130,7 +134,9 @@ class LocationUtils {
accuracy: 1.0, accuracy: 1.0,
heading: 0.0, heading: 0.0,
speed: 0.0, speed: 0.0,
speedAccuracy: 1, altitudeAccuracy: 0.0, headingAccuracy: 0.0, speedAccuracy: 1,
altitudeAccuracy: 0.0,
headingAccuracy: 0.0,
// altitudeAccuracy: 0.0, // altitudeAccuracy: 0.0,
// headingAccuracy: 0.0, // headingAccuracy: 0.0,
// altitudeAccuracy: 0, // altitudeAccuracy: 0,

@ -20,13 +20,15 @@ class BottomNavigationItem extends StatelessWidget {
final String? name; final String? name;
final bool? isDisabled; final bool? isDisabled;
late ToDoCountProviderModel toDoProvider;
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>(); AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
BottomNavigationItem({this.icon, this.activeIcon, this.changeIndex, this.index, this.currentIndex, this.name, this.isDisabled = false}); BottomNavigationItem({this.icon, this.activeIcon, this.changeIndex, this.index, this.currentIndex, this.name, this.isDisabled = false});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var model = Provider.of<ToDoCountProviderModel>(context); toDoProvider = Provider.of<ToDoCountProviderModel>(context);
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return Expanded( return Expanded(
child: SizedBox( child: SizedBox(
@ -72,7 +74,7 @@ class BottomNavigationItem extends StatelessWidget {
), ),
], ],
) )
: (authenticatedUserObject.isLogin && model.isShowBadge) : (authenticatedUserObject.isLogin && toDoProvider.isShowBadge)
? Stack( ? Stack(
alignment: AlignmentDirectional.center, alignment: AlignmentDirectional.center,
children: [ children: [
@ -120,7 +122,7 @@ class BottomNavigationItem extends StatelessWidget {
// borderRadius: BorderRadius.circular(8), // borderRadius: BorderRadius.circular(8),
badgeContent: Container( badgeContent: Container(
padding: EdgeInsets.all(2.0), 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)),
), ),
), ),
), ),

Loading…
Cancel
Save