From b42c47f074499c6a3679d0c73a997d3525d79d87 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 6 Feb 2024 15:00:54 +0300 Subject: [PATCH 1/9] Update to stores --- ios/Runner.xcodeproj/project.pbxproj | 6 +++--- lib/config/config.dart | 2 +- pubspec.yaml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 1514bc24..77d6d13b 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -540,7 +540,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.5.84; + MARKETING_VERSION = 4.5.87; PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -684,7 +684,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.5.84; + MARKETING_VERSION = 4.5.87; PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -722,7 +722,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.5.84; + MARKETING_VERSION = 4.5.87; PRODUCT_BUNDLE_IDENTIFIER = "com.HMG.HMG-Smartphone"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/lib/config/config.dart b/lib/config/config.dart index c5afb016..4386f96f 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -345,7 +345,7 @@ var UPDATE_COVID_QUESTIONNAIRE = 'Services/Doctors.svc/REST/COVID19_Questionnari var CHANNEL = 3; var GENERAL_ID = 'Cs2020@2016\$2958'; var IP_ADDRESS = '10.20.10.20'; -var VERSION_ID = 12.4; +var VERSION_ID = 12.5; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; diff --git a/pubspec.yaml b/pubspec.yaml index 5b1da571..729402a3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.5.85+1 +version: 4.5.051+4050051 environment: sdk: ">=2.7.0 <3.0.0" From 162b2fd22a7830fbbe20b53d7bd246ad4e0974a1 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 12 Feb 2024 09:43:29 +0300 Subject: [PATCH 2/9] updates --- lib/config/config.dart | 4 +- lib/main.dart | 4 -- lib/pages/landing/landing_page.dart | 3 ++ lib/splashPage.dart | 3 ++ lib/uitl/LocalNotification.dart | 71 +++++++++++++++++------------ 5 files changed, 50 insertions(+), 35 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 4386f96f..8e5bdc7b 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -21,8 +21,8 @@ var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:4422/'; -// var BASE_URL = 'https://uat.hmgwebservices.com/'; -var BASE_URL = 'https://hmgwebservices.com/'; +var BASE_URL = 'https://uat.hmgwebservices.com/'; +// var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'http://10.20.200.111:1010/'; // var BASE_URL = 'https://uat.hmgwebservices.com/'; // var BASE_URL = 'https://hmgwebservices.com/'; diff --git a/lib/main.dart b/lib/main.dart index 4be8957b..b740b661 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -81,10 +81,6 @@ class _MyApp extends State { Widget build(BuildContext context) { PlatformBridge.init(context); - LocalNotification.init(onNotificationClick: (payload) { - LocalNotification.getInstance().showNow(title: "Payload", subtitle: payload, payload: payload); - }); - // SystemChrome.setPreferredOrientations([ // DeviceOrientation.portraitUp, // DeviceOrientation.portraitDown, diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index d0e4f526..683ddc6d 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -303,6 +303,9 @@ class _LandingPageState extends State with WidgetsBindingObserver { int languageID = Provider.of(context, listen: false).isArabic ? 1 : 2; familyFileProvider.getSharedRecordByStatus(languageID); } + // Future.delayed(Duration(seconds: 3)).then((result) async { + // LocalNotification.getInstance().showNow(title: "Payload Update", subtitle: "Payload Update", payload: "Payload Update"); + // }); }); PayfortViewModel payfortViewModel = context.read(); diff --git a/lib/splashPage.dart b/lib/splashPage.dart index 778ab6ff..68580dc9 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/theme/theme_notifier.dart'; import 'package:diplomaticquarterapp/theme/theme_value.dart'; +import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/push-notification-handler.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -37,6 +38,8 @@ class _SplashScreenState extends State { Duration(seconds: 1, milliseconds: 500), () async { await loadPrivilege().then((value) { + LocalNotification.init(onNotificationClick: (payload) {}); + // LocalNotification.getInstance().showNow(title: "Payload", subtitle: "Subtitle", payload: "Payload"); if(!_privilegeService.hasError) { Navigator.of(context).pushReplacement( MaterialPageRoute( diff --git a/lib/uitl/LocalNotification.dart b/lib/uitl/LocalNotification.dart index 9e0cd11b..1a3f2bea 100644 --- a/lib/uitl/LocalNotification.dart +++ b/lib/uitl/LocalNotification.dart @@ -31,25 +31,27 @@ class LocalNotification { _initialize() async { try { var initializationSettingsAndroid = new AndroidInitializationSettings('app_icon'); - // var initializationSettingsIOS = DarwinInitializationSettings(onDidReceiveLocalNotification: null); - // var initializationSettings = InitializationSettings(android: initializationSettingsAndroid, iOS: initializationSettingsIOS); - // await flutterLocalNotificationsPlugin.initialize( - // initializationSettings, - // onDidReceiveNotificationResponse: (NotificationResponse notificationResponse) { - // switch (notificationResponse.notificationResponseType) { - // case NotificationResponseType.selectedNotification: - // // selectNotificationStream.add(notificationResponse.payload); - // break; - // case NotificationResponseType.selectedNotificationAction: - // // if (notificationResponse.actionId == navigationActionId) { - // // selectNotificationStream.add(notificationResponse.payload); - // // } - // break; - // } - // }, - // onDidReceiveBackgroundNotificationResponse: notificationTapBackground, - // ); - } catch (ex) {} + var initializationSettingsIOS = DarwinInitializationSettings(onDidReceiveLocalNotification: null); + var initializationSettings = InitializationSettings(android: initializationSettingsAndroid, iOS: initializationSettingsIOS); + await flutterLocalNotificationsPlugin.initialize( + initializationSettings, + onDidReceiveNotificationResponse: (NotificationResponse notificationResponse) { + switch (notificationResponse.notificationResponseType) { + case NotificationResponseType.selectedNotification: + // selectNotificationStream.add(notificationResponse.payload); + break; + case NotificationResponseType.selectedNotificationAction: + // if (notificationResponse.actionId == navigationActionId) { + // selectNotificationStream.add(notificationResponse.payload); + // } + break; + } + }, + // onDidReceiveBackgroundNotificationResponse: notificationTapBackground, + ); + } catch (ex) { + print(ex.toString()); + } // flutterLocalNotificationsPlugin.initialize(initializationSettings, onDidReceiveNotificationResponse: (NotificationResponse notificationResponse) // { // switch (notificationResponse.notificationResponseType) { @@ -96,15 +98,26 @@ class LocalNotification { } Future showNow({@required String title, @required String subtitle, String payload}) { - // Future.delayed(Duration(seconds: 1)).then((result) async { - // var androidPlatformChannelSpecifics = AndroidNotificationDetails('com.hmg.local_notification', 'HMG', - // channelDescription: 'HMG', importance: Importance.max, priority: Priority.high, ticker: 'ticker', vibrationPattern: _vibrationPattern()); - // var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); - // var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics); - // await flutterLocalNotificationsPlugin.show(_randomNumber(), title, subtitle, platformChannelSpecifics, payload: payload).catchError((err) { - // print(err); - // }); - // }); + Future.delayed(Duration(seconds: 1)).then((result) async { + var androidPlatformChannelSpecifics = AndroidNotificationDetails( + 'com.hmg.local_notification', + 'HMG', + channelDescription: 'HMG', + importance: Importance.max, + priority: Priority.high, + ticker: 'ticker', + vibrationPattern: _vibrationPattern(), + ongoing: true, + autoCancel: false, + usesChronometer: true, + when: DateTime.now().millisecondsSinceEpoch - 120 * 1000, + ); + var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); + var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics); + await flutterLocalNotificationsPlugin.show(25613, title, subtitle, platformChannelSpecifics, payload: payload).catchError((err) { + print(err); + }); + }); } Future scheduleNotification({@required DateTime scheduledNotificationDateTime, @required String title, @required String description}) async { @@ -115,7 +128,7 @@ class LocalNotification { vibrationPattern[2] = 5000; vibrationPattern[3] = 2000; - // var androidPlatformChannelSpecifics = AndroidNotificationDetails('active-prescriptions', 'ActivePrescriptions', + // var androidPlatformChannelSpecifics = AndroidNotificationDetails('active-prescriptions', 'ActivePrescriptions', // channelDescription: 'ActivePrescriptionsDescription', // // icon: 'secondary_icon', // sound: RawResourceAndroidNotificationSound('slow_spring_board'), From 7fc47ebf341f6aaa6b8f61ba8c676799e09fa7d6 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 14 Feb 2024 15:11:46 +0300 Subject: [PATCH 3/9] LiveCare invoice fix --- lib/config/config.dart | 4 ++-- lib/pages/livecare/widgets/LiveCareHistoryCard.dart | 3 ++- lib/services/livecare_services/livecare_provider.dart | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 8e5bdc7b..4386f96f 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -21,8 +21,8 @@ var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:4422/'; -var BASE_URL = 'https://uat.hmgwebservices.com/'; -// var BASE_URL = 'https://hmgwebservices.com/'; +// var BASE_URL = 'https://uat.hmgwebservices.com/'; +var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'http://10.20.200.111:1010/'; // var BASE_URL = 'https://uat.hmgwebservices.com/'; // var BASE_URL = 'https://hmgwebservices.com/'; diff --git a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart index cf89b766..dac84e89 100644 --- a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart +++ b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart @@ -237,9 +237,10 @@ class _LiveCareHistoryCardState extends State { } sendInvoiceEmail(context) { + int languageID = projectViewModel.isArabic ? 1 : 2; LiveCareService service = new LiveCareService(); GifLoaderDialogUtils.showMyDialog(context); - service.sendLiveCareInvoiceEmail(widget.erRequestHistoryList.appointmentNo.toString(), widget.erRequestHistoryList.projectID, authUser.emailAddress, context).then((res) { + service.sendLiveCareInvoiceEmail(widget.erRequestHistoryList.appointmentNo.toString(), widget.erRequestHistoryList.projectID, authUser.emailAddress, languageID, context).then((res) { GifLoaderDialogUtils.hideDialog(context); AppToast.showSuccessToast(message: TranslationBase.of(context).emailSentSuccessfully); }).catchError((err) { diff --git a/lib/services/livecare_services/livecare_provider.dart b/lib/services/livecare_services/livecare_provider.dart index 25df930d..a01ef107 100644 --- a/lib/services/livecare_services/livecare_provider.dart +++ b/lib/services/livecare_services/livecare_provider.dart @@ -289,13 +289,13 @@ class LiveCareService extends BaseService { return Future.value(localRes); } - Future sendLiveCareInvoiceEmail(String appoNo, int projectID, String emailAddress, BuildContext context) async { + Future sendLiveCareInvoiceEmail(String appoNo, int projectID, String emailAddress, int languageID, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } - request = {"To": emailAddress, "ProjectID": projectID, "AppointmentNo": appoNo}; + request = {"To": emailAddress, "ProjectID": projectID, "AppointmentNo": appoNo, "LanguageID": languageID}; dynamic localRes; await baseAppClient.post(SEND_LIVECARE_INVOICE_EMAIL, onSuccess: (response, statusCode) async { localRes = response; From e0c9914206772dccfa3d8458c208b6d02f55013a Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 15 Feb 2024 16:22:15 +0300 Subject: [PATCH 4/9] Issue for appointment reschedule fixed --- lib/pages/MyAppointments/AppointmentDetails.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pages/MyAppointments/AppointmentDetails.dart b/lib/pages/MyAppointments/AppointmentDetails.dart index cd5597db..362320eb 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -308,10 +308,10 @@ class _AppointmentDetailsState extends State with SingleTick } void goToBookConfirm() { - if (DocAvailableAppointments.areAppointmentsAvailable) + if (DocAvailableAppointments.areSlotsAvailable) navigateToBookConfirm(context); else - AppToast.showErrorToast(message: TranslationBase.of(context).emptySchedule); + AppToast.showErrorToast(message: TranslationBase.of(context).selectSlot); } Future navigateToBookConfirm(context) async { From 727a9f136346bfadd984e3853a2264cf7da3996a Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 19 Feb 2024 12:39:38 +0300 Subject: [PATCH 5/9] updates & checks --- lib/config/config.dart | 13 ++++---- lib/core/service/client/base_app_client.dart | 2 +- lib/pages/landing/landing_page.dart | 1 + lib/uitl/gif_loader_dialog_utils.dart | 31 ++++++++++++++++++-- lib/widgets/in_app_browser/InAppBrowser.dart | 4 +-- 5 files changed, 38 insertions(+), 13 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 4386f96f..b73b0c16 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -22,9 +22,8 @@ var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:4422/'; // var BASE_URL = 'https://uat.hmgwebservices.com/'; -var BASE_URL = 'https://hmgwebservices.com/'; -// var BASE_URL = 'http://10.20.200.111:1010/'; -// var BASE_URL = 'https://uat.hmgwebservices.com/'; +// var BASE_URL = 'https://hmgwebservices.com/'; + var BASE_URL = 'http://10.20.200.111:1010/'; // var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; @@ -629,10 +628,10 @@ var CONVERT_PATIENT_TO_CASH = 'Services/Doctors.svc/REST/deActivateInsuranceComp //PAYFORT var getPayFortProjectDetails = "Services/PayFort_Serv.svc/REST/GetPayFortProjectDetails"; var addPayFortApplePayResponse = "Services/PayFort_Serv.svc/REST/AddResponse"; -var payFortEnvironment = FortEnvironment.production; -var applePayMerchantId = "merchant.com.hmgwebservices"; -// var payFortEnvironment = FortEnvironment.test; -// var applePayMerchantId = "merchant.com.hmgwebservices.uat"; +// var payFortEnvironment = FortEnvironment.production; +// var applePayMerchantId = "merchant.com.hmgwebservices"; +var payFortEnvironment = FortEnvironment.test; +var applePayMerchantId = "merchant.com.hmgwebservices.uat"; class AppGlobal { static var context; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index e9fa657e..d0d5ed1b 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -175,7 +175,7 @@ class BaseAppClient { // body['IdentificationNo'] = 1023854217; // body['MobileNo'] = "531940021"; //0560717232 - // body['PatientID'] = 1374756; //4609100 + // body['PatientID'] = 3300938; //4609100 // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 683ddc6d..f60e3bda 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -382,6 +382,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { setUserValues(value); Navigator.of(context).pushNamed(CONFIRM_LOGIN); } else { + GifLoaderDialogUtils.hideDialog(context); Navigator.of(context).pushNamed( WELCOME_LOGIN, ); diff --git a/lib/uitl/gif_loader_dialog_utils.dart b/lib/uitl/gif_loader_dialog_utils.dart index d95307de..4591c19f 100644 --- a/lib/uitl/gif_loader_dialog_utils.dart +++ b/lib/uitl/gif_loader_dialog_utils.dart @@ -3,15 +3,40 @@ import 'package:flutter/material.dart'; import '../widgets/Loader/gif_loader_container.dart'; class GifLoaderDialogUtils { + static bool _isLoadingVisible = false; + + static bool get isLoading => _isLoadingVisible; + static showMyDialog(BuildContext context) { - showDialog(context: context, builder: (cxt) => GifLoaderContainer()); + // showDialog(context: context, builder: (cxt) => GifLoaderContainer()); + WidgetsBinding.instance.addPostFrameCallback((_) { + _isLoadingVisible = true; + showDialog( + context: context, + barrierColor: Colors.black.withOpacity(0.5), + useRootNavigator: false, + builder: (BuildContext context) => GifLoaderContainer(), + ).then((value) { + _isLoadingVisible = false; + }); + }); } static hideDialog(BuildContext context) { try { - Navigator.of(context).pop(); + if (_isLoadingVisible) { + _isLoadingVisible = false; + Navigator.of(context).pop(); + } + _isLoadingVisible = false; + // Navigator.of(context, rootNavigator: true).canPop(); } catch (error) { - Future.delayed(Duration(milliseconds: 250)).then((value) => Navigator.of(context).canPop()); + // Future.delayed(Duration(milliseconds: 250)).then((value) => Navigator.of(context, rootNavigator: true).canPop()); + if (_isLoadingVisible) { + _isLoadingVisible = false; + Navigator.of(context).pop(); + } + _isLoadingVisible = false; } } } diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index c9fecbf9..c71b206b 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -40,9 +40,9 @@ class MyInAppBrowser extends InAppBrowser { // static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL LIVE static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL UAT - // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT + static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT - static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE + // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE // static String SERVICE_URL = 'https://uat.hmgwebservices.com/payfortforvidaplus/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL UAT VIDA PLUS From fe37de962113fb20d6ba25ae4149b8468c66be88 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 21 Feb 2024 09:29:29 +0300 Subject: [PATCH 6/9] Loading dialog updates --- lib/core/service/medical/medical_service.dart | 3 ++- .../medical/medical_view_model.dart | 4 ++-- lib/pages/BookAppointment/BookConfirm.dart | 8 +++---- lib/pages/ToDoList/ToDo.dart | 2 +- .../medical/medical_profile_page_new.dart | 2 +- lib/uitl/gif_loader_dialog_utils.dart | 5 +++-- lib/widgets/Loader/gif_loader_container.dart | 22 ++++++++++++++----- 7 files changed, 29 insertions(+), 17 deletions(-) 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"), + ), + ), ), - )); + ); } } From 5256d8873f738518c3549879985095cac34a0c4a Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 26 Feb 2024 11:05:25 +0300 Subject: [PATCH 7/9] ToDo & Appo Timeline changes --- lib/config/config.dart | 6 +- lib/pages/ToDoList/ToDo.dart | 41 ++++++++++++-- .../medical/medical_profile_page_new.dart | 2 +- .../appointment_services/GetDoctorsList.dart | 19 ++++++- .../medical/time_line_new_widget.dart | 56 ++++++++++++++----- 5 files changed, 99 insertions(+), 25 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index b73b0c16..0ad2285e 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -21,9 +21,9 @@ var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:4422/'; -// var BASE_URL = 'https://uat.hmgwebservices.com/'; +var BASE_URL = 'https://uat.hmgwebservices.com/'; // var BASE_URL = 'https://hmgwebservices.com/'; - var BASE_URL = 'http://10.20.200.111:1010/'; +// var BASE_URL = 'http://10.20.200.111:1010/'; // var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; @@ -344,7 +344,7 @@ var UPDATE_COVID_QUESTIONNAIRE = 'Services/Doctors.svc/REST/COVID19_Questionnari var CHANNEL = 3; var GENERAL_ID = 'Cs2020@2016\$2958'; var IP_ADDRESS = '10.20.10.20'; -var VERSION_ID = 12.5; +var VERSION_ID = 12.6; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index ac1eb6f8..1c4c111b 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -100,6 +100,7 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { _tabController = TabController(length: 2, vsync: this); WidgetsBinding.instance.addPostFrameCallback((_) { getPatientAppointmentHistory(); + getAncillaryOrders(); }); super.initState(); imagesInfo @@ -831,6 +832,36 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { obGyneProcedureListResponse: obGyneProcedureListResponse))); } + getAncillaryOrders() { + DoctorsListService service = new DoctorsListService(); + service.getAncillaryOrders().then((res) { + if (res['MessageStatus'] == 1) { + if (res['AncillaryOrderList'].length != 0) { + res['AncillaryOrderList'].forEach((v) { + ancillaryLists.add(new AncillaryOrdersListModel.fromJson(v)); + }); + } + // if (res['AncillaryOrderList'].length != 0) { + // res['AncillaryOrderList'].forEach((item) { + // ancillaryLists.add(AncillaryOrdersListModel.fromJson(item)); + // }); + // } + // dataLoaded = true; + // if (widget.isFromMyAppointments) { + // performNextAction(widget.appointment); + // widget.isFromMyAppointments = false; + // } + setState(() {}); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + print(err); + GifLoaderDialogUtils.hideDialog(context); + err != null ?? AppToast.showErrorToast(message: err); + }); + } + getPatientAppointmentHistory() async { int languageID = projectViewModel.isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); @@ -845,11 +876,11 @@ class _ToDoState extends State with SingleTickerProviderStateMixin { appoList.add(new AppoitmentAllHistoryResultList.fromJson(v)); }); } - if (res['AncillaryOrderList'].length != 0) { - res['AncillaryOrderList'].forEach((item) { - ancillaryLists.add(AncillaryOrdersListModel.fromJson(item)); - }); - } + // if (res['AncillaryOrderList'].length != 0) { + // res['AncillaryOrderList'].forEach((item) { + // ancillaryLists.add(AncillaryOrdersListModel.fromJson(item)); + // }); + // } dataLoaded = true; if (widget.isFromMyAppointments) { performNextAction(widget.appointment); diff --git a/lib/pages/medical/medical_profile_page_new.dart b/lib/pages/medical/medical_profile_page_new.dart index e505e47e..f8f6499e 100644 --- a/lib/pages/medical/medical_profile_page_new.dart +++ b/lib/pages/medical/medical_profile_page_new.dart @@ -46,7 +46,7 @@ class _MedicalProfilePageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - TimeLineView(model.isLogin, projectViewModel.isArabic, model.appoitmentAllHistoryResultList), + TimeLineView(model.isLogin, projectViewModel.isArabic, model.appoitmentAllHistoryResultList, model), SizedBox( height: 20, ), diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index b85ec599..f5022dc5 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -175,7 +175,7 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - Future getDoctorsRating(int docID,int languageID, context) async { + Future getDoctorsRating(int docID, int languageID, context) async { Map request; Request req = appGlobal.getPublicRequest(); @@ -226,7 +226,7 @@ class DoctorsListService extends BaseService { return Future.value(images); } - Future getDoctorsRatingDetails(int docID,int languageID, context) async { + Future getDoctorsRatingDetails(int docID, int languageID, context) async { Map request; Request req = appGlobal.getPublicRequest(); @@ -1790,6 +1790,21 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + Future getAncillaryOrders() async { + Map body = Map(); + + hasError = false; + dynamic localRes; + await baseAppClient.post(GET_ANCILLARY_ORDERS, onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + + return Future.value(localRes); + } + Future getPayfortSDKTokenForPayment(String deviceID, String signatureValue, {bool isTest = true}) async { Map request; request = {"service_command": "SDK_TOKEN", "access_code": "BsM6He4FMBaZ86W64kjZ", "merchant_identifier": "ipxnRXXq", "language": "en", "device_id": deviceID, "signature": signatureValue}; diff --git a/lib/widgets/data_display/medical/time_line_new_widget.dart b/lib/widgets/data_display/medical/time_line_new_widget.dart index 0f5f9195..a15eecd4 100644 --- a/lib/widgets/data_display/medical/time_line_new_widget.dart +++ b/lib/widgets/data_display/medical/time_line_new_widget.dart @@ -2,6 +2,7 @@ import 'package:auto_size_text/auto_size_text.dart'; import 'package:diplomaticquarterapp/analytics/google-analytics.dart'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/medical_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; @@ -25,8 +26,9 @@ import 'package:provider/provider.dart'; class TimeLineView extends StatefulWidget { bool isLogged, isArabic; List appoitmentAllHistoryResultList; + MedicalViewModel medicalViewModel; - TimeLineView(this.isLogged, this.isArabic, this.appoitmentAllHistoryResultList); + TimeLineView(this.isLogged, this.isArabic, this.appoitmentAllHistoryResultList, this.medicalViewModel); @override _TimeLineViewState createState() => _TimeLineViewState(); @@ -38,17 +40,31 @@ class _TimeLineViewState extends State { DateObj selectedDateObj = null; final authService = new auth.AuthProvider(); + static const _scrollThreshold = 1.00; + ScrollController _scrollController; + + bool isAllAppointmentsLoaded = false; + + @override + void dispose() { + _scrollController.removeListener(_scrollListener); + _scrollController.dispose(); + super.dispose(); + } + @override void initState() { super.initState(); + _scrollController = ScrollController(); + _scrollController.addListener(_scrollListener); dateObjs.add(new DateObj(0, 0, widget.isArabic ? "الكل" : "All")); - for (int i = 0; i < widget.appoitmentAllHistoryResultList.length; i++) { - tempList.add(widget.appoitmentAllHistoryResultList[i]); + for (int i = 0; i < widget.medicalViewModel.appoitmentAllHistoryResultList.length; i++) { + tempList.add(widget.medicalViewModel.appoitmentAllHistoryResultList[i]); dateObjs.add(new DateObj( - DateUtil.convertStringToDate(widget.appoitmentAllHistoryResultList[i].appointmentDate).month, - DateUtil.convertStringToDate(widget.appoitmentAllHistoryResultList[i].appointmentDate).year, + DateUtil.convertStringToDate(widget.medicalViewModel.appoitmentAllHistoryResultList[i].appointmentDate).month, + DateUtil.convertStringToDate(widget.medicalViewModel.appoitmentAllHistoryResultList[i].appointmentDate).year, DateUtil.getMonthYearLangDateFormatted( - DateUtil.convertStringToDate(widget.appoitmentAllHistoryResultList[i].appointmentDate), + DateUtil.convertStringToDate(widget.medicalViewModel.appoitmentAllHistoryResultList[i].appointmentDate), widget.isArabic ? "ar" : "en", ))); } @@ -61,20 +77,31 @@ class _TimeLineViewState extends State { // } } + void _scrollListener() async { + if (_scrollController.offset >= _scrollController.position.maxScrollExtent * _scrollThreshold && !_scrollController.position.outOfRange) { + print('Scroll position is at ${_scrollThreshold * 100}%.'); + if(!isAllAppointmentsLoaded) { + await sharedPref.remove(APPOINTMENT_HISTORY_MEDICAL); + widget.medicalViewModel.getAppointmentHistory(isForTimeLine: false); + isAllAppointmentsLoaded = true; + } + } + } + applyFilter(bool isAll) { tempList.clear(); if (isAll) { - for (int i = 0; i < widget.appoitmentAllHistoryResultList.length; i++) { - tempList.add(widget.appoitmentAllHistoryResultList[i]); + for (int i = 0; i < widget.medicalViewModel.appoitmentAllHistoryResultList.length; i++) { + tempList.add(widget.medicalViewModel.appoitmentAllHistoryResultList[i]); } } else { - for (int i = 0; i < widget.appoitmentAllHistoryResultList.length; i++) { + for (int i = 0; i < widget.medicalViewModel.appoitmentAllHistoryResultList.length; i++) { if (DateUtil.getMonthYearLangDateFormatted( - DateUtil.convertStringToDate(widget.appoitmentAllHistoryResultList[i].appointmentDate), + DateUtil.convertStringToDate(widget.medicalViewModel.appoitmentAllHistoryResultList[i].appointmentDate), widget.isArabic ? "ar" : "en", ) == selectedDateObj.monthYear) { - tempList.add(widget.appoitmentAllHistoryResultList[i]); + tempList.add(widget.medicalViewModel.appoitmentAllHistoryResultList[i]); } } } @@ -182,6 +209,7 @@ class _TimeLineViewState extends State { scrollDirection: Axis.horizontal, shrinkWrap: false, physics: BouncingScrollPhysics(), + controller: _scrollController, separatorBuilder: (BuildContext context, int index) { return mWidth(8); }, @@ -244,9 +272,9 @@ class _TimeLineViewState extends State { height: MediaQuery.of(context).size.width / 14, width: MediaQuery.of(context).size.width / (widget.isArabic ? 4 : 6), child: CustomTextButton( - shape: cardRadiusNew(8), - elevation: 0, - backgroundColor: Color(0xFFFBF2E31), + shape: cardRadiusNew(8), + elevation: 0, + backgroundColor: Color(0xFFFBF2E31), onPressed: () { // onLoginClick(); login(); From d6dacfb743d60ada05ae45a0358b74bc73e6b126 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 27 Feb 2024 12:13:55 +0300 Subject: [PATCH 8/9] Load more added in appointments timeline. --- lib/config/localized_values.dart | 1 + .../medical/medical_view_model.dart | 5 +- lib/core/viewModels/project_view_model.dart | 8 ++ lib/uitl/translations_delegate_base.dart | 1 + .../medical/time_line_new_widget.dart | 105 +++++++++++------- lib/widgets/drawer/app_drawer_widget.dart | 2 + 6 files changed, 81 insertions(+), 41 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 6bd06889..f05b94f3 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1907,4 +1907,5 @@ const Map localizedValues = { "upcoming": {"en": "Upcoming", "ar": "المواعيد القادمة"}, "noUpcomingAppointment": {"en": "No upcoming appointments", "ar": "لا توجد مواعيد القادمة"}, "locationTimeoutError": {"en": "Unable to fetch your location, Please try again.", "ar": "غير قادر على جلب موقعك، يرجى المحاولة مرة أخرى."}, + "loadMore": {"en": "Load More", "ar": "تحميل المزيد"}, }; \ No newline at end of file diff --git a/lib/core/viewModels/medical/medical_view_model.dart b/lib/core/viewModels/medical/medical_view_model.dart index bdf40509..a52af93b 100644 --- a/lib/core/viewModels/medical/medical_view_model.dart +++ b/lib/core/viewModels/medical/medical_view_model.dart @@ -10,8 +10,11 @@ class MedicalViewModel extends BaseViewModel { MedicalService _medicalService = locator(); List get appoitmentAllHistoryResultList => _medicalService.appoitmentAllHistoryResultList; + List get getDoctorScheduleList => _medicalService.doctorScheduleResponse; + List get freeSlots => _medicalService.freeSlots; + getAppointmentHistory({bool isForTimeLine = false}) async { if (authenticatedUserObject.isLogin) { setState(ViewState.Busy); @@ -46,5 +49,5 @@ class MedicalViewModel extends BaseViewModel { } else setState(ViewState.Idle); } - //} +//} } diff --git a/lib/core/viewModels/project_view_model.dart b/lib/core/viewModels/project_view_model.dart index aff0faff..684af151 100644 --- a/lib/core/viewModels/project_view_model.dart +++ b/lib/core/viewModels/project_view_model.dart @@ -38,6 +38,14 @@ class ProjectViewModel extends BaseViewModel { dynamic searchvalue; bool isLogin = false; int laserSelectionDuration; + bool _isAllAppointmentsLoaded = false; + + bool get isAllAppointmentsLoaded => _isAllAppointmentsLoaded; + + void setIsAllAppointmentsLoaded(bool value) { + _isAllAppointmentsLoaded = value; + notifyListeners(); + } double _latitude; double _longitude; diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 0dd0c97d..3ab3fa66 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2916,6 +2916,7 @@ class TranslationBase { String get upcoming => localizedValues["upcoming"][locale.languageCode]; String get noUpcomingAppointment => localizedValues["noUpcomingAppointment"][locale.languageCode]; String get locationTimeoutError => localizedValues["locationTimeoutError"][locale.languageCode]; + String get loadMore => localizedValues["loadMore"][locale.languageCode]; } diff --git a/lib/widgets/data_display/medical/time_line_new_widget.dart b/lib/widgets/data_display/medical/time_line_new_widget.dart index a15eecd4..d2f64dfd 100644 --- a/lib/widgets/data_display/medical/time_line_new_widget.dart +++ b/lib/widgets/data_display/medical/time_line_new_widget.dart @@ -40,23 +40,16 @@ class _TimeLineViewState extends State { DateObj selectedDateObj = null; final authService = new auth.AuthProvider(); - static const _scrollThreshold = 1.00; - ScrollController _scrollController; - - bool isAllAppointmentsLoaded = false; + ProjectViewModel projectViewModel; @override void dispose() { - _scrollController.removeListener(_scrollListener); - _scrollController.dispose(); super.dispose(); } @override void initState() { super.initState(); - _scrollController = ScrollController(); - _scrollController.addListener(_scrollListener); dateObjs.add(new DateObj(0, 0, widget.isArabic ? "الكل" : "All")); for (int i = 0; i < widget.medicalViewModel.appoitmentAllHistoryResultList.length; i++) { tempList.add(widget.medicalViewModel.appoitmentAllHistoryResultList[i]); @@ -77,17 +70,6 @@ class _TimeLineViewState extends State { // } } - void _scrollListener() async { - if (_scrollController.offset >= _scrollController.position.maxScrollExtent * _scrollThreshold && !_scrollController.position.outOfRange) { - print('Scroll position is at ${_scrollThreshold * 100}%.'); - if(!isAllAppointmentsLoaded) { - await sharedPref.remove(APPOINTMENT_HISTORY_MEDICAL); - widget.medicalViewModel.getAppointmentHistory(isForTimeLine: false); - isAllAppointmentsLoaded = true; - } - } - } - applyFilter(bool isAll) { tempList.clear(); if (isAll) { @@ -110,6 +92,7 @@ class _TimeLineViewState extends State { @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return Container( width: double.infinity, height: 210, @@ -192,28 +175,70 @@ class _TimeLineViewState extends State { ), mFlex(1), widget.isLogged - ? Container( - height: widget.isArabic ? 130 : 110, - width: double.infinity, - child: ListView.separated( - itemBuilder: (context, index) => Padding( - padding: widget.isArabic - ? EdgeInsets.only(left: index == 0 ? 0 : 12, right: (tempList.length - 1) == index ? 0 : 12) - : EdgeInsets.only(left: index == 0 ? 12 : 0, right: (tempList.length - 1) == index ? 12 : 0), - child: TimelineNewWidget( - appoitmentAllHistoryResul: tempList[index], - isLast: tempList.length - 1 == index ? true : false, + ? Row( + children: [ + Container( + height: widget.isArabic ? 130 : 110, + // width: double.infinity, + width: MediaQuery.of(context).size.width, + child: ListView.separated( + itemBuilder: (context, index) => Padding( + padding: widget.isArabic + ? EdgeInsets.only(left: index == 0 ? 0 : 12, right: (tempList.length - 1) == index ? 0 : 12) + : EdgeInsets.only(left: index == 0 ? 12 : 0, right: (tempList.length - 1) == index ? 12 : 0), + child: index < tempList.length + ? TimelineNewWidget( + appoitmentAllHistoryResul: tempList[index], + isLast: tempList.length - 1 == index ? true : false, + ) + : !projectViewModel.isAllAppointmentsLoaded + ? InkWell( + onTap: () async { + await sharedPref.remove(APPOINTMENT_HISTORY_MEDICAL); + widget.medicalViewModel.getAppointmentHistory(isForTimeLine: false); + projectViewModel.setIsAllAppointmentsLoaded(true); + }, + child: Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + mHeight(22.0), + Container( + child: Icon( + Icons.arrow_forward_outlined, + color: CustomColors.white, + size: 30, + ), + ), + mHeight(6.0), + Text( + TranslationBase.of(context).loadMore, + style: TextStyle( + color: CustomColors.white, + fontSize: 10, + fontWeight: FontWeight.w600, + letterSpacing: -0.36, + ), + ), + ], + ), + mWidth(24.0) + ], + ), + ) + : Container(), + ), + itemCount: (tempList.length + 1), + scrollDirection: Axis.horizontal, + shrinkWrap: false, + physics: BouncingScrollPhysics(), + separatorBuilder: (BuildContext context, int index) { + return index < tempList.length ? mWidth(8) : Container(); + }, ), ), - itemCount: tempList.length, - scrollDirection: Axis.horizontal, - shrinkWrap: false, - physics: BouncingScrollPhysics(), - controller: _scrollController, - separatorBuilder: (BuildContext context, int index) { - return mWidth(8); - }, - ), + ], ) : Container(), ], @@ -344,7 +369,7 @@ class TimelineNewWidget extends StatelessWidget { Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return Container( - width: MediaQuery.of(context).size.width / 2.3, + width: isLast ? MediaQuery.of(context).size.width / 3.5 : MediaQuery.of(context).size.width / 2.5, child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index bbc1e55f..f16e3cbc 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -338,6 +338,7 @@ class _AppDrawerState extends State { sharedPref.remove(APPOINTMENT_HISTORY_MEDICAL); sharedPref.remove(CLINICS_LIST); sharedPref.setBool(IS_ROBOT_INIT, null); + projectProvider.setIsAllAppointmentsLoaded(false); if (projectProvider.isArabic) { projectProvider.changeLanguage('en'); locator().hamburgerMenu.logMenuItemClick('change language to english'); @@ -608,6 +609,7 @@ class _AppDrawerState extends State { await sharedPref.clear(); await sharedPref.setString(APP_LANGUAGE, appLanguage); await sharedPref.remove(APPOINTMENT_HISTORY_MEDICAL); + projectProvider.setIsAllAppointmentsLoaded(false); this.user = null; Navigator.of(context).pushNamed(HOME); locator().hamburgerMenu.logMenuItemClick('logout'); From 2ebaed4841395e19664ed061911827d2ef667e0b Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 27 Feb 2024 14:45:10 +0300 Subject: [PATCH 9/9] label updated --- lib/pages/medical/eye/ContactLensPage.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pages/medical/eye/ContactLensPage.dart b/lib/pages/medical/eye/ContactLensPage.dart index 49db73b8..ba6d91dc 100644 --- a/lib/pages/medical/eye/ContactLensPage.dart +++ b/lib/pages/medical/eye/ContactLensPage.dart @@ -52,7 +52,7 @@ class ContactLensPage extends StatelessWidget { getRow('OZ', '${listHISGetContactLensPerscription.oZ}'), getRow('CT', '${listHISGetContactLensPerscription.cT}'), getRow('Blend', '${listHISGetContactLensPerscription.blend}'), - getRow(TranslationBase.of(context).reminder, '${listHISGetContactLensPerscription.remarks}', isLast: true), + getRow(TranslationBase.of(context).remarks, '${listHISGetContactLensPerscription.remarks}', isLast: true), ], ), ), @@ -84,7 +84,7 @@ class ContactLensPage extends StatelessWidget { getRow('OZ', '${listHISGetContactLensPerscription.oZ}'), getRow('CT', '${listHISGetContactLensPerscription.cT}'), getRow('Blend', '${listHISGetContactLensPerscription.blend}'), - getRow(TranslationBase.of(context).reminder, '${listHISGetContactLensPerscription.remarks}', isLast: true), + getRow(TranslationBase.of(context).remarks, '${listHISGetContactLensPerscription.remarks}', isLast: true), ], ), ),