diff --git a/lib/core/service/medical/medical_service.dart b/lib/core/service/medical/medical_service.dart index c8f29e44..0e763978 100644 --- a/lib/core/service/medical/medical_service.dart +++ b/lib/core/service/medical/medical_service.dart @@ -11,7 +11,7 @@ class MedicalService extends BaseService { List appoitmentAllHistoryResultList = List(); List doctorScheduleResponse = List(); List freeSlots = []; - getAppointmentHistory({bool isActiveAppointment = false}) async { + getAppointmentHistory({bool isActiveAppointment = false, bool isForTimeLine = false}) async { hasError = false; super.error = ""; Map body = Map(); @@ -19,6 +19,7 @@ class MedicalService extends BaseService { body['IsActiveAppointment'] = true; body['isDentalAllowedBackend'] = false; } + body['IsForTimeLine'] = isForTimeLine; var appoHistory = await sharedPref.getObject(APPOINTMENT_HISTORY_MEDICAL); if (appoHistory != null) { appoitmentAllHistoryResultList.clear(); diff --git a/lib/core/viewModels/medical/medical_view_model.dart b/lib/core/viewModels/medical/medical_view_model.dart index 004f368b..bdf40509 100644 --- a/lib/core/viewModels/medical/medical_view_model.dart +++ b/lib/core/viewModels/medical/medical_view_model.dart @@ -12,10 +12,10 @@ class MedicalViewModel extends BaseViewModel { List get appoitmentAllHistoryResultList => _medicalService.appoitmentAllHistoryResultList; List get getDoctorScheduleList => _medicalService.doctorScheduleResponse; List get freeSlots => _medicalService.freeSlots; - getAppointmentHistory() async { + getAppointmentHistory({bool isForTimeLine = false}) async { if (authenticatedUserObject.isLogin) { setState(ViewState.Busy); - await _medicalService.getAppointmentHistory(); + await _medicalService.getAppointmentHistory(isForTimeLine: isForTimeLine); if (_medicalService.hasError) { error = _medicalService.error; setState(ViewState.Error); diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 9f6c5df5..b6e2f668 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -256,7 +256,7 @@ class _BookConfirmState extends State { cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, BuildContext context) async { ConfirmDialog.closeAlertDialog(context); - GifLoaderDialogUtils.showMyDialog(context); + GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: false); DoctorsListService service = new DoctorsListService(); bool isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT); service.cancelAppointment(appo, context, isReschedule: true).then((res) { @@ -326,7 +326,7 @@ class _BookConfirmState extends State { final timeSlot = DocAvailableAppointments.selectedAppoDateTime; String logs = await sharedPref.getString('selectedLogSlots'); List decodedLogs = json.decode(logs); - GifLoaderDialogUtils.showMyDialog(context); + GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: false); AppoitmentAllHistoryResultList appo; widget.service .insertAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, widget.selectedTime, widget.selectedDate, initialSlotDuration, projectViewModel.isArabic ? 1 : 2, context, null, null, null, projectViewModel) @@ -383,7 +383,7 @@ class _BookConfirmState extends State { final timeSlot = DocAvailableAppointments.selectedAppoDateTime; widget.selectedDate = timeSlot.toUtc().add(Duration(hours: 3)).toString().split(" ")[0]; widget.selectedTime = timeSlot.toUtc().add(Duration(hours: 3)).toString().split(" ")[1].substring(0, 5); - GifLoaderDialogUtils.showMyDialog(context); + GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: false); AppoitmentAllHistoryResultList appo; widget.service.insertLiveCareScheduleAppointment(docObject.doctorID, docObject.clinicID, docObject.projectID, docObject.serviceID, widget.selectedTime, widget.selectedDate, projectViewModel.isArabic ? 1 : 2, context).then((res) { if (res['MessageStatus'] == 1) { @@ -444,7 +444,7 @@ class _BookConfirmState extends State { getPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) { int languageID = projectViewModel.isArabic ? 1 : 2; String errorMsg = ""; - GifLoaderDialogUtils.showMyDialog(context); + GifLoaderDialogUtils.showMyDialog(context, barrierDismissible: false); widget.service.getPatientShare(appointmentNo, clinicID, projectID, languageID, context).then((res) { projectViewModel.selectedBodyPartList.clear(); projectViewModel.laserSelectionDuration = 0; diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 75889850..ac1eb6f8 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -1174,9 +1174,9 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { addAdvancedNumberRequestTamara("Tamara-Advance-0000", tamaraOrderID, appo.appointmentNo.toString(), appo); } }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); print(err); AppToast.showErrorToast(message: err); - GifLoaderDialogUtils.hideDialog(context); }); } catch (err) { print(err); diff --git a/lib/pages/medical/medical_profile_page_new.dart b/lib/pages/medical/medical_profile_page_new.dart index 35f6cd45..e505e47e 100644 --- a/lib/pages/medical/medical_profile_page_new.dart +++ b/lib/pages/medical/medical_profile_page_new.dart @@ -31,7 +31,7 @@ class _MedicalProfilePageState extends State { var appoCountProvider = Provider.of(context); List myMedicalList = Utils.myMedicalList(projectViewModel: projectViewModel, context: context, count: appoCountProvider.count, isLogin: projectViewModel.isLogin); return BaseView( - onModelReady: (model) => model.getAppointmentHistory(), + onModelReady: (model) => model.getAppointmentHistory(isForTimeLine: true), builder: (_, model, widget1) => AppScaffold( isShowDecPage: false, isShowAppBar: false, diff --git a/lib/uitl/gif_loader_dialog_utils.dart b/lib/uitl/gif_loader_dialog_utils.dart index 4591c19f..1a847637 100644 --- a/lib/uitl/gif_loader_dialog_utils.dart +++ b/lib/uitl/gif_loader_dialog_utils.dart @@ -7,15 +7,16 @@ class GifLoaderDialogUtils { static bool get isLoading => _isLoadingVisible; - static showMyDialog(BuildContext context) { + static showMyDialog(BuildContext context, {bool barrierDismissible = true}) { // showDialog(context: context, builder: (cxt) => GifLoaderContainer()); WidgetsBinding.instance.addPostFrameCallback((_) { _isLoadingVisible = true; showDialog( + barrierDismissible: barrierDismissible, context: context, barrierColor: Colors.black.withOpacity(0.5), useRootNavigator: false, - builder: (BuildContext context) => GifLoaderContainer(), + builder: (BuildContext context) => GifLoaderContainer(barrierDismissible: barrierDismissible,), ).then((value) { _isLoadingVisible = false; }); diff --git a/lib/widgets/Loader/gif_loader_container.dart b/lib/widgets/Loader/gif_loader_container.dart index 75083d1a..79651081 100644 --- a/lib/widgets/Loader/gif_loader_container.dart +++ b/lib/widgets/Loader/gif_loader_container.dart @@ -2,6 +2,10 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter_gifimage/flutter_gifimage.dart'; class GifLoaderContainer extends StatefulWidget { + bool barrierDismissible; + + GifLoaderContainer({this.barrierDismissible = true}); + @override _GifLoaderContainerState createState() => _GifLoaderContainerState(); } @@ -29,14 +33,20 @@ class _GifLoaderContainerState extends State with TickerProv @override Widget build(BuildContext context) { - return Center( + return WillPopScope( + onWillPop: () async { + return widget.barrierDismissible; + }, + child: Center( //progress-loading.gif child: Container( - // margin: EdgeInsets.only(bottom: 40), - child: GifImage( - controller: controller1, - image: AssetImage("assets/images/progress-loading-red.gif"), //NetworkImage("http://img.mp.itc.cn/upload/20161107/5cad975eee9e4b45ae9d3c1238ccf91e.jpg"), + // margin: EdgeInsets.only(bottom: 40), + child: GifImage( + controller: controller1, + image: AssetImage("assets/images/progress-loading-red.gif"), //NetworkImage("http://img.mp.itc.cn/upload/20161107/5cad975eee9e4b45ae9d3c1238ccf91e.jpg"), + ), + ), ), - )); + ); } }