diff --git a/lib/analytics/flows/todo_list.dart b/lib/analytics/flows/todo_list.dart index 62d9a98f..694363f1 100644 --- a/lib/analytics/flows/todo_list.dart +++ b/lib/analytics/flows/todo_list.dart @@ -101,7 +101,7 @@ class TodoList{ // R052 to_do_list_nfc_cancel(AppoitmentAllHistoryResultList appointment){ logger('to_do_list_nfc_cancel', parameters: { - 'appointment_type' : appointment.isLiveCareAppointment ? 'livecare' : 'regular', + 'appointment_type' : appointment.isLiveCareAppointment != null ? appointment.isLiveCareAppointment ? 'livecare' : 'regular' : 'regular', 'clinic_type_online' : appointment.clinicName, 'hospital_name' : appointment.projectName, 'doctor_name' : (appointment.doctorName == null || appointment.doctorName == '') ? appointment.doctorNameObj : appointment.doctorName, diff --git a/lib/models/Appointments/DoctorProfile.dart b/lib/models/Appointments/DoctorProfile.dart index f96eb4d6..68b83800 100644 --- a/lib/models/Appointments/DoctorProfile.dart +++ b/lib/models/Appointments/DoctorProfile.dart @@ -121,7 +121,7 @@ class DoctorProfileList { doctorCases = json['DoctorCases']; doctorPicture = json['DoctorPicture']; doctorProfileInfo = json['DoctorProfileInfo']; - specialty = json['Specialty'].cast(); + specialty = json['Specialty'] != null ? json['Specialty'].cast() : [""]; actualDoctorRate = json['ActualDoctorRate']; doctorImageURL = json['DoctorImageURL']; doctorRate = json['DoctorRate']; diff --git a/lib/pages/BookAppointment/components/DocInfo.dart b/lib/pages/BookAppointment/components/DocInfo.dart index 041a021f..59925b06 100644 --- a/lib/pages/BookAppointment/components/DocInfo.dart +++ b/lib/pages/BookAppointment/components/DocInfo.dart @@ -104,7 +104,7 @@ class DoctorInformation extends StatelessWidget { ), mHeight(10), Text( - docProfileList.doctorProfileInfo, + docProfileList.doctorProfileInfo != null ? docProfileList.doctorProfileInfo : "", style: TextStyle( fontSize: 12, letterSpacing: -0.48, diff --git a/lib/pages/landing/widgets/services_view.dart b/lib/pages/landing/widgets/services_view.dart index 4f6af3f0..f9942feb 100644 --- a/lib/pages/landing/widgets/services_view.dart +++ b/lib/pages/landing/widgets/services_view.dart @@ -29,6 +29,7 @@ import 'package:diplomaticquarterapp/pages/paymentService/payment_service.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/covid_consent_dialog.dart'; @@ -47,6 +48,7 @@ class ServicesView extends StatelessWidget { AuthenticatedUser authUser = new AuthenticatedUser(); AuthProvider authProvider = new AuthProvider(); PharmacyModuleViewModel pharmacyModuleViewModel = locator(); + LocationUtils locationUtils; ServicesView(this.hmgServices, this.index); @@ -55,10 +57,7 @@ class ServicesView extends StatelessWidget { return InkWell( onTap: () { if (index == 0) { - locator().hmgServices.logServiceName('live care service'); - Navigator.push(context, FadePage(page: LiveCareHome())).then((value) { - LiveCareHome.isLiveCareTypeSelected = false; - }); + openLiveCare(context); } else if (index == 1) { showCovidDialog(context); locator().hmgServices.logServiceName('covid-test drive-thru'); @@ -296,6 +295,17 @@ class ServicesView extends StatelessWidget { } } + openLiveCare(BuildContext context) { + locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); + locationUtils.getCurrentLocation(callBack: (value) { + print(value); + locator().hmgServices.logServiceName('live care service'); + Navigator.push(context, FadePage(page: LiveCareHome())).then((value) { + LiveCareHome.isLiveCareTypeSelected = false; + }); + }); + } + getPharmacyToken(BuildContext context) async { if (!authProvider.isLogin) { Navigator.push(context, FadePage(page: LandingPagePharmacy())); diff --git a/lib/uitl/location_util.dart b/lib/uitl/location_util.dart index 1aea4172..bb215613 100644 --- a/lib/uitl/location_util.dart +++ b/lib/uitl/location_util.dart @@ -31,11 +31,11 @@ class LocationUtils { if (Platform.isAndroid && isHuawei) { _getHMSCurrentLocation(callBack); } else { - Geolocator.isLocationServiceEnabled().then((value) { + Geolocator.isLocationServiceEnabled().then((value) async { if (value) { - Geolocator.checkPermission().then((permission) async { + await Geolocator.checkPermission().then((permission) async { if (permission == LocationPermission.always || permission == LocationPermission.whileInUse) { - Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.medium, timeLimit: Duration(seconds: 10)).then((value) { + Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.low, timeLimit: Duration(seconds: 10)).then((value) { setLocation(value); if (callBack != null) callBack(LatLng(value.latitude, value.longitude)); }); @@ -51,7 +51,7 @@ class LocationUtils { }); } else { if (await Permission.location.request().isGranted) { - getCurrentLocation(); + getCurrentLocation(callBack: callBack); } else { setZeroLocation(); if (isShowConfirmDialog) showErrorLocationDialog(false); @@ -118,7 +118,7 @@ class LocationUtils { confirmMessage: TranslationBase.of(context).locationDialogMessage, okText: TranslationBase.of(context).confirm, cancelText: TranslationBase.of(context).cancel_nocaps, - okFunction: () => {ConfirmDialog.closeAlertDialog(context), if (isPermissionError) Geolocator.openAppSettings() else Geolocator.openLocationSettings(), Navigator.of(context).pop()}, + okFunction: () => {ConfirmDialog.closeAlertDialog(context), if (isPermissionError) Geolocator.openAppSettings() else Geolocator.openLocationSettings(), Navigator.of(context).canPop()}, cancelFunction: () => {}); return dialog.showAlertDialog(context); } diff --git a/lib/widgets/nfc/nfc_reader_sheet.dart b/lib/widgets/nfc/nfc_reader_sheet.dart index d2119417..07d87e93 100644 --- a/lib/widgets/nfc/nfc_reader_sheet.dart +++ b/lib/widgets/nfc/nfc_reader_sheet.dart @@ -169,7 +169,9 @@ class _NfcLayoutState extends State { // widget.onNcfScan(nfcId); // Navigator.pop(context); // }, - onPressed: null, + onPressed: () { + Navigator.pop(context); + }, elevation: 0, child: Text("DONE"), ),