From 1553e71e7dad603b87f4ff2b8660cf843125bac4 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 28 Oct 2020 16:58:27 +0300 Subject: [PATCH] New loading dialog added into appointment flow --- lib/config/localized_values.dart | 1 + lib/pages/BookAppointment/BookConfirm.dart | 13 ++- lib/pages/BookAppointment/DoctorProfile.dart | 10 +- .../components/DocAvailableAppointments.dart | 12 +- .../components/SearchByClinic.dart | 8 +- .../components/SearchByDoctor.dart | 7 +- .../BookAppointment/widgets/BranchView.dart | 1 + .../BookAppointment/widgets/CardCommon.dart | 2 +- .../BookAppointment/widgets/DoctorView.dart | 5 +- lib/pages/MyAppointments/MyAppointments.dart | 9 +- .../widgets/AppointmentActions.dart | 70 +++++++----- lib/pages/ToDoList/ToDo.dart | 108 ++++++++++-------- lib/uitl/translations_delegate_base.dart | 2 + 13 files changed, 144 insertions(+), 104 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 29455158..b95de2c3 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -661,6 +661,7 @@ const Map> localizedValues = { "ar": "الفحص ليس تشخيص." }, "remeberthat": {"en": "Remember that", "ar": "تذكر ذلك:"}, + "loginToUseService": {"en": "You need to login to use this service", "ar": "هذة الخدمة تتطلب تسجيل الدخول"}, "select-gender": {"en": "Select Gender", "ar": "اختر الجنس"}, "i-am-a": {"en": "I am a ...", "ar": "أنا ..."}, diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 3c9400ba..144fc2a1 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -383,8 +383,10 @@ class _BookConfirmState extends State { cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, BuildContext context) { ConfirmDialog.closeAlertDialog(context); + GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service.cancelAppointment(appo, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { Future.delayed(new Duration(milliseconds: 1500), () { if (!widget.isLiveCareAppointment) { @@ -398,8 +400,8 @@ class _BookConfirmState extends State { } }).catchError((err) { print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + GifLoaderDialogUtils.hideDialog(context); + }); } insertAppointment(context, DoctorList docObject) { @@ -423,6 +425,7 @@ class _BookConfirmState extends State { docObject.projectID, docObject); }); } else { + GifLoaderDialogUtils.hideDialog(context); appo = new AppoitmentAllHistoryResultList(); appo.appointmentNo = res['SameClinicApptList'][0]['AppointmentNo']; appo.clinicID = res['SameClinicApptList'][0]['DoctorID']; @@ -451,6 +454,7 @@ class _BookConfirmState extends State { } insertLiveCareScheduledAppointment(context, DoctorList docObject) { + GifLoaderDialogUtils.showMyDialog(context); AppoitmentAllHistoryResultList appo; widget.service .insertLiveCareScheduleAppointment( @@ -471,6 +475,7 @@ class _BookConfirmState extends State { docObject.clinicID, docObject.projectID, docObject); }); } else { + GifLoaderDialogUtils.hideDialog(context); appo = new AppoitmentAllHistoryResultList(); appo.appointmentNo = res['SameClinicApptList'][0]['AppointmentNo']; appo.clinicID = res['SameClinicApptList'][0]['DoctorID']; @@ -514,6 +519,7 @@ class _BookConfirmState extends State { getLiveCareAppointmentPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) { + GifLoaderDialogUtils.hideDialog(context); widget.service .getLiveCareAppointmentPatientShare( appointmentNo, clinicID, projectID, context) @@ -523,8 +529,7 @@ class _BookConfirmState extends State { navigateToBookSuccess(context, docObject, widget.patientShareResponse); }).catchError((err) { print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } String getTime(DateTime dateTime) { diff --git a/lib/pages/BookAppointment/DoctorProfile.dart b/lib/pages/BookAppointment/DoctorProfile.dart index d6986f6f..5a7b4a41 100644 --- a/lib/pages/BookAppointment/DoctorProfile.dart +++ b/lib/pages/BookAppointment/DoctorProfile.dart @@ -40,6 +40,8 @@ class _DoctorProfileState extends State bool showFooterButton = false; var event = RobotProvider(); + AppSharedPreferences sharedPref = AppSharedPreferences(); + @override void initState() { _tabController = new TabController( @@ -69,6 +71,7 @@ class _DoctorProfileState extends State return AppScaffold( appBarTitle: TranslationBase.of(context).bookAppo, isShowAppBar: true, + isShowDecPage: false, bottomSheet: showFooterButton ? Container( width: MediaQuery.of(context).size.width, @@ -211,7 +214,6 @@ class _DoctorProfileState extends State } getPatientData() async { - AppSharedPreferences sharedPref = AppSharedPreferences(); if (await sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); @@ -222,14 +224,14 @@ class _DoctorProfileState extends State } } - void goToBookConfirm() { + void goToBookConfirm() async { if (DocAvailableAppointments.areSlotsAvailable) { - if (widget.authUser.patientID != null) { + if (await sharedPref.getObject(USER_PROFILE) != null) { navigateToBookConfirm(context); } else { ConfirmDialog dialog = new ConfirmDialog( context: context, - confirmMessage: "You have to login to use this service", + confirmMessage: TranslationBase.of(context).loginToUseService, okText: TranslationBase.of(context).confirm, cancelText: TranslationBase.of(context).cancel_nocaps, okFunction: () => {navigateToLogin()}, diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index aca0884f..85569473 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -4,10 +4,10 @@ import 'package:diplomaticquarterapp/models/Appointments/timeSlot.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; -import 'package:smart_progress_bar/smart_progress_bar.dart'; import 'package:table_calendar/table_calendar.dart'; import '../../../uitl/date_uitl.dart'; @@ -331,11 +331,13 @@ class _DocAvailableAppointmentsState extends State } getDoctorFreeSlots(context, DoctorList docObject) { + GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service .getDoctorFreeSlots(docObject.doctorID, docObject.clinicID, docObject.projectID, context) .then((res) { + GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { if (res['FreeTimeSlots'].length != 0) { freeSlotsResponse = res['FreeTimeSlots']; @@ -350,16 +352,17 @@ class _DocAvailableAppointmentsState extends State } }).catchError((err) { print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } getDoctorScheduledFreeSlots(context, DoctorList docObject) { + GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service .getDoctorScheduledFreeSlots(docObject.doctorID, docObject.clinicID, docObject.projectID, docObject.serviceID, context) .then((res) { + GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { if (res['PatientER_DoctorFreeSlots'].length != 0) { freeSlotsResponse = res['PatientER_DoctorFreeSlots']; @@ -374,8 +377,7 @@ class _DocAvailableAppointmentsState extends State } }).catchError((err) { print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } Widget _buildEventsMarker(DateTime date, List events) { diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 067f6169..5dd7364f 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -201,12 +201,14 @@ class _SearchByClinicState extends State { } getDoctorsList(BuildContext context) { + GifLoaderDialogUtils.showMyDialog(context); SearchInfo searchInfo = new SearchInfo(); if (dropdownValue == "17") { searchInfo.ProjectID = int.parse(projectDropdownValue); searchInfo.ClinicID = int.parse(dropdownValue); searchInfo.date = DateTime.now(); + GifLoaderDialogUtils.hideDialog(context); navigateToDentalComplaints(context, searchInfo); } else { List doctorsList = []; @@ -222,6 +224,7 @@ class _SearchByClinicState extends State { nearestAppo, context) .then((res) { + GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { if (res['DoctorList'].length != 0) { @@ -240,17 +243,16 @@ class _SearchByClinicState extends State { result = LinkedHashSet.from(arr).toList(); numAll = result.length; - navigateToSearchResults( context, doctorsList, result, numAll, arrDistance); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); print(err); AppToast.showErrorToast(message: err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } } diff --git a/lib/pages/BookAppointment/components/SearchByDoctor.dart b/lib/pages/BookAppointment/components/SearchByDoctor.dart index 80288085..1e1945b5 100644 --- a/lib/pages/BookAppointment/components/SearchByDoctor.dart +++ b/lib/pages/BookAppointment/components/SearchByDoctor.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart'; @@ -82,6 +83,7 @@ class _SearchByDoctorState extends State { } getDoctorsList(BuildContext context) { + GifLoaderDialogUtils.showMyDialog(context); List doctorsList = []; DoctorsListService service = new DoctorsListService(); @@ -123,7 +125,7 @@ class _SearchByDoctorState extends State { }); } else {} }); - + GifLoaderDialogUtils.hideDialog(context); navigateToSearchResults( context, doctorsList, _patientDoctorAppointmentListHospital); } else { @@ -131,8 +133,7 @@ class _SearchByDoctorState extends State { } }).catchError((err) { print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } _onDocTextChanged(content) { diff --git a/lib/pages/BookAppointment/widgets/BranchView.dart b/lib/pages/BookAppointment/widgets/BranchView.dart index 06218d61..747775d5 100644 --- a/lib/pages/BookAppointment/widgets/BranchView.dart +++ b/lib/pages/BookAppointment/widgets/BranchView.dart @@ -27,6 +27,7 @@ class _BranchViewState extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).bookAppo, isShowAppBar: true, + isShowDecPage: false, isBottomBar: false, body: new ListView.builder( itemBuilder: (BuildContext context, int index) { diff --git a/lib/pages/BookAppointment/widgets/CardCommon.dart b/lib/pages/BookAppointment/widgets/CardCommon.dart index a6cf648f..e56ba965 100644 --- a/lib/pages/BookAppointment/widgets/CardCommon.dart +++ b/lib/pages/BookAppointment/widgets/CardCommon.dart @@ -31,7 +31,7 @@ class CardCommon extends StatelessWidget { child: Text(this.text, overflow: TextOverflow.clip, style: TextStyle( - color: new Color(0xFFc5272d), + color: new Color(0xFF40ACC9), letterSpacing: 1.0, fontSize: 20.0)), ), diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index 40c0e2fc..d419e4af 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:flutter/material.dart'; import 'package:rating_bar/rating_bar.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart'; @@ -135,12 +136,14 @@ class DoctorView extends StatelessWidget { } getDoctorsProfile(context, DoctorList docObject, {isAppo}) { + GifLoaderDialogUtils.showMyDialog(context); List docProfileList = []; DoctorsListService service = new DoctorsListService(); service .getDoctorsProfile(docObject.doctorID, docObject.clinicID, docObject.projectID, context) .then((res) { + GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { if (res['DoctorProfileList'].length != 0) { res['DoctorProfileList'].forEach((v) { @@ -154,7 +157,7 @@ class DoctorView extends StatelessWidget { } }).catchError((err) { print(err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } String getDate(String date) { diff --git a/lib/pages/MyAppointments/MyAppointments.dart b/lib/pages/MyAppointments/MyAppointments.dart index 379c6e71..129450ea 100644 --- a/lib/pages/MyAppointments/MyAppointments.dart +++ b/lib/pages/MyAppointments/MyAppointments.dart @@ -5,11 +5,11 @@ import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/AppointmentCar import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; -import 'package:smart_progress_bar/smart_progress_bar.dart'; class MyAppointments extends StatefulWidget { List appoList = []; @@ -33,6 +33,7 @@ class _MyAppointmentsState extends State bool isDataLoaded = false; var sharedPref = new AppSharedPreferences(); + @override void initState() { _tabController = new TabController(length: 3, vsync: this); @@ -77,6 +78,7 @@ class _MyAppointmentsState extends State } getPatientAppointmentHistory() { + GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); widget.appoList.clear(); widget.bookedAppoList.clear(); @@ -85,6 +87,7 @@ class _MyAppointmentsState extends State service.getPatientAppointmentHistory(false, context).then((res) { print(res['AppoimentAllHistoryResultList'].length); if (res['MessageStatus'] == 1) { + GifLoaderDialogUtils.hideDialog(context); setState(() { if (res['AppoimentAllHistoryResultList'].length != 0) { res['AppoimentAllHistoryResultList'].forEach((v) { @@ -100,11 +103,11 @@ class _MyAppointmentsState extends State AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); print(err); AppToast.showErrorToast(message: err); Navigator.of(context).pop(); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } bool isConfirmed(AppoitmentAllHistoryResultList appo) { diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index 4321b20e..7bb45bad 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -18,12 +18,12 @@ import 'package:diplomaticquarterapp/pages/medical/radiology/radiology_details_p import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_screen.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'package:smart_progress_bar/smart_progress_bar.dart'; import 'package:url_launcher/url_launcher.dart'; class AppointmentActions extends StatefulWidget { @@ -351,49 +351,49 @@ class _AppointmentActionsState extends State { cancelAppointment() { ConfirmDialog.closeAlertDialog(context); + GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); - service - .cancelAppointment(widget.appo, context) - .then((res) { - print(res); - if (res['MessageStatus'] == 1) { - AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); - } else { - AppToast.showErrorToast(message: res['ErrorEndUserMessage']); - } - }) - .catchError((err) { - print(err); - }) - .showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) - .then((value) { - Navigator.of(context).pop(); - }); + service.cancelAppointment(widget.appo, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + print(res); + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); + Navigator.of(context).pop(); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); } openAppointmentRadiology() { + GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); FinalRadiology finalRadiology = new FinalRadiology(); service .getPatientRadOrders(widget.appo.appointmentNo.toString(), context) .then((res) { + GifLoaderDialogUtils.hideDialog(context); print(res['FinalRadiologyList']); finalRadiology = new FinalRadiology.fromJson(res['FinalRadiologyList'][0]); print(finalRadiology.reportData); navigateToRadiologyDetails(finalRadiology); }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); print(err); AppToast.showErrorToast(message: err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } openPrescriptionReport() { + GifLoaderDialogUtils.showMyDialog(context); List prescriptionReportEnhList = List(); DoctorsListService service = new DoctorsListService(); service.getPatientPrescriptionReports(widget.appo, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); res['ListPRM'].forEach((report) { prescriptionReportEnhList.add(PrescriptionReportEnh.fromJson(report)); }); @@ -405,10 +405,10 @@ class _AppointmentActionsState extends State { AppToast.showErrorToast(message: "Sorry there is no data"); } }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); print(err); AppToast.showErrorToast(message: err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } Future navigateToMedicinePrescriptionReport( @@ -463,8 +463,10 @@ class _AppointmentActionsState extends State { } askYourDoc() { + GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service.isAllowedToAskDoctor(widget.appo.doctorID, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); print(res['PatientDoctorAppointmentResultList']); if (res['PatientDoctorAppointmentResultList'].length != 0) { getCallRequestType(); @@ -473,15 +475,17 @@ class _AppointmentActionsState extends State { message: TranslationBase.of(context).askDocNotAllowed); } }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); print(err); AppToast.showErrorToast(message: err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } getCallRequestType() { + GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service.getCallRequestType(context).then((res) { + GifLoaderDialogUtils.hideDialog(context); List requestData = new List(); res['ListReqTypes'].forEach((element) { requestData.add(new AskDocRequestType.fromJson(element)); @@ -490,9 +494,9 @@ class _AppointmentActionsState extends State { showAskDocRequestDialog(requestData); }); }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } showAskDocRequestDialog(List requestData) { @@ -525,28 +529,32 @@ class _AppointmentActionsState extends State { } sendAskDocRequest(int requestType) { + GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service .sendAskDocCallRequest(widget.appo, requestType.toString(), context) .then((res) { + GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: "Request Sent Successfully"); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); print(err); AppToast.showErrorToast(message: err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } confirmAppointment() { + GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service .confirmAppointment(widget.appo.appointmentNo, widget.appo.clinicID, widget.appo.projectID, widget.appo.isLiveCareAppointment, context) .then((res) { + GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); Navigator.of(context).pop(); @@ -554,9 +562,9 @@ class _AppointmentActionsState extends State { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } navigateToInsuranceApprovals(int appoNo) { diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index c31ccc73..eeda7b01 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -11,6 +11,7 @@ import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart' import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; @@ -18,7 +19,6 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:rating_bar/rating_bar.dart'; -import 'package:smart_progress_bar/smart_progress_bar.dart'; class ToDo extends StatefulWidget { PatientShareResponse patientShareResponse; @@ -106,7 +106,12 @@ class _ToDoState extends State { TranslationBase.of(context) .liveCareAppo, style: TextStyle(fontSize: 12.0)) - : Text(widget.appoList[index].projectName != null ? widget.appoList[index].projectName : "-", + : Text( + widget.appoList[index].projectName != + null + ? widget + .appoList[index].projectName + : "-", style: TextStyle(fontSize: 11.0)), ), ], @@ -464,8 +469,10 @@ class _ToDoState extends State { } getPatientAppointmentHistory() { + GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service.getPatientAppointmentHistory(true, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { if (res['AppoimentAllHistoryResultList'].length != 0) { @@ -485,26 +492,29 @@ class _ToDoState extends State { } }).catchError((err) { print(err); + GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } getPatientShare(context, AppoitmentAllHistoryResultList appo) { + GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service .getPatientShare(appo.appointmentNo.toString(), appo.clinicID, appo.projectID, context) .then((res) { + GifLoaderDialogUtils.hideDialog(context); widget.patientShareResponse = new PatientShareResponse.fromJson(res); openPaymentDialog(appo, widget.patientShareResponse); }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } getAppoQR(context, AppoitmentAllHistoryResultList appo) { + GifLoaderDialogUtils.showMyDialog(context); PatientShareResponse patientShareResponse = new PatientShareResponse(); patientShareResponse.doctorNameObj = appo.doctorNameObj; @@ -518,12 +528,13 @@ class _ToDoState extends State { DoctorsListService service = new DoctorsListService(); service.generateAppointmentQR(patientShareResponse, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); print(res); navigateToQR(context, res['AppointmentQR'], patientShareResponse); }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } Future navigateToQR( @@ -620,6 +631,7 @@ class _ToDoState extends State { } checkPaymentStatus(AppoitmentAllHistoryResultList appo) { + GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service .checkPaymentStatus( @@ -627,8 +639,7 @@ class _ToDoState extends State { appo.projectID, appo.clinicID, appo.appointmentNo), context) .then((res) { - print("Printing Payment Status Reponse!!!!"); - print(res); + GifLoaderDialogUtils.hideDialog(context); String paymentInfo = res['Response_Message']; if (paymentInfo == 'Success') { createAdvancePayment(res, appo); @@ -636,18 +647,20 @@ class _ToDoState extends State { AppToast.showErrorToast(message: res['Response_Message']); } }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } createAdvancePayment(res, AppoitmentAllHistoryResultList appo) { + GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); String paymentReference = res['Fort_id'].toString(); service .createAdvancePayment( appo, res['Amount'], res['Fort_id'], res['PaymentMethod'], context) .then((res) { + GifLoaderDialogUtils.hideDialog(context); print(res['OnlineCheckInAppointments'][0]['AdvanceNumber']); addAdvancedNumberRequest( res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(), @@ -656,23 +669,25 @@ class _ToDoState extends State { appo); }).catchError((err) { print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + GifLoaderDialogUtils.hideDialog(context); + }); } addAdvancedNumberRequest(String advanceNumber, String paymentReference, String appointmentID, AppoitmentAllHistoryResultList appo) { + GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service .addAdvancedNumberRequest( advanceNumber, paymentReference, appointmentID, context) .then((res) { + GifLoaderDialogUtils.hideDialog(context); print(res); getAppoQR(context, appo); }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } Future navigateToPaymentMethod( @@ -705,51 +720,46 @@ class _ToDoState extends State { } confirmAppointment(AppoitmentAllHistoryResultList appo) { + GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service .confirmAppointment(appo.appointmentNo, appo.clinicID, appo.projectID, appo.isLiveCareAppointment, context) .then((res) { - if (res['MessageStatus'] == 1) { - AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); - getPatientAppointmentHistory(); - } else { - AppToast.showErrorToast(message: res['ErrorEndUserMessage']); - } - }) - .catchError((err) { - print(err); - }) - .showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) - .then((value) { - if (appo.isLiveCareAppointment) { - insertLiveCareVIDARequest(appo); - } else { - getPatientAppointmentHistory(); - } - }); + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); + if (appo.isLiveCareAppointment) { + insertLiveCareVIDARequest(appo); + } else { + getPatientAppointmentHistory(); + } + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); } insertLiveCareVIDARequest(AppoitmentAllHistoryResultList appo) { + GifLoaderDialogUtils.showMyDialog(context); DoctorsListService service = new DoctorsListService(); service .insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, appo.serviceID, appo.doctorID, context) .then((res) { - if (res['MessageStatus'] == 1) { - AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); - } else { - AppToast.showErrorToast(message: res['ErrorEndUserMessage']); - } - }) - .catchError((err) { - print(err); - }) - .showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) - .then((value) { - getPatientAppointmentHistory(); - }); + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); + getPatientAppointmentHistory(); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + print(err); + GifLoaderDialogUtils.hideDialog(context); + }); } } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index d89a8b1b..6870b02a 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -728,6 +728,8 @@ class TranslationBase { String get selectAge => localizedValues['select-age'][locale.languageCode]; String get iAm => localizedValues['i-am'][locale.languageCode]; String get yearOld => localizedValues['years-old'][locale.languageCode]; + + String get loginToUseService => localizedValues['loginToUseService'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate {