From 9f2beceb228cf6b0d8de69965b6090dd6e4092c9 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Thu, 5 Nov 2020 08:56:41 +0200 Subject: [PATCH 1/8] First step from notifications_page --- lib/config/config.dart | 3 +- lib/config/localized_values.dart | 1 + .../get_notifications_request_model.dart | 22 +++ .../get_notifications_response_model.dart | 96 ++++++++++++ lib/core/service/notifications_service.dart | 22 +++ .../viewModels/notifications_view_model.dart | 25 ++++ lib/locator.dart | 13 +- .../all_habib_medical_service_page.dart | 2 +- .../family/add-family-member.dart | 3 +- .../family/add-family_type.dart | 0 .../{ => DrawerPages}/family/my-family.dart | 0 lib/pages/DrawerPages/notifications_page.dart | 89 +++++++++++ .../pharmacy_for_prescriptions_page.dart | 138 +++++++++--------- lib/routes.dart | 6 +- lib/uitl/translations_delegate_base.dart | 1 + lib/widgets/drawer/app_drawer_widget.dart | 11 +- .../others/floating_button_search.dart | 2 +- 17 files changed, 346 insertions(+), 88 deletions(-) create mode 100644 lib/core/model/notifications/get_notifications_request_model.dart create mode 100644 lib/core/model/notifications/get_notifications_response_model.dart create mode 100644 lib/core/service/notifications_service.dart create mode 100644 lib/core/viewModels/notifications_view_model.dart rename lib/pages/{ => DrawerPages}/family/add-family-member.dart (99%) rename lib/pages/{ => DrawerPages}/family/add-family_type.dart (100%) rename lib/pages/{ => DrawerPages}/family/my-family.dart (100%) create mode 100644 lib/pages/DrawerPages/notifications_page.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 9bca1b94..1577186a 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -339,7 +339,8 @@ const PATIENT_ER_UPDATE_PRES_ORDER ="Services/Patients.svc/REST/PatientER_Update const GET_ORDER_DETAIL_BY_ID ="Services/Patients.svc/REST/PatientER_HHC_GetTransactionsForOrder"; const GET_CMC_ORDER_DETAIL_BY_ID ="Services/Patients.svc/REST/PatientER_CMC_GetTransactionsForOrder"; const GET_CHECK_UP_ITEMS ="Services/Patients.svc/REST/GetCheckUpItems"; - +const PUSH_NOTIFICATION_GET_ALL_NOTIFICATIONS = + 'Services/MobileNotifications.svc/REST/PushNotification_GetAllNotifications'; const TIMER_MIN = 10; const GOOGLE_API_KEY = "AIzaSyCmevVlr2Bh-c8W1VUzo8gt8JRY7n5PANw"; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 8a934bf6..0ef677e0 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -676,5 +676,6 @@ const Map> localizedValues = { "Book": {"en": "Book", "ar": "احجز"}, "AppointmentLabel": {"en": "Appointment", "ar": "موعد"}, "BloodType": {"en": "Blood Type", "ar": "فصيلة الدم"}, + "notifications": {"en": "Notifications", "ar": "إشعارات"}, }; diff --git a/lib/core/model/notifications/get_notifications_request_model.dart b/lib/core/model/notifications/get_notifications_request_model.dart new file mode 100644 index 00000000..9659754a --- /dev/null +++ b/lib/core/model/notifications/get_notifications_request_model.dart @@ -0,0 +1,22 @@ +class GetNotificationsRequestModel { + int notificationStatusID; + int pagingSize; + int currentPage; + + GetNotificationsRequestModel( + {this.notificationStatusID, this.pagingSize, this.currentPage}); + + GetNotificationsRequestModel.fromJson(Map json) { + notificationStatusID = json['NotificationStatusID']; + pagingSize = json['pagingSize']; + currentPage = json['currentPage']; + } + + Map toJson() { + final Map data = new Map(); + data['NotificationStatusID'] = this.notificationStatusID; + data['pagingSize'] = this.pagingSize; + data['currentPage'] = this.currentPage; + return data; + } +} diff --git a/lib/core/model/notifications/get_notifications_response_model.dart b/lib/core/model/notifications/get_notifications_response_model.dart new file mode 100644 index 00000000..1f3bbc28 --- /dev/null +++ b/lib/core/model/notifications/get_notifications_response_model.dart @@ -0,0 +1,96 @@ +class GetNotificationsResponseModel { + int id; + int recordId; + int patientID; + bool projectOutSA; + String deviceType; + String deviceToken; + String message; + String messageType; + String messageTypeData; + dynamic videoURL; + bool isQueue; + String isQueueOn; + String createdOn; + String createdBy; + String notificationType; + bool isSent; + String isSentOn; + bool isRead; + String isReadOn; + int channelID; + int projectID; + + GetNotificationsResponseModel( + {this.id, + this.recordId, + this.patientID, + this.projectOutSA, + this.deviceType, + this.deviceToken, + this.message, + this.messageType, + this.messageTypeData, + this.videoURL, + this.isQueue, + this.isQueueOn, + this.createdOn, + this.createdBy, + this.notificationType, + this.isSent, + this.isSentOn, + this.isRead, + this.isReadOn, + this.channelID, + this.projectID}); + + GetNotificationsResponseModel.fromJson(Map json) { + id = json['Id']; + recordId = json['RecordId']; + patientID = json['PatientID']; + projectOutSA = json['ProjectOutSA']; + deviceType = json['DeviceType']; + deviceToken = json['DeviceToken']; + message = json['Message']; + messageType = json['MessageType']; + messageTypeData = json['MessageTypeData']; + videoURL = json['VideoURL']; + isQueue = json['IsQueue']; + isQueueOn = json['IsQueueOn']; + createdOn = json['CreatedOn']; + createdBy = json['CreatedBy']; + notificationType = json['NotificationType']; + isSent = json['IsSent']; + isSentOn = json['IsSentOn']; + isRead = json['IsRead']; + isReadOn = json['IsReadOn']; + channelID = json['ChannelID']; + projectID = json['ProjectID']; + } + + Map toJson() { + final Map data = new Map(); + data['Id'] = this.id; + data['RecordId'] = this.recordId; + data['PatientID'] = this.patientID; + data['ProjectOutSA'] = this.projectOutSA; + data['DeviceType'] = this.deviceType; + data['DeviceToken'] = this.deviceToken; + data['Message'] = this.message; + data['MessageType'] = this.messageType; + data['MessageTypeData'] = this.messageTypeData; + data['VideoURL'] = this.videoURL; + data['IsQueue'] = this.isQueue; + data['IsQueueOn'] = this.isQueueOn; + data['CreatedOn'] = this.createdOn; + data['CreatedBy'] = this.createdBy; + data['NotificationType'] = this.notificationType; + data['IsSent'] = this.isSent; + data['IsSentOn'] = this.isSentOn; + data['IsRead'] = this.isRead; + data['IsReadOn'] = this.isReadOn; + data['ChannelID'] = this.channelID; + data['ProjectID'] = this.projectID; + return data; + } +} diff --git a/lib/core/service/notifications_service.dart b/lib/core/service/notifications_service.dart new file mode 100644 index 00000000..f8c8a211 --- /dev/null +++ b/lib/core/service/notifications_service.dart @@ -0,0 +1,22 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_response_model.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; + +class NotificationService extends BaseService { + List notificationsList = List(); + + Future getAllNotifications(GetNotificationsRequestModel getNotificationsRequestModel ) async { + hasError = false; + await baseAppClient.post(PUSH_NOTIFICATION_GET_ALL_NOTIFICATIONS, + onSuccess: (dynamic response, int statusCode) { + notificationsList.clear(); + response['List_GetAllNotificationsFromPool'].forEach((appoint) { + notificationsList.add(GetNotificationsResponseModel.fromJson(appoint)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getNotificationsRequestModel.toJson()); + } +} diff --git a/lib/core/viewModels/notifications_view_model.dart b/lib/core/viewModels/notifications_view_model.dart new file mode 100644 index 00000000..30cd63d9 --- /dev/null +++ b/lib/core/viewModels/notifications_view_model.dart @@ -0,0 +1,25 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_request_model.dart'; +import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_response_model.dart'; +import 'package:diplomaticquarterapp/core/service/notifications_service.dart'; + +import '../../locator.dart'; +import 'base_view_model.dart'; + +class NotificationViewModel extends BaseViewModel { + NotificationService _notificationService = + locator(); + + List get notifications => _notificationService.notificationsList; + + Future getNotifications() async { + setState(ViewState.Busy); + GetNotificationsRequestModel getNotificationsRequestModel = new GetNotificationsRequestModel(currentPage: 0,pagingSize: 14,notificationStatusID: 2); + await _notificationService.getAllNotifications(getNotificationsRequestModel); + if (_notificationService.hasError) { + error = _notificationService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} \ No newline at end of file diff --git a/lib/locator.dart b/lib/locator.dart index a71d7964..d13d4057 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -42,6 +42,7 @@ import 'core/service/medical/prescriptions_service.dart'; import 'core/service/medical/radiology_service.dart'; import 'core/service/medical/reports_monthly_service.dart'; import 'core/service/medical/vital_sign_service.dart'; +import 'core/service/notifications_service.dart'; import 'core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; import 'core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; import 'core/viewModels/appointment_rate_view_model.dart'; @@ -74,6 +75,7 @@ import 'core/viewModels/medical/reports_monthly_view_model.dart'; import 'core/viewModels/medical/vital_sign_view_model.dart'; import 'core/viewModels/medical/reports_view_model.dart'; import 'core/viewModels/medical/weight_pressure_view_model.dart'; +import 'core/viewModels/notifications_view_model.dart'; import 'core/viewModels/pharmacies_view_model.dart'; import 'core/service/pharmacies_service.dart'; import 'core/service/insurance_service.dart'; @@ -110,8 +112,6 @@ void setupLocator() { locator.registerLazySingleton(() => EReferralService()); locator.registerLazySingleton(() => HomeHealthCareService()); locator.registerLazySingleton(() => CMCService()); - - locator.registerLazySingleton(() => PatientSickLeaveService()); locator.registerLazySingleton(() => MyBalanceService()); locator.registerLazySingleton(() => BloodSugarService()); @@ -124,17 +124,14 @@ void setupLocator() { locator.registerLazySingleton(() => FindusService()); locator.registerLazySingleton(() => LiveChatService()); locator.registerLazySingleton(() => H2OService()); - locator.registerLazySingleton(() => BloodDonationService()); locator.registerLazySingleton(() => BloodDetailsService()); locator.registerLazySingleton(() => ChildVaccinesService()); locator.registerLazySingleton(() => UserInformationService()); locator.registerLazySingleton(() => CreteNewBabyService()); locator.registerLazySingleton(() => DeleteBabyService()); - - - locator.registerLazySingleton(() => VaccinationTableService()); + locator.registerLazySingleton(() => NotificationService()); /// View Model @@ -166,9 +163,6 @@ void setupLocator() { locator.registerFactory(() => ChildVaccinesViewModel()); locator.registerFactory(() => UserInformationViewModel()); locator.registerFactory(() => VaccinationTableViewModel()); - - - locator.registerFactory(() => AddNewChildViewModel()); locator.registerFactory(() => H2OViewModel()); locator.registerFactory(() => BloodSugarViewMode()); @@ -180,5 +174,6 @@ void setupLocator() { locator.registerFactory(() => AllergiesViewModel()); locator.registerFactory(() => HomeHealthCareViewModel()); locator.registerFactory(() => CMCViewModel()); + locator.registerFactory(() => NotificationViewModel()); } diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart index 05919209..a5fcfd27 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart @@ -11,9 +11,9 @@ import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/BookingOptions.dart'; import 'package:diplomaticquarterapp/pages/ChildVaccines/child_vaccines_page.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/findus/findus_page.dart'; +import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart'; import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; -import 'package:diplomaticquarterapp/pages/family/my-family.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/medical/medical_profile_page.dart'; diff --git a/lib/pages/family/add-family-member.dart b/lib/pages/DrawerPages/family/add-family-member.dart similarity index 99% rename from lib/pages/family/add-family-member.dart rename to lib/pages/DrawerPages/family/add-family-member.dart index 98df5f88..35b19ccd 100644 --- a/lib/pages/family/add-family-member.dart +++ b/lib/pages/DrawerPages/family/add-family-member.dart @@ -3,7 +3,6 @@ import 'package:diplomaticquarterapp/core/model/family-file/add_family_file_requ import 'package:diplomaticquarterapp/core/model/family-file/insert_share_file_request.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; -import 'package:diplomaticquarterapp/pages/family/add-family_type.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -20,6 +19,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'add-family_type.dart'; + class AddMember extends StatefulWidget { @override _AddMember createState() => _AddMember(); diff --git a/lib/pages/family/add-family_type.dart b/lib/pages/DrawerPages/family/add-family_type.dart similarity index 100% rename from lib/pages/family/add-family_type.dart rename to lib/pages/DrawerPages/family/add-family_type.dart diff --git a/lib/pages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart similarity index 100% rename from lib/pages/family/my-family.dart rename to lib/pages/DrawerPages/family/my-family.dart diff --git a/lib/pages/DrawerPages/notifications_page.dart b/lib/pages/DrawerPages/notifications_page.dart new file mode 100644 index 00000000..4e6e7e42 --- /dev/null +++ b/lib/pages/DrawerPages/notifications_page.dart @@ -0,0 +1,89 @@ +import 'package:diplomaticquarterapp/core/viewModels/notifications_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +class NotificationsPage extends StatelessWidget { + getDateForm(String date) { + DateTime d = DateUtil.convertStringToDate(date); + String monthName = DateUtil.getMonth(d.month).toString(); + TimeOfDay timeOfDay = TimeOfDay(hour: d.hour, minute: d.minute); + String minute = timeOfDay.minute < 10 + ? timeOfDay.minute.toString().padLeft(2, '0') + : timeOfDay.minute.toString(); + + String hour = '${timeOfDay.hourOfPeriod}:$minute'; + if (timeOfDay.period == DayPeriod.am) { + hour = hour + "AM"; + } else { + { + hour = hour + "PM"; + } + } + + //DayPeriod.am + return monthName + ',${d.day},${d.year}, $hour'; + } + + @override + Widget build(BuildContext context) { + var prescriptionReport; + return BaseView( + onModelReady: (model) => model.getNotifications(), + builder: (_, model, widget) => AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).notifications, + baseViewModel: model, + body: ListView.builder( + itemBuilder: (context, index) => Container( + width: double.infinity, + margin: EdgeInsets.only(top: 5, left: 10, right: 10, bottom: 5), + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all( + color: model.notifications[index].isRead + ? Colors.grey[200] + : Theme.of(context).primaryColor, + width: 0.5), + ), + child: Row( + children: [ + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + getDateForm(model.notifications[index].createdOn)), + SizedBox( + height: 5, + ), + Texts(model.notifications[index].message), + SizedBox( + height: 5, + ), + Texts(model.notifications[index].notificationType), + ], + ), + ), + ), + SizedBox( + width: 15, + ), + ], + ), + ), + itemCount: model.notifications.length, + ), + ), + ); + } +} diff --git a/lib/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart b/lib/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart index c2f70091..00db8f8c 100644 --- a/lib/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart +++ b/lib/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart @@ -15,86 +15,86 @@ class PharmacyForPrescriptionsPage extends StatelessWidget { @override Widget build(BuildContext context) { - return BaseView( - onModelReady: (model) => model.getListPharmacyForPrescriptions(itemId: prescriptionReport.itemID), - builder: (_, model, widget) => AppScaffold( - isShowAppBar: true, - appBarTitle: 'Title', - baseViewModel: model, - body: ListView.builder( - itemBuilder: (context, index) => Container( - width: double.infinity, - margin: EdgeInsets.only(top: 10, left: 10, right: 10), - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - border: Border.all(color: Colors.grey[200], width: 0.5), - ), - child: Row( - children: [ - ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(5)), - child: Image.network( - model.pharmacyPrescriptionsList[index].projectImageURL, - fit: BoxFit.cover, - width: 60, - height: 70, - ), + return BaseView( + onModelReady: (model) => model.getListPharmacyForPrescriptions(itemId: prescriptionReport.itemID), + builder: (_, model, widget) => AppScaffold( + isShowAppBar: true, + appBarTitle: 'Title', + baseViewModel: model, + body: ListView.builder( + itemBuilder: (context, index) => Container( + width: double.infinity, + margin: EdgeInsets.only(top: 10, left: 10, right: 10), + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), ), - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts(model.pharmacyPrescriptionsList[index] - .locationDescription), - SizedBox( - height: 5, - ), - Texts(model.pharmacyPrescriptionsList[index].cityName), - ], + border: Border.all(color: Colors.grey[200], width: 0.5), + ), + child: Row( + children: [ + ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(5)), + child: Image.network( + model.pharmacyPrescriptionsList[index].projectImageURL, + fit: BoxFit.cover, + width: 60, + height: 70, ), ), - ), - InkWell( - onTap: () { - MapsLauncher.launchCoordinates( - double.parse( - model.pharmacyPrescriptionsList[index].latitude), - double.parse( - model.pharmacyPrescriptionsList[index].longitude)); - }, - child: Icon( - Icons.pin_drop, - size: 18, - color: Colors.red[900], + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(model.pharmacyPrescriptionsList[index] + .locationDescription), + SizedBox( + height: 5, + ), + Texts(model.pharmacyPrescriptionsList[index].cityName), + ], + ), + ), ), - ), - SizedBox( - width: 15, - ), - InkWell( - onTap: Feedback.wrapForTap((){ - launch("tel://${model.pharmacyPrescriptionsList[index].phoneNumber}"); - },context), - child: Container( + InkWell( + onTap: () { + MapsLauncher.launchCoordinates( + double.parse( + model.pharmacyPrescriptionsList[index].latitude), + double.parse( + model.pharmacyPrescriptionsList[index].longitude)); + }, child: Icon( - Icons.call, + Icons.pin_drop, size: 18, color: Colors.red[900], ), ), - ) - ], + SizedBox( + width: 15, + ), + InkWell( + onTap: Feedback.wrapForTap((){ + launch("tel://${model.pharmacyPrescriptionsList[index].phoneNumber}"); + },context), + child: Container( + child: Icon( + Icons.call, + size: 18, + color: Colors.red[900], + ), + ), + ) + ], + ), ), + itemCount: model.pharmacyPrescriptionsList.length, ), - itemCount: model.pharmacyPrescriptionsList.length, ), - ), - ); + ); } } diff --git a/lib/routes.dart b/lib/routes.dart index 8a0619e6..ae2df812 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -1,4 +1,6 @@ -import 'package:diplomaticquarterapp/pages/family/my-family.dart'; +import 'package:diplomaticquarterapp/pages/DrawerPages/family/add-family-member.dart'; +import 'package:diplomaticquarterapp/pages/DrawerPages/family/add-family_type.dart'; +import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/login/confirm-login.dart'; @@ -8,8 +10,6 @@ import 'package:diplomaticquarterapp/pages/login/welcome.dart'; import 'package:diplomaticquarterapp/pages/login/login-type.dart'; import 'package:diplomaticquarterapp/pages/login/login.dart'; import 'package:diplomaticquarterapp/pages/login/register.dart'; -import 'package:diplomaticquarterapp/pages/family/add-family_type.dart'; -import 'package:diplomaticquarterapp/pages/family/add-family-member.dart'; import 'package:diplomaticquarterapp/pages/symptom-checker/info.dart'; import 'package:diplomaticquarterapp/pages/symptom-checker/select-gender.dart'; import 'package:diplomaticquarterapp/pages/symptom-checker/symtom-checker.dart'; diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 4c04474c..64b3a969 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -733,6 +733,7 @@ class TranslationBase { String get bloodType => localizedValues['BloodType'][locale.languageCode]; String get loginToUseService => localizedValues['loginToUseService'][locale.languageCode]; + String get notifications => localizedValues['notifications'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 1a973864..f345f641 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; +import 'package:diplomaticquarterapp/pages/DrawerPages/notifications_page.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; @@ -238,9 +239,13 @@ class _AppDrawerState extends State { .notification, Icons.notifications), onTap: () { - Navigator.of(context).pushNamed( - WELCOME_LOGIN, - ); + //NotificationsPage + Navigator.of(context).pop(); + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + NotificationsPage())); }, ), InkWell( diff --git a/lib/widgets/others/floating_button_search.dart b/lib/widgets/others/floating_button_search.dart index cadfb9cd..2bfacaea 100644 --- a/lib/widgets/others/floating_button_search.dart +++ b/lib/widgets/others/floating_button_search.dart @@ -13,11 +13,11 @@ import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart'; import 'package:diplomaticquarterapp/pages/Blood/my_balance_page.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/findus/findus_page.dart'; +import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart'; import 'package:diplomaticquarterapp/pages/ErService/AmbulanceReq.dart'; import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart'; import 'package:diplomaticquarterapp/pages/ErService/NearestEr.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/MyAppointments.dart'; -import 'package:diplomaticquarterapp/pages/family/my-family.dart'; import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; From 5bd3c7d9ce3895d7b3890b86e965e7b9792d5cff Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Thu, 5 Nov 2020 14:56:17 +0200 Subject: [PATCH 2/8] finish step from notifications_page and create notification_details_page --- assets/images/notf.png | Bin 0 -> 2764 bytes lib/config/config.dart | 2 + lib/config/localized_values.dart | 1 + .../mark_message_as_read_request_model.dart | 15 ++ lib/core/service/notifications_service.dart | 17 +++ .../viewModels/notifications_view_model.dart | 26 +++- .../notification_details_page.dart | 103 +++++++++++++ .../notifications/notifications_page.dart | 142 ++++++++++++++++++ lib/pages/DrawerPages/notifications_page.dart | 89 ----------- lib/uitl/translations_delegate_base.dart | 1 + lib/widgets/drawer/app_drawer_widget.dart | 2 +- 11 files changed, 302 insertions(+), 96 deletions(-) create mode 100644 assets/images/notf.png create mode 100644 lib/core/model/notifications/mark_message_as_read_request_model.dart create mode 100644 lib/pages/DrawerPages/notifications/notification_details_page.dart create mode 100644 lib/pages/DrawerPages/notifications/notifications_page.dart delete mode 100644 lib/pages/DrawerPages/notifications_page.dart diff --git a/assets/images/notf.png b/assets/images/notf.png new file mode 100644 index 0000000000000000000000000000000000000000..39eb3fb3d2d188f99b31b9725540c798a7e96321 GIT binary patch literal 2764 zcmV;-3N!VIP)$lt*p5h>N|QClI&>UoEUk*#j?B>3K)~x#ynuea`!F z-h1z&X$lGo3JMAe3JMAe3JMAe3JMAeS;5AQ8#R~9RgHfx3xz^+*k^?)LP<% z5aqX{HG_cT{P#0v%y>=3l+0r(A>&AWeZ8CgAs7sn?%76=QPrZWi6$prQgU&0i4be^3|vn8MA<^ii(PsraeksU7ZJqGw{#7@X1@? zlM8amLa+yU+vD*tD|rT))t@lWW5hzPp32E$As6HDBo@vfjz^oCn$li@TX_NT`5#ju z7+lj5Sn404@Y6;ztnr3(+Ckcb6%`fprXoED-s0y|SXj8q@_@5v&knP|NQBJVrVGK^ zg~J`N%=gTYkR%OmLCSnnHZw0=@26xze~x(+SsDy0>(6AhHD^l@O!_-Gd^8zE2(0FH zSllJqkOMBC$ zxrF6Co+OrhOswQaGiFu*0{%-T9})G1W!yyE!I84EvSJH@1<>BiCK;UNKM$ojEX=tI z2R_MQ#myx~VhP#-!?6sz+ht_JAMD@1-yxaQA!11nSP54cXV+Aa!L8W)thiTrlIMu7 z_DbThpM(HLUX9UUu1j^n?rO<~@p>ZI(T0Wwk6FRsHtv~9GPv5;4=q?p810OvuQXRn zy8nfElV2LT2s(aBPOK8G4t(E2`u*C1K#On~&ILkX-JMu`0Sgwsomkt`l7+sQ=Sg?yL) zJagvEJtC&Z#>N_mIc_&A0misb%RR6RbCrcSxPvJE`;va|5FIQ^ReKrY7#tM2D@=F+ zZ=$&P`xXSBpU5A&bqH>DR4W zcNqFO#ksJ#qA@_gC&aR9goHrRy4$p)qoad#u=e(LR`D(1`t+I=wxy+Ip_cpb@^TvI zaqKH)4-XGl@7S@UoOX)EVy6iq3uFTxfcO5tv&!v7)19XB>@2LpHDwt+TVU!a^MR zgqX|(D+`4}XXt4{La=iAI!^b(g$u{%V1t8$x|=Ytkkb}q_1J+BEWQ%6=L`%CoFE*~7*tBVr%(q@NqyGLOEl&Y=W91Q|FG!`sE9f(5h!B1PV0O&N z)#0+nGzFcPN@XG1#AnCEgdi)pz^!~)>0pSsxkAN(I36(c^z;mf@)|>gAlUZtWfw^f zeU=2Ra>aozs8^D`-H2c>7cfK!PLA^KkH(7xJ|iw`fucbd)N4o>7!~a0Dv4{03kjiQ zA*fdiHZ^hbd6A+)R}#{#{$McJA;~fwT(#qbY#;I&VYiHqG;7wZkNBX3b3%%WizT~Ld|LS?%nMBPCkyEJ$v?B$~eA^AM=TaX_IU? zb%oWwzP|H9LXa_a5sUe{Xh0CRn_Tz@ijFV!a6A9m<#O#4^}~X0({S8 zLNci3qSO~ewUK@e)13_V1P%1Clnc}YaA6ZHWW$CHP7rb>M`G{l)vKfO)XM49J^D|J ziQGW%k$7XK5SMo`1j?@^`gm2;4_0%nroa9DymTLuQ1m|H#%`4m_b+nZ-P74ZhK7b# z5q%txbiIyvmk&}g-9VUrMPea~$%^WNIXb4Jg}{sWHT}~%BcyWv)jkCaxt+g;-|w$X zwYgzd6Xi~dC*CuZ#S-59ZZ}BCy>=i3i_;JxQ1S*%|A55HqJCck$Tf}`x=oDL|FmY{ zT?SnE4o!b|>|M4`F|w((2_Y*}2~t*8#>z{&A1v_se8N`}JRVOIA?`t=F7Z}E$g854 zS`yFZo+N^-G(h-Y?LY`iic-k}FY!Baj_{$uNF?Hf+=t1Au+|V8V3PU2F7D(Z*^PLR zbq}$UV_K3sf{6!?PuhVH?6+P_rYFeGUW)BD;!U8_2(ga;n0-lTI|=SjNLD*5n|z!g z;}9-@Ky5b+Fc-%*V6$1l?};&Ft0dgp%Lfym_-z;@+EyK7VDluFuK<{CgYy zn1EZ7Wh_VgjgbHa(jKr8A#9PQe2Is>z76>wLCg`p6pKu1E*X>k5QF*qNI2>5#2g<^ zb2sat8%i6rmnNa4vWr;9c1r_+fI2d{sMqTaTb&qI(K4Hn!B+EmxZ$~0Wrp&vCSwlI z1uU}*-}ed$MlV>sd4nMNhTRBBkn)sOnW3+P#5%U6Wo{Ud#gYq&!S=&XF0nEWf_bAI z$r$$xkoz)=Dr|%f$KO=$o-=2TKkYgVR`x>}^yjUut?3ZkYGXp!Vtm1>?5z5M^Y4et zZqjlAn9NE$lfkvdjNenq0w1h+_CGYYW`BH+RbCT|#iE(IKt_LUjitFbJewzEFt7~s zQQQ8oCbE;e^2Al?UYo}5{94nG?)=BmXtYwxGXw&G_P)Np7EM7xL1B8sVTVZ~fL6p} zG3K+qY1GqBR8>{o*wN83q-dXv8jsVtCC$vJNojF%>tZvo^M6OP_Vmch>D)R{kdwm7 z75_F##!Kpd*~x4bfIV<_KVrfuE%|NN;~tOaXLcjQVOL^U@e-S}> localizedValues = { "AppointmentLabel": {"en": "Appointment", "ar": "موعد"}, "BloodType": {"en": "Blood Type", "ar": "فصيلة الدم"}, "notifications": {"en": "Notifications", "ar": "إشعارات"}, + "notificationDetails": {"en": "Notification Details", "ar": "تفاصيل الاشعار"}, }; diff --git a/lib/core/model/notifications/mark_message_as_read_request_model.dart b/lib/core/model/notifications/mark_message_as_read_request_model.dart new file mode 100644 index 00000000..99dab006 --- /dev/null +++ b/lib/core/model/notifications/mark_message_as_read_request_model.dart @@ -0,0 +1,15 @@ +class MarkMessageAsReadRequestModel { + int notificationPoolID; + + MarkMessageAsReadRequestModel({this.notificationPoolID}); + + MarkMessageAsReadRequestModel.fromJson(Map json) { + notificationPoolID = json['NotificationPoolID']; + } + + Map toJson() { + final Map data = new Map(); + data['NotificationPoolID'] = this.notificationPoolID; + return data; + } +} diff --git a/lib/core/service/notifications_service.dart b/lib/core/service/notifications_service.dart index f8c8a211..87081a0f 100644 --- a/lib/core/service/notifications_service.dart +++ b/lib/core/service/notifications_service.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_request_model.dart'; import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/notifications/mark_message_as_read_request_model.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; class NotificationService extends BaseService { @@ -10,6 +11,7 @@ class NotificationService extends BaseService { hasError = false; await baseAppClient.post(PUSH_NOTIFICATION_GET_ALL_NOTIFICATIONS, onSuccess: (dynamic response, int statusCode) { + if(getNotificationsRequestModel.currentPage ==0) notificationsList.clear(); response['List_GetAllNotificationsFromPool'].forEach((appoint) { notificationsList.add(GetNotificationsResponseModel.fromJson(appoint)); @@ -19,4 +21,19 @@ class NotificationService extends BaseService { super.error = error; }, body: getNotificationsRequestModel.toJson()); } + Future markAsRead(MarkMessageAsReadRequestModel markMessageAsReadRequestModel ) async { + hasError = false; + await baseAppClient.post(PUSH_NOTIFICATION_SET_MESSAGES_FROM_POOL_AS_READ, + onSuccess: (dynamic response, int statusCode) { + updateNotification(markMessageAsReadRequestModel.notificationPoolID); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: markMessageAsReadRequestModel.toJson()); + } + + updateNotification(id) { + int index = notificationsList.indexWhere((element) => element.id == id); + notificationsList[index].isRead = true; + } } diff --git a/lib/core/viewModels/notifications_view_model.dart b/lib/core/viewModels/notifications_view_model.dart index 30cd63d9..d1bbeda4 100644 --- a/lib/core/viewModels/notifications_view_model.dart +++ b/lib/core/viewModels/notifications_view_model.dart @@ -1,25 +1,39 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_request_model.dart'; import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_response_model.dart'; +import 'package:diplomaticquarterapp/core/model/notifications/mark_message_as_read_request_model.dart'; import 'package:diplomaticquarterapp/core/service/notifications_service.dart'; import '../../locator.dart'; import 'base_view_model.dart'; class NotificationViewModel extends BaseViewModel { - NotificationService _notificationService = - locator(); + NotificationService _notificationService = locator(); - List get notifications => _notificationService.notificationsList; + List get notifications => + _notificationService.notificationsList; - Future getNotifications() async { + Future getNotifications( + GetNotificationsRequestModel getNotificationsRequestModel) async { setState(ViewState.Busy); - GetNotificationsRequestModel getNotificationsRequestModel = new GetNotificationsRequestModel(currentPage: 0,pagingSize: 14,notificationStatusID: 2); - await _notificationService.getAllNotifications(getNotificationsRequestModel); + await _notificationService + .getAllNotifications(getNotificationsRequestModel); if (_notificationService.hasError) { error = _notificationService.error; setState(ViewState.Error); } else setState(ViewState.Idle); } + + Future markAsRead(id) async { + // setState(ViewState.Busy); + MarkMessageAsReadRequestModel markMessageAsReadRequestModel = + new MarkMessageAsReadRequestModel(notificationPoolID: id); + await _notificationService.markAsRead(markMessageAsReadRequestModel); + // if (_notificationService.hasError) { + // error = _notificationService.error; + // setState(ViewState.Error); + // } else + // setState(ViewState.Idle); + } } \ No newline at end of file diff --git a/lib/pages/DrawerPages/notifications/notification_details_page.dart b/lib/pages/DrawerPages/notifications/notification_details_page.dart new file mode 100644 index 00000000..3858c940 --- /dev/null +++ b/lib/pages/DrawerPages/notifications/notification_details_page.dart @@ -0,0 +1,103 @@ +import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_response_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/notifications_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; +import 'package:flutter/material.dart'; + +class NotificationsDetailsPage extends StatelessWidget { + final GetNotificationsResponseModel notification; + + NotificationsDetailsPage({this.notification}); + + getDateForm(String date) { + DateTime d = DateUtil.convertStringToDate(date); + String monthName = DateUtil.getMonth(d.month).toString(); + TimeOfDay timeOfDay = TimeOfDay(hour: d.hour, minute: d.minute); + String minute = timeOfDay.minute < 10 + ? timeOfDay.minute.toString().padLeft(2, '0') + : timeOfDay.minute.toString(); + + String hour = '${timeOfDay.hourOfPeriod}:$minute'; + if (timeOfDay.period == DayPeriod.am) { + hour = hour + "AM"; + } else { + { + hour = hour + "PM"; + } + } + return monthName + ',${d.day},${d.year}, $hour'; + } + + @override + Widget build(BuildContext context) { + return BaseView( + builder: (_, model, widget) => AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).notificationDetails, + body: SingleChildScrollView( + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + children: [ + SizedBox( + height: 25, + ), + Container( + // margin: EdgeInsets.only(left: 30), + width: double.infinity, + color: Colors.grey[400], + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + getDateForm(notification.createdOn), + fontSize: 16, + ), + ), + ), + SizedBox( + height: 15, + ), + if (notification.messageTypeData.length != 0) + FractionallySizedBox( + widthFactor: 0.9, + child: Image.network(notification.messageTypeData, + loadingBuilder: (BuildContext context, Widget child, + ImageChunkEvent loadingProgress) { + if (loadingProgress == null) return child; + return Center( + child: SizedBox( + width: 40.0, + height: 40.0, + child: AppCircularProgressIndicator(), + ), + ); + }, + fit: BoxFit + .fill) //Image.network(notification.messageTypeData), + ), + SizedBox( + height: 15, + ), + Row( + children: [ + Expanded( + child: Center( + child: Texts(notification.message), + ), + ), + ], + ), + ], + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/pages/DrawerPages/notifications/notifications_page.dart b/lib/pages/DrawerPages/notifications/notifications_page.dart new file mode 100644 index 00000000..4790eb17 --- /dev/null +++ b/lib/pages/DrawerPages/notifications/notifications_page.dart @@ -0,0 +1,142 @@ +import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_request_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/notifications_view_model.dart'; +import 'package:diplomaticquarterapp/pages/DrawerPages/notifications/notification_details_page.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; + +// ignore: must_be_immutable +class NotificationsPage extends StatelessWidget { + getDateForm(String date) { + DateTime d = DateUtil.convertStringToDate(date); + String monthName = DateUtil.getMonth(d.month).toString(); + TimeOfDay timeOfDay = TimeOfDay(hour: d.hour, minute: d.minute); + String minute = timeOfDay.minute < 10 + ? timeOfDay.minute.toString().padLeft(2, '0') + : timeOfDay.minute.toString(); + + String hour = '${timeOfDay.hourOfPeriod}:$minute'; + if (timeOfDay.period == DayPeriod.am) { + hour = hour + "AM"; + } else { + { + hour = hour + "PM"; + } + } + + //DayPeriod.am + return monthName + ',${d.day},${d.year}, $hour'; + } + + int currentIndex = 0; + + @override + Widget build(BuildContext context) { + var prescriptionReport; + return BaseView( + onModelReady: (model) { + GetNotificationsRequestModel getNotificationsRequestModel = + new GetNotificationsRequestModel( + currentPage: currentIndex, + pagingSize: 14, + notificationStatusID: 2); + + model.getNotifications(getNotificationsRequestModel); + }, + builder: (_, model, widget) => AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).notifications, + baseViewModel: model, + body: ListView( + children: model.notifications + .map( + (notification) => InkWell( + onTap: () async { + if(!notification.isRead) + await model.markAsRead(notification.id); + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + NotificationsDetailsPage( + notification: notification, + ))); + }, + child: Container( + width: double.infinity, + margin: EdgeInsets.only( + top: 5, left: 10, right: 10, bottom: 5), + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + border: Border.all( + color: notification.isRead + ? Colors.grey[200] + : Theme.of(context).primaryColor, + width: 0.5), + ), + child: Row( + children: [ + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(getDateForm(notification.createdOn)), + SizedBox( + height: 5, + ), + Row( + children: [ + Expanded( + child: Texts(notification.message)), + if (notification.messageType == "image") + Icon(FontAwesomeIcons.images) + ], + ), + SizedBox( + height: 5, + ), + ], + ), + ), + ), + SizedBox( + width: 15, + ), + ], + ), + ), + ), + ) + .toList() + ..add( + InkWell( + onTap: () { + currentIndex++; + GetNotificationsRequestModel + getNotificationsRequestModel = + new GetNotificationsRequestModel( + currentPage: currentIndex, + pagingSize: 14, + notificationStatusID: 2); + + model.getNotifications(getNotificationsRequestModel); + }, + child: Center( + child: Image.asset('assets/images/notf.png'), + ), + ), + )), + ), + ); + } +} diff --git a/lib/pages/DrawerPages/notifications_page.dart b/lib/pages/DrawerPages/notifications_page.dart deleted file mode 100644 index 4e6e7e42..00000000 --- a/lib/pages/DrawerPages/notifications_page.dart +++ /dev/null @@ -1,89 +0,0 @@ -import 'package:diplomaticquarterapp/core/viewModels/notifications_view_model.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:flutter/material.dart'; - -class NotificationsPage extends StatelessWidget { - getDateForm(String date) { - DateTime d = DateUtil.convertStringToDate(date); - String monthName = DateUtil.getMonth(d.month).toString(); - TimeOfDay timeOfDay = TimeOfDay(hour: d.hour, minute: d.minute); - String minute = timeOfDay.minute < 10 - ? timeOfDay.minute.toString().padLeft(2, '0') - : timeOfDay.minute.toString(); - - String hour = '${timeOfDay.hourOfPeriod}:$minute'; - if (timeOfDay.period == DayPeriod.am) { - hour = hour + "AM"; - } else { - { - hour = hour + "PM"; - } - } - - //DayPeriod.am - return monthName + ',${d.day},${d.year}, $hour'; - } - - @override - Widget build(BuildContext context) { - var prescriptionReport; - return BaseView( - onModelReady: (model) => model.getNotifications(), - builder: (_, model, widget) => AppScaffold( - isShowAppBar: true, - appBarTitle: TranslationBase.of(context).notifications, - baseViewModel: model, - body: ListView.builder( - itemBuilder: (context, index) => Container( - width: double.infinity, - margin: EdgeInsets.only(top: 5, left: 10, right: 10, bottom: 5), - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - border: Border.all( - color: model.notifications[index].isRead - ? Colors.grey[200] - : Theme.of(context).primaryColor, - width: 0.5), - ), - child: Row( - children: [ - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - getDateForm(model.notifications[index].createdOn)), - SizedBox( - height: 5, - ), - Texts(model.notifications[index].message), - SizedBox( - height: 5, - ), - Texts(model.notifications[index].notificationType), - ], - ), - ), - ), - SizedBox( - width: 15, - ), - ], - ), - ), - itemCount: model.notifications.length, - ), - ), - ); - } -} diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 64b3a969..33621b1a 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -734,6 +734,7 @@ class TranslationBase { String get loginToUseService => localizedValues['loginToUseService'][locale.languageCode]; String get notifications => localizedValues['notifications'][locale.languageCode]; + String get notificationDetails => localizedValues['notificationDetails'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index f345f641..ab517337 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -4,7 +4,7 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; -import 'package:diplomaticquarterapp/pages/DrawerPages/notifications_page.dart'; +import 'package:diplomaticquarterapp/pages/DrawerPages/notifications/notifications_page.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; From 41b919183f0c096b68c86729e453318a42e8c0bd Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 8 Nov 2020 10:18:41 +0200 Subject: [PATCH 3/8] Fix bug on read notifications_page.dart --- lib/core/service/notifications_service.dart | 1 + .../viewModels/notifications_view_model.dart | 21 ++++++++++--------- .../notifications/notifications_page.dart | 14 +++++++++---- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/lib/core/service/notifications_service.dart b/lib/core/service/notifications_service.dart index 87081a0f..f2cac55e 100644 --- a/lib/core/service/notifications_service.dart +++ b/lib/core/service/notifications_service.dart @@ -35,5 +35,6 @@ class NotificationService extends BaseService { updateNotification(id) { int index = notificationsList.indexWhere((element) => element.id == id); notificationsList[index].isRead = true; + } } diff --git a/lib/core/viewModels/notifications_view_model.dart b/lib/core/viewModels/notifications_view_model.dart index d1bbeda4..ac09e3b2 100644 --- a/lib/core/viewModels/notifications_view_model.dart +++ b/lib/core/viewModels/notifications_view_model.dart @@ -3,6 +3,8 @@ import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_ import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_response_model.dart'; import 'package:diplomaticquarterapp/core/model/notifications/mark_message_as_read_request_model.dart'; import 'package:diplomaticquarterapp/core/service/notifications_service.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:flutter/material.dart'; import '../../locator.dart'; import 'base_view_model.dart'; @@ -14,15 +16,18 @@ class NotificationViewModel extends BaseViewModel { _notificationService.notificationsList; Future getNotifications( - GetNotificationsRequestModel getNotificationsRequestModel) async { - setState(ViewState.Busy); + GetNotificationsRequestModel getNotificationsRequestModel, BuildContext context) async { + if(getNotificationsRequestModel.currentPage == 0) + setState(ViewState.Busy); + await _notificationService .getAllNotifications(getNotificationsRequestModel); if (_notificationService.hasError) { error = _notificationService.error; - setState(ViewState.Error); - } else - setState(ViewState.Idle); + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } } Future markAsRead(id) async { @@ -30,10 +35,6 @@ class NotificationViewModel extends BaseViewModel { MarkMessageAsReadRequestModel markMessageAsReadRequestModel = new MarkMessageAsReadRequestModel(notificationPoolID: id); await _notificationService.markAsRead(markMessageAsReadRequestModel); - // if (_notificationService.hasError) { - // error = _notificationService.error; - // setState(ViewState.Error); - // } else - // setState(ViewState.Idle); + setState(ViewState.Idle); } } \ No newline at end of file diff --git a/lib/pages/DrawerPages/notifications/notifications_page.dart b/lib/pages/DrawerPages/notifications/notifications_page.dart index 4790eb17..53aad843 100644 --- a/lib/pages/DrawerPages/notifications/notifications_page.dart +++ b/lib/pages/DrawerPages/notifications/notifications_page.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/core/viewModels/notifications_view_model.da import 'package:diplomaticquarterapp/pages/DrawerPages/notifications/notification_details_page.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.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/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -45,7 +46,7 @@ class NotificationsPage extends StatelessWidget { pagingSize: 14, notificationStatusID: 2); - model.getNotifications(getNotificationsRequestModel); + model.getNotifications(getNotificationsRequestModel, context); }, builder: (_, model, widget) => AppScaffold( isShowAppBar: true, @@ -57,7 +58,7 @@ class NotificationsPage extends StatelessWidget { (notification) => InkWell( onTap: () async { if(!notification.isRead) - await model.markAsRead(notification.id); + model.markAsRead(notification.id); Navigator.push( context, MaterialPageRoute( @@ -120,7 +121,9 @@ class NotificationsPage extends StatelessWidget { .toList() ..add( InkWell( - onTap: () { + onTap: () async { + GifLoaderDialogUtils.showMyDialog( + context); currentIndex++; GetNotificationsRequestModel getNotificationsRequestModel = @@ -129,7 +132,10 @@ class NotificationsPage extends StatelessWidget { pagingSize: 14, notificationStatusID: 2); - model.getNotifications(getNotificationsRequestModel); + await model.getNotifications(getNotificationsRequestModel,context); + GifLoaderDialogUtils.hideDialog( + context); + }, child: Center( child: Image.asset('assets/images/notf.png'), From 64f970c40c7146284d0896832e87fce2613d7947 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 8 Nov 2020 10:34:03 +0200 Subject: [PATCH 4/8] Fix issues after the merge --- lib/config/localized_values.dart | 2 +- .../BookAppointment/components/DocAvailableAppointments.dart | 2 +- lib/pages/Covid-DriveThru/Covid-TimeSlots.dart | 2 +- lib/uitl/translations_delegate_base.dart | 1 - 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index b96383c9..dfdd758b 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -683,7 +683,7 @@ const Map> localizedValues = { "Book": {"en": "Book", "ar": "احجز"}, "AppointmentLabel": {"en": "Appointment", "ar": "موعد"}, "BloodType": {"en": "Blood Type", "ar": "فصيلة الدم"}, - "marital-status": {"en": "Marital status", "ar": "الحالة الإجتماعية"} + "marital-status": {"en": "Marital status", "ar": "الحالة الإجتماعية"}, "notifications": {"en": "Notifications", "ar": "إشعارات"}, "notificationDetails": {"en": "Notification Details", "ar": "تفاصيل الاشعار"}, diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 85569473..2d857bc9 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -235,7 +235,7 @@ class _DocAvailableAppointmentsState extends State return children; }, ), - onDaySelected: (date, events) { + onDaySelected: (date, events,holidays) { _onDaySelected(date, events); _animationController.forward(from: 0.0); }, diff --git a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart index 939198c3..8310528d 100644 --- a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart +++ b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart @@ -348,7 +348,7 @@ class _CovidTimeSlotsState extends State return children; }, ), - onDaySelected: (date, event) { + onDaySelected: (date, event,holidays) { _onDaySelected( date, event, diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index f4e318af..051823ad 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -738,7 +738,6 @@ class TranslationBase { localizedValues['loginToUseService'][locale.languageCode]; String get maritalStatus => localizedValues['marital-status'][locale.languageCode]; - String get loginToUseService => localizedValues['loginToUseService'][locale.languageCode]; String get notifications => localizedValues['notifications'][locale.languageCode]; String get notificationDetails => localizedValues['notificationDetails'][locale.languageCode]; } From 4a4d5248a249f0b1295d501674f4cc6fc450553d Mon Sep 17 00:00:00 2001 From: Mohammad Aljmma Date: Sun, 8 Nov 2020 10:34:16 +0200 Subject: [PATCH 5/8] fix status issue --- lib/core/service/AuthenticatedUserObject.dart | 1 - .../BookAppointment/components/DocAvailableAppointments.dart | 2 +- lib/pages/Covid-DriveThru/Covid-TimeSlots.dart | 2 +- lib/pages/login/login.dart | 3 ++- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/core/service/AuthenticatedUserObject.dart b/lib/core/service/AuthenticatedUserObject.dart index 25005b3a..600e17e1 100644 --- a/lib/core/service/AuthenticatedUserObject.dart +++ b/lib/core/service/AuthenticatedUserObject.dart @@ -23,6 +23,5 @@ class AuthenticatedUserObject { logout() async { isLogin = false; - var asd =""; } } diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 85569473..6ce8a840 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -235,7 +235,7 @@ class _DocAvailableAppointmentsState extends State return children; }, ), - onDaySelected: (date, events) { + onDaySelected: (date, events, format) { _onDaySelected(date, events); _animationController.forward(from: 0.0); }, diff --git a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart index 939198c3..36eb0406 100644 --- a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart +++ b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart @@ -348,7 +348,7 @@ class _CovidTimeSlotsState extends State return children; }, ), - onDaySelected: (date, event) { + onDaySelected: (date, event,format) { _onDaySelected( date, event, diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 458924e3..a190e52a 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -221,7 +221,8 @@ class _Login extends State { this.sharedPref.setObject(USER_PROFILE, result.list), this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), this.sharedPref.setString(TOKEN, result.authenticationTokenID), - + authenticatedUserObject.isLogin = true, + appointmentRateViewModel.isLogin =true, appointmentRateViewModel .getIsLastAppointmentRatedList() .then((value) => { From 570aa514cd77b2e9f937c7166722dd214f0d2bd7 Mon Sep 17 00:00:00 2001 From: Mohammad Aljmma Date: Sun, 8 Nov 2020 13:47:46 +0200 Subject: [PATCH 6/8] fix user authentication data --- lib/core/service/AuthenticatedUserObject.dart | 4 +-- lib/core/service/medical/labs_service.dart | 1 + lib/core/viewModels/base_view_model.dart | 3 +++ lib/core/viewModels/dashboard_view_model.dart | 2 +- lib/pages/Blood/dialogs/ConfirmSMSDialog.dart | 25 +++++++++++-------- lib/pages/landing/home_page.dart | 2 +- lib/pages/login/login.dart | 5 ++-- lib/splashPage.dart | 3 +++ lib/widgets/others/app_scaffold_widget.dart | 2 -- 9 files changed, 29 insertions(+), 18 deletions(-) diff --git a/lib/core/service/AuthenticatedUserObject.dart b/lib/core/service/AuthenticatedUserObject.dart index 600e17e1..f48b1179 100644 --- a/lib/core/service/AuthenticatedUserObject.dart +++ b/lib/core/service/AuthenticatedUserObject.dart @@ -17,8 +17,8 @@ class AuthenticatedUserObject { if (userData != null) user = AuthenticatedUser.fromJson(userData); } - var isLogin = await sharedPref.getString(LOGIN_TOKEN_ID); - this.isLogin = isLogin != null; + // var isLogin = await sharedPref.getString(LOGIN_TOKEN_ID); + this.isLogin = user != null; } logout() async { diff --git a/lib/core/service/medical/labs_service.dart b/lib/core/service/medical/labs_service.dart index c1ad65f3..027d755b 100644 --- a/lib/core/service/medical/labs_service.dart +++ b/lib/core/service/medical/labs_service.dart @@ -13,6 +13,7 @@ class LabsService extends BaseService { List patientLabOrdersList = List(); Future getPatientLabOrdersList() async { + hasError = false; await baseAppClient.post(GET_Patient_LAB_ORDERS, onSuccess: (dynamic response, int statusCode) { patientLabOrdersList.clear(); diff --git a/lib/core/viewModels/base_view_model.dart b/lib/core/viewModels/base_view_model.dart index 18ab02e3..d8ea5196 100644 --- a/lib/core/viewModels/base_view_model.dart +++ b/lib/core/viewModels/base_view_model.dart @@ -30,6 +30,9 @@ class BaseViewModel extends ChangeNotifier { } BaseViewModel() { + //authenticatedUserObject.getUser(); + user = authenticatedUserObject.user; + this.isLogin = authenticatedUserObject.isLogin; _getUser(); } diff --git a/lib/core/viewModels/dashboard_view_model.dart b/lib/core/viewModels/dashboard_view_model.dart index e2523120..4cf22b23 100644 --- a/lib/core/viewModels/dashboard_view_model.dart +++ b/lib/core/viewModels/dashboard_view_model.dart @@ -10,7 +10,7 @@ class DashboardViewModel extends BaseViewModel { String bloadType = ""; getPatientRadOrders() async { - if (!isLogin && _vitalSignService.weightKg.isEmpty) { + if (isLogin && _vitalSignService.weightKg.isEmpty) { setState(ViewState.Busy); await _vitalSignService.getPatientRadOrders(); if (_vitalSignService.hasError) { diff --git a/lib/pages/Blood/dialogs/ConfirmSMSDialog.dart b/lib/pages/Blood/dialogs/ConfirmSMSDialog.dart index 8dd2b29e..d165a895 100644 --- a/lib/pages/Blood/dialogs/ConfirmSMSDialog.dart +++ b/lib/pages/Blood/dialogs/ConfirmSMSDialog.dart @@ -6,12 +6,14 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; import 'package:diplomaticquarterapp/core/model/my_balance/patient_info_and_mobile_number.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart'; class ConfirmSMSDialog extends StatefulWidget { @@ -97,6 +99,7 @@ class _ConfirmSMSDialogState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( builder: (_, model, w) => Dialog( elevation: 0.6, @@ -107,20 +110,18 @@ class _ConfirmSMSDialogState extends State { Container( width: double.infinity, height: 40, - color: Colors.grey[700], - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, + color: Theme.of(context).primaryColor, + child: Stack( + children: [ - Expanded( - flex: 4, - child: Center( - child: Texts( + Center( + child: Texts( 'SMS', color: Colors.white, textAlign: TextAlign.center, - ))), - Expanded( - flex: 1, + ), + ), + Positioned(child: Container( child: InkWell( onTap: () => Navigator.pop(context), child: Container( @@ -131,8 +132,12 @@ class _ConfirmSMSDialogState extends State { color: Colors.grey[900], )), ), + ), + left: projectViewModel.isArabic? 2:0, + right: projectViewModel.isArabic? 0:2, ) ], + ), ), Image.asset( diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index 82fd6d22..fabfeda8 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -110,7 +110,7 @@ class _HomePageState extends State { Orientation.landscape ? 0.02 : 0.03), - child: (!authenticatedUserObject.isLogin && projectViewModel.user == null) + child: (!model.isLogin ) ? Container( width: double.infinity, height: 160, diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index a190e52a..2937db11 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -217,12 +217,13 @@ class _Login extends State { // request.isRegister = false; this.authService.checkActivationCode(request, code).then((result) => { result = CheckActivationCode.fromJson(result), - authenticatedUserObject.getUser(), this.sharedPref.setObject(USER_PROFILE, result.list), this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), this.sharedPref.setString(TOKEN, result.authenticationTokenID), + authenticatedUserObject.getUser(), + // authenticatedUserObject.user = AuthenticatedUser.fromJson(result.list), authenticatedUserObject.isLogin = true, - appointmentRateViewModel.isLogin =true, + appointmentRateViewModel.isLogin = true, appointmentRateViewModel .getIsLastAppointmentRatedList() .then((value) => { diff --git a/lib/splashPage.dart b/lib/splashPage.dart index ceec604c..3b9b3bd0 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -2,6 +2,9 @@ import 'dart:async'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:flutter/material.dart'; +import 'core/service/AuthenticatedUserObject.dart'; +import 'locator.dart'; + class SplashScreen extends StatefulWidget { @override _SplashScreenState createState() => _SplashScreenState(); diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index 616b0d9b..f56f7784 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -101,8 +101,6 @@ class AppScaffold extends StatelessWidget { icon: Icon(FontAwesomeIcons.home), color: Colors.white, onPressed: () { - - Navigator.pushAndRemoveUntil( context, MaterialPageRoute(builder: (context) => LandingPage()), From a077d87dd8db0ffb23b2b64b1e1e49fc5132a53b Mon Sep 17 00:00:00 2001 From: Mohammad Aljmma Date: Sun, 8 Nov 2020 16:16:00 +0200 Subject: [PATCH 7/8] fix user authentication data --- .../viewModels/medical/medical_view_model.dart | 3 ++- lib/core/viewModels/project_view_model.dart | 2 ++ lib/pages/base/base_view.dart | 18 ++++++++++++++++-- lib/pages/landing/home_page.dart | 2 +- lib/pages/login/login.dart | 6 ++++++ lib/pages/medical/medical_profile_page.dart | 5 +++-- lib/widgets/drawer/app_drawer_widget.dart | 2 ++ lib/widgets/others/app_scaffold_widget.dart | 2 +- 8 files changed, 33 insertions(+), 7 deletions(-) diff --git a/lib/core/viewModels/medical/medical_view_model.dart b/lib/core/viewModels/medical/medical_view_model.dart index f8b14c6e..8621546b 100644 --- a/lib/core/viewModels/medical/medical_view_model.dart +++ b/lib/core/viewModels/medical/medical_view_model.dart @@ -12,9 +12,10 @@ class MedicalViewModel extends BaseViewModel { _medicalService.appoitmentAllHistoryResultList; getAppointmentHistory() async { + var asd =""; if (authenticatedUserObject.isLogin) { setState(ViewState.Busy); - if (_medicalService.appoitmentAllHistoryResultList.length == 0) + // if (_medicalService.appoitmentAllHistoryResultList.length == 0) await _medicalService.getAppointmentHistory(); if (_medicalService.hasError) { error = _medicalService.error; diff --git a/lib/core/viewModels/project_view_model.dart b/lib/core/viewModels/project_view_model.dart index dce0fe54..91e9b9a3 100644 --- a/lib/core/viewModels/project_view_model.dart +++ b/lib/core/viewModels/project_view_model.dart @@ -18,6 +18,8 @@ class ProjectViewModel extends BaseViewModel { bool isError = false; String error = ''; dynamic searchvalue; + bool isLogin = false; + dynamic get searchValue => searchvalue; diff --git a/lib/pages/base/base_view.dart b/lib/pages/base/base_view.dart index f5311aae..4c606fe2 100644 --- a/lib/pages/base/base_view.dart +++ b/lib/pages/base/base_view.dart @@ -1,10 +1,15 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../../locator.dart'; +AppSharedPreferences sharedPref = AppSharedPreferences(); + class BaseView extends StatefulWidget { final Widget Function(BuildContext context, T model, Widget child) builder; final Function(T) onModelReady; @@ -20,16 +25,25 @@ class BaseView extends StatefulWidget { class _BaseViewState extends State> { T model = locator(); - AuthenticatedUserObject authenticatedUserObject = locator(); + AuthenticatedUserObject authenticatedUserObject = + locator(); + bool isLogin = false; @override void initState() { - if (widget.onModelReady != null && authenticatedUserObject.isLogin) { + //TODO fix it + //Provider.of(context, listen: false).isLogin; + if (widget.onModelReady != null && Provider.of(context, listen: false).isLogin) { widget.onModelReady(model); } super.initState(); } + getUser() async { + var userData = await sharedPref.getObject(USER_PROFILE); + this.isLogin = userData != null; + } + @override Widget build(BuildContext context) { return ChangeNotifierProvider( diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index fabfeda8..abb5c06a 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -40,7 +40,7 @@ class HomePage extends StatefulWidget { } class _HomePageState extends State { - var toDoProvider; + ToDoCountProviderModel toDoProvider; @override void initState() { diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 2937db11..dd4911e1 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart'; @@ -23,6 +24,7 @@ import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart'; class Login extends StatefulWidget { @@ -46,6 +48,8 @@ class _Login extends State { AuthenticatedUserObject authenticatedUserObject = locator(); + ProjectViewModel projectViewModel; + @override void initState() { // getDeviceToken(); @@ -60,6 +64,7 @@ class _Login extends State { @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return AppScaffold( appBarTitle: TranslationBase.of(context).login, isShowAppBar: true, @@ -224,6 +229,7 @@ class _Login extends State { // authenticatedUserObject.user = AuthenticatedUser.fromJson(result.list), authenticatedUserObject.isLogin = true, appointmentRateViewModel.isLogin = true, + projectViewModel.isLogin = true, appointmentRateViewModel .getIsLastAppointmentRatedList() .then((value) => { diff --git a/lib/pages/medical/medical_profile_page.dart b/lib/pages/medical/medical_profile_page.dart index 5a41a18a..30aafff8 100644 --- a/lib/pages/medical/medical_profile_page.dart +++ b/lib/pages/medical/medical_profile_page.dart @@ -61,7 +61,7 @@ class _MedicalProfilePageState extends State { width: double.infinity, // color: Colors.black.withOpacity(0.0) ), - if (model.authenticatedUserObject.isLogin) + if (model.isLogin) ListView.builder( itemBuilder: (context, index) => TimeLineWidget( @@ -81,6 +81,7 @@ class _MedicalProfilePageState extends State { padding: EdgeInsets.symmetric(vertical: 5.0), child: Column( children: [ + if(model.isLogin) Container( width: double.infinity, height: 55, @@ -323,7 +324,7 @@ class _MedicalProfilePageState extends State { ) ], ), - if (model.user != null) + if (model.user != null && model.isLogin) Positioned( top: 185, left: 20, diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index ab517337..32f98915 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -350,6 +350,8 @@ class _AppDrawerState extends State { logout() async { authenticatedUserObject.logout(); + projectProvider.isLogin = false; + await authenticatedUserObject.getUser(); await sharedPref.clear(); this.user = null; Navigator.of(context).pushNamed(HOME); diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index f56f7784..cdfda8f0 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -110,7 +110,7 @@ class AppScaffold extends StatelessWidget { ], ) : null, - body: (!authenticatedUserObject.isLogin && isShowDecPage) + body: (!Provider.of(context, listen: false).isLogin && isShowDecPage) ? NotAutPage( title: appBarTitle, description: description, From 6a8353854400eae24fdd6a33bda92e47536fcf8c Mon Sep 17 00:00:00 2001 From: Mohammad Aljmma Date: Sun, 8 Nov 2020 20:34:40 +0200 Subject: [PATCH 8/8] add info for Medical --- lib/config/localized_values.dart | 135 +++++++++++++++++- .../insurance/insurance_approval_screen.dart | 2 + .../insurance/insurance_card_screen.dart | 2 + lib/pages/medical/allergies_page.dart | 1 + .../medical/doctor/doctor_home_page.dart | 5 +- .../medical/patient_sick_leave_page.dart | 4 +- .../prescriptions_home_page.dart | 2 + .../medical/reports/report_home_page.dart | 4 +- lib/uitl/translations_delegate_base.dart | 22 +++ lib/widgets/others/app_scaffold_widget.dart | 77 +++++----- lib/widgets/others/not_auh_page.dart | 37 ++++- 11 files changed, 254 insertions(+), 37 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index dfdd758b..223620df 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1,4 +1,4 @@ -const Map> localizedValues = { +const Map localizedValues = { 'dashboardScreenToolbarTitle': {'ar': 'الرئيسة', 'en': 'Home'}, 'settings': {'en': 'Settings', 'ar': 'الاعدادات'}, 'language': {'en': 'App Language', 'ar': 'لغة التطبيق'}, @@ -686,5 +686,138 @@ const Map> localizedValues = { "marital-status": {"en": "Marital status", "ar": "الحالة الإجتماعية"}, "notifications": {"en": "Notifications", "ar": "إشعارات"}, "notificationDetails": {"en": "Notification Details", "ar": "تفاصيل الاشعار"}, + "notificationDetailsa": { + "en": "Notification Details", + "ar": "تفاصيل الاشعار" + }, + + "info-my-doctor-points": { + "en": [ + "View the doctor's profile and qualifications.", + "View the doctor's schedule.", + "View details of your appointments with the selected doctor.", + "Book appointment with the doctor. ", + ], + "ar": [ + "الاطلاع على معلومات الطبيب ومؤهلاته.", + "الاطلاع على جدول الطبيب.", + "الاطلاع على تفاصيل المواعيد التي تمت مع الطبيب.", + "حجز موعد مع الطبيب." + ] + }, + "info-my-doctor": { + "en": + "This service allows you to see all the doctors you have visited in Al Habib Medical Group, and through this service:", + "ar": + "خدمة اطبائي: هذه الخدمة تمكنك من الاطلاع على جميع الاطباء الذين قمت بزيارتهم في مجموعة الحبيب الطبية, كما تستطيع من خلال هذه الخدمة:" + }, + "info-prescriptions": { + "en": + "This service allows you to view all the medical prescriptions issued by Al Habib Medical Group, and through this service, you can:", + "ar": + "خدمة الوصفات الطبية: هذه الخدمة تمكنك من الاطلاع على جميع الوصفات الطبية التي تم اصدارها في مجموعة الحبيب الطبية، كما تستطيع من خلال هذه الخدمة:" + }, + "info-my-prescription-points": { + "en": [ + "View the duration days.", + "View the frequency timing.", + "View the doctor's remarks.", + "Add a reminder to remind you when to take medicine doses.", + "Search in AlHabib Pharmacies about the branches where medicines are available, pharmacies locations and contact numbers.", + "Ordering and delivery medications online.", + "View the prices of the drug. ", + ], + "ar": [ + "الاطلاع على طريقة تناول العلاج.", + "الاطلاع على مدة تناول العلاج.", + "الاطلاع على ملاحظات الطبيب.", + "اضافة منبه للتذكير بموعد تناول جرعات الادوية.", + "البحث في صيدليات الحبيب عن الفروع التي يتوفر فيها العلاج وكذلك مواقع الصيدليات وارقام الاتصال. ", + "امكانية شراء وتوصيل العلاج عن طريق الانترنت.", + "الاطلاع على اسعار الادوية المصروفة." + ] + }, + + "info-insurance-cards": { + "en": + "This service allows you to view all the insurance cards that recorded during your visits to Al Habib Medical Group in addition to:", + "ar": + "خدمة بطاقات التامين: هذه الخدمة تمكنك من الاطلاع على جميع بطاقات التامين والتي تم تسجيلها اثناء زياراتك لمجموعة الحبيب الطبية بالاضافة الى:" + }, + + "info-insurance-cards-points": { + "en": [ + "Name of the insurance company.", + "Insurance category.", + "Insurance policy number.", + "The expiry date of insurance.", + "The status of the insurance card (active or inactive).", + "Details of the coverage, e.x the room category covered as well some cases covered by the insurance.", + ], + "ar": [ + "اسم شركة التامين.", + "فئة التامين.", + "رقم بوليصة التامين.", + "تاريخ انتهاء التامين.", + "حالة بطاقة التامين (فعالة او غير فعالة).", + "تفاصيل التامين، مثلاً: مستوى الغرفة التي يغطيها التامين وكذلك الحالات التي يغطيها التامين.", + ] + }, + + "info-allergies": { + "en": + "This service allows you to view all types of allergies recorded during your visits to Al Habib Medical Group.", + "ar": + "خدمة الحساسية: هذه الخدمة تمكنك من الاطلاع على جميع انواع الحساسية التي تم تسجيلها خلال زياراتك في مجموعة الحبيب الطبية." + }, + + "sick-leaves": {"en": "Sick Leaves", "ar": "الاجازات المرضية"}, + + "info-sick-leaves": { + "en": + "This service allows you to view all sick leaves that were taken in Al Habib Medical Group in addition to:", + "ar": + "الاجازات المرضية: هذه الخدمة تمكنك من الاطلاع على جميع الاجازات المرضية والتي تم اصدارها في مجموعة الحبيب الطبية بالاضافة الى:" + }, + "info-sick-leave-points": { + "en": [ + "Doctor Name", + "Sick leave date ", + "Sick leave days", + "Branch that patient take the vaccination form.", + "Sending a report of vaccinations to the email. ", + ], + "ar": [ + "اسم الطبيب", + "تاريخ الاجازة.", + "عدد ايام الاجازة.", + "الفرع الذي تم اصدار الاجازة منه.", + "ارسال نسخة مختومة من الاجازة الى البريد الالكتروني." + ] + }, + + "info-approvals": { + "en": + "This service allows you to view all approvals requests that have been sent to the insurance companies in addition to:", + "ar": + "خدمة الموافقات: هذه الخدمة تمكنك من الاطلاع على جميع طلبات الموافقات والتي تم ارسالها الى شركات التامين بالاضافة الى:" + }, + + "info-approval-points": { + "en": [ + "View the total unused approvals.", + "Track the approvals status.", + ], + "ar": [ + "الاطلاع على اجمالي الموافقات الغير مستخدمة.", + "تتبع حالة الموافقة.", + ] + }, + + "month-report": {"en": "Monthly Reports", "ar": "تقاريري الشهرية"}, + "info-month-report": { + "en": "Upon activation of this service, the system will send a monthly report automatically to the registered email which lists the vital signs and the results for the last visits made in AlHabib Medical Group.", + "ar": "خدمة التقارير الشهرية: عند تفعيل هذه الخدمة سيقوم النظام بارسال تقرير شهري بشكل آلي على الايميل المسجل والذي يسرد المؤشرات الحيوية ونتائج التحاليل لآخر زيارات تمت بمجموعة الحبيب الطبية." + }, }; diff --git a/lib/pages/insurance/insurance_approval_screen.dart b/lib/pages/insurance/insurance_approval_screen.dart index 038468e0..3b19e670 100644 --- a/lib/pages/insurance/insurance_approval_screen.dart +++ b/lib/pages/insurance/insurance_approval_screen.dart @@ -30,6 +30,8 @@ class _InsuranceApprovalState extends State { isShowAppBar: true, baseViewModel: model, appBarTitle: TranslationBase.of(context).approvals, + description: TranslationBase.of(context).infoApprovals, + infoList: TranslationBase.of(context).infoApprovalPoints, body: SingleChildScrollView( child: Container( margin: EdgeInsets.only( diff --git a/lib/pages/insurance/insurance_card_screen.dart b/lib/pages/insurance/insurance_card_screen.dart index 55100497..a7065399 100644 --- a/lib/pages/insurance/insurance_card_screen.dart +++ b/lib/pages/insurance/insurance_card_screen.dart @@ -31,6 +31,8 @@ class _InsuranceCardState extends State { baseViewModel: model, image: 'assets/images/medical/insurance_card_icon.png', appBarTitle: TranslationBase.of(context).insuranceCards, + description: TranslationBase.of(context).infoInsuranceCards, + infoList: TranslationBase.of(context).infoInsuranceCardsPoints, body: Container( margin: EdgeInsets.only( left: SizeConfig.screenWidth * 0.004, diff --git a/lib/pages/medical/allergies_page.dart b/lib/pages/medical/allergies_page.dart index ea063e19..7fe30a8a 100644 --- a/lib/pages/medical/allergies_page.dart +++ b/lib/pages/medical/allergies_page.dart @@ -15,6 +15,7 @@ class AllergiesPage extends StatelessWidget { isShowAppBar: true, appBarTitle: TranslationBase.of(context).allergies, baseViewModel: model, + description: TranslationBase.of(context).infoAllergies, body: ListView.builder( itemCount: model.allergies.length, itemBuilder: (context, index) => Container( diff --git a/lib/pages/medical/doctor/doctor_home_page.dart b/lib/pages/medical/doctor/doctor_home_page.dart index d406b889..9687b931 100644 --- a/lib/pages/medical/doctor/doctor_home_page.dart +++ b/lib/pages/medical/doctor/doctor_home_page.dart @@ -22,7 +22,9 @@ class DoctorHomePage extends StatelessWidget { builder: (context, MyDoctorViewModel model, widget) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBarTitle: 'My Doctors', + appBarTitle: TranslationBase.of(context).myDoctor, + description: TranslationBase.of(context).infoMyDoctor, + infoList: TranslationBase.of(context).infoMyDoctorPoints, body: SingleChildScrollView( physics: BouncingScrollPhysics(), child: FractionallySizedBox( @@ -94,6 +96,7 @@ class DoctorHomePage extends StatelessWidget { nationalityFlagURL: doctor.nationalityFlagURL); return DoctorView( doctor: doctorList, + isLiveCareAppointment: false, ); }).toList(), diff --git a/lib/pages/medical/patient_sick_leave_page.dart b/lib/pages/medical/patient_sick_leave_page.dart index d12573f0..dcb6eea3 100644 --- a/lib/pages/medical/patient_sick_leave_page.dart +++ b/lib/pages/medical/patient_sick_leave_page.dart @@ -18,7 +18,9 @@ class _PatientSickLeavePageState extends State { onModelReady: (model) => model.getSickLeave(), builder: (_, model, w) => AppScaffold( isShowAppBar: true, - appBarTitle: 'Sick Leave', + appBarTitle: TranslationBase.of(context).sickLeaves, + description: TranslationBase.of(context).infoSickLeaves, + infoList: TranslationBase.of(context).infoSickLeavePoints, baseViewModel: model, body: Container( margin: EdgeInsets.all(12), diff --git a/lib/pages/medical/prescriptions/prescriptions_home_page.dart b/lib/pages/medical/prescriptions/prescriptions_home_page.dart index 182fca30..dad6fd17 100644 --- a/lib/pages/medical/prescriptions/prescriptions_home_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_home_page.dart @@ -38,6 +38,8 @@ class _HomePrescriptionsPageState extends State builder: (_, model, widget) => AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).prescriptions, + description: TranslationBase.of(context).infoPrescriptions, + infoList: TranslationBase.of(context).infoPrescriptionsPoints, body: Scaffold( extendBodyBehindAppBar: true, appBar: PreferredSize( diff --git a/lib/pages/medical/reports/report_home_page.dart b/lib/pages/medical/reports/report_home_page.dart index 8f24d1dd..5c6812e2 100644 --- a/lib/pages/medical/reports/report_home_page.dart +++ b/lib/pages/medical/reports/report_home_page.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/reports_view_model. import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/reports/report_list_widget.dart'; import 'package:diplomaticquarterapp/pages/medical/reports/reports_page.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -38,7 +39,8 @@ class _HomeReportPageState extends State onModelReady: (model) => model.getReports(), //model.getPrescriptions(), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, - appBarTitle: 'Request', + appBarTitle: TranslationBase.of(context).monthReport, + description: TranslationBase.of(context).infoMonthReport, baseViewModel: model, //bottomSheet: Container(), diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 051823ad..87d6c257 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -740,6 +740,28 @@ class TranslationBase { localizedValues['marital-status'][locale.languageCode]; String get notifications => localizedValues['notifications'][locale.languageCode]; String get notificationDetails => localizedValues['notificationDetails'][locale.languageCode]; + List get infoMyDoctorPoints => localizedValues['info-my-doctor-points'][locale.languageCode]; + String get infoMyDoctor => localizedValues['info-my-doctor'][locale.languageCode]; + String get infoPrescriptions => localizedValues['info-prescriptions'][locale.languageCode]; + List get infoPrescriptionsPoints => localizedValues['info-my-prescription-points'][locale.languageCode]; + + String get infoInsuranceCards => localizedValues['info-insurance-cards'][locale.languageCode]; + List get infoInsuranceCardsPoints => localizedValues['info-insurance-cards-points'][locale.languageCode]; + + String get infoAllergies => localizedValues['info-allergies'][locale.languageCode]; + + String get sickLeaves => localizedValues['sick-leaves'][locale.languageCode]; + String get infoSickLeaves => localizedValues['info-sick-leaves'][locale.languageCode]; + List get infoSickLeavePoints => localizedValues['info-sick-leave-points'][locale.languageCode]; + + String get infoApprovals => localizedValues['info-approvals'][locale.languageCode]; + List get infoApprovalPoints => localizedValues['info-approval-points'][locale.languageCode]; + + String get monthReport => localizedValues['month-report'][locale.languageCode]; + String get infoMonthReport => localizedValues['info-month-report'][locale.languageCode]; + + + } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index cdfda8f0..86a07958 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -39,7 +39,7 @@ class AppScaffold extends StatelessWidget { final String description; final String image; final bool isShowDecPage; - + final List infoList; AuthenticatedUserObject authenticatedUserObject = locator(); @@ -55,7 +55,9 @@ class AppScaffold extends StatelessWidget { this.title, this.description, this.isShowDecPage = true, - this.isBottomBar, this.image}); + this.isBottomBar, + this.image, + this.infoList}); @override Widget build(BuildContext context) { @@ -71,49 +73,58 @@ class AppScaffold extends StatelessWidget { headline6: TextStyle(color: Colors.white, fontWeight: FontWeight.bold), ), - title: Texts(authenticatedUserObject.isLogin || !isShowDecPage - ? appBarTitle.toUpperCase() - : TranslationBase.of(context).serviceInformationTitle,color: Colors.white,bold: true,), - leading:Builder( + title: Texts( + authenticatedUserObject.isLogin || !isShowDecPage + ? appBarTitle.toUpperCase() + : TranslationBase.of(context).serviceInformationTitle, + color: Colors.white, + bold: true, + ), + leading: Builder( builder: (BuildContext context) { return ArrowBack(); }, ), centerTitle: true, actions: [ - image!=null? InkWell( - onTap: ()=> - Navigator.push( - context, - FadePage( - page: InsuranceUpdate(), + image != null + ? InkWell( + onTap: () => Navigator.push( + context, + FadePage( + page: InsuranceUpdate(), + ), + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Image.asset( + image, + height: SizeConfig.heightMultiplier * 5, + width: SizeConfig.heightMultiplier * 5, + color: Colors.white, + ), ), + ) + : IconButton( + icon: Icon(FontAwesomeIcons.home), + color: Colors.white, + onPressed: () { + Navigator.pushAndRemoveUntil( + context, + MaterialPageRoute( + builder: (context) => LandingPage()), + (Route r) => false); + }, ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Image.asset( - image, - height: SizeConfig.heightMultiplier * 5, - width: SizeConfig.heightMultiplier * 5, - color: Colors.white, - ), - ),): IconButton( - icon: Icon(FontAwesomeIcons.home), - color: Colors.white, - onPressed: () { - Navigator.pushAndRemoveUntil( - context, - MaterialPageRoute(builder: (context) => LandingPage()), - (Route r) => false); - }, - ), ], ) : null, - body: (!Provider.of(context, listen: false).isLogin && isShowDecPage) + body: (!Provider.of(context, listen: false).isLogin && + isShowDecPage) ? NotAutPage( title: appBarTitle, description: description, + infoList: infoList, ) : baseViewModel != null ? NetworkBaseView( @@ -135,6 +146,8 @@ class AppScaffold extends StatelessWidget { buildBodyWidget() { // return body; //Stack(children: [body, buildAppLoaderWidget(isLoading)]); - return Stack(children: [body, /*FloatingSearchButton()*/]); + return Stack(children: [ + body, /*FloatingSearchButton()*/ + ]); } } diff --git a/lib/widgets/others/not_auh_page.dart b/lib/widgets/others/not_auh_page.dart index 8f8ed729..a1a2f00c 100644 --- a/lib/widgets/others/not_auh_page.dart +++ b/lib/widgets/others/not_auh_page.dart @@ -11,8 +11,9 @@ import 'package:provider/provider.dart'; class NotAutPage extends StatelessWidget { final String title; final String description; + final List infoList; - NotAutPage({@required this.title, @required this.description}); + NotAutPage({@required this.title, @required this.description, this.infoList}); @override Widget build(BuildContext context) { @@ -30,6 +31,7 @@ class NotAutPage extends StatelessWidget { bold: true, color: Color(0xff60686b), ), + SizedBox( height: 12, ), @@ -38,6 +40,39 @@ class NotAutPage extends StatelessWidget { fontWeight: FontWeight.normal, fontSize: 17, ), + if (infoList != null) + SizedBox( + height: 12, + ), + if (infoList != null) + ...List.generate( + infoList.length, + (index) => Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + width: 30, + height: 30, + decoration: BoxDecoration( + // shape: BoxShape.circle, + borderRadius: BorderRadius.circular(15), + color: Theme.of(context).primaryColor), + child: Center( + child: Texts('${index+1}',color: Colors.white,), + ), + ), + SizedBox(width: 6,), + Expanded(child: Texts('${infoList[index]}')) + ], + ), + SizedBox(height: 12,), + ], + ), + ), + ), SizedBox( height: 22, ),