From 9d3c64200e835f20237aef1b4e5aa8392677e6ac Mon Sep 17 00:00:00 2001 From: Haroon Amjad Date: Thu, 10 Dec 2020 01:24:51 +0300 Subject: [PATCH] fixes --- lib/config/localized_values.dart | 4 ++ lib/pages/BookAppointment/BookConfirm.dart | 4 +- .../components/DocAvailableAppointments.dart | 1 + .../BookAppointment/components/DocInfo.dart | 7 ++- .../MyAppointments/AppointmentDetails.dart | 41 ++++++++++++- lib/pages/MyAppointments/MyAppointments.dart | 2 + .../MyAppointments/models/ArrivedButtons.dart | 4 +- .../widgets/AppointmentActions.dart | 5 +- .../widgets/AppointmentCardView.dart | 60 +++++++++++-------- lib/uitl/translations_delegate_base.dart | 3 +- 10 files changed, 91 insertions(+), 40 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index f7b5f234..1466f977 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1175,5 +1175,9 @@ const Map localizedValues = { 'details':{ 'en':'Details', 'ar':'التفاصيل' + }, + "age": { + "en": "Age", + "ar": "العمر" } }; diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 7a247b78..73975c58 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -325,7 +325,7 @@ class _BookConfirmState extends State { Container( margin: EdgeInsets.only(top: 5.0), child: Text( - "Gender: " + + TranslationBase.of(context).gender + ": " + widget.authUser.genderDescription, style: TextStyle( fontSize: 12.0, @@ -335,7 +335,7 @@ class _BookConfirmState extends State { Container( margin: EdgeInsets.only(top: 5.0, bottom: 3.0), child: Text( - "Age: " + widget.authUser.age.toString(), + TranslationBase.of(context).age + ": " + widget.authUser.age.toString(), style: TextStyle( fontSize: 12.0, color: Colors.grey[600], diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 70b6aaa0..8ac1d197 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -380,6 +380,7 @@ class _DocAvailableAppointmentsState extends State AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); print(err); }); } diff --git a/lib/pages/BookAppointment/components/DocInfo.dart b/lib/pages/BookAppointment/components/DocInfo.dart index aa6e3b9f..02c1eb90 100644 --- a/lib/pages/BookAppointment/components/DocInfo.dart +++ b/lib/pages/BookAppointment/components/DocInfo.dart @@ -13,6 +13,7 @@ class DoctorInformation extends StatelessWidget { return Container( margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), child: Column( + mainAxisSize: MainAxisSize.min, children: [ Card( shape: RoundedRectangleBorder( @@ -106,6 +107,7 @@ class DoctorInformation extends StatelessWidget { Container( margin: EdgeInsets.fromLTRB(20.0, 0.0, 10.0, 5.0), child: Column( + mainAxisSize: MainAxisSize.min, children: [ _getNormalText(docProfileList.doctorProfileInfo) ], @@ -123,7 +125,6 @@ class DoctorInformation extends StatelessWidget { return Text(text, style: TextStyle( fontSize: 13, - fontFamily: 'Open-Sans', fontWeight: FontWeight.bold, letterSpacing: 0.5, color: Colors.grey[800])); @@ -133,9 +134,9 @@ class DoctorInformation extends StatelessWidget { return Container( margin: EdgeInsets.only(top: 5.0), child: Text(text, + maxLines: 16, style: TextStyle( fontSize: 13, - fontFamily: 'Open-Sans', letterSpacing: 0.5, color: Colors.grey[700])), ); @@ -151,7 +152,7 @@ class DoctorInformation extends StatelessWidget { Text(text.trim(), style: TextStyle( fontSize: 13, - fontFamily: 'Open-Sans', + letterSpacing: 0.5, color: Colors.grey[700])), Container( diff --git a/lib/pages/MyAppointments/AppointmentDetails.dart b/lib/pages/MyAppointments/AppointmentDetails.dart index 4143d090..4fc038a6 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorRateDetails.dart'; @@ -5,10 +6,12 @@ import 'package:diplomaticquarterapp/pages/BookAppointment/BookConfirm.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/components/DocAvailableAppointments.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; import 'widgets/AppointmentActions.dart'; @@ -39,13 +42,13 @@ class _AppointmentDetailsState extends State @override void dispose() { - // TODO: implement dispose super.dispose(); _tabController.dispose(); } @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( appBarTitle: widget.appo.doctorNameObj, isShowAppBar: true, @@ -109,7 +112,7 @@ class _AppointmentDetailsState extends State Container( margin: EdgeInsets.only(top: 10.0), alignment: Alignment.center, - child: Text(widget.appo.clinicName, + child: Text(getDoctorSpeciality(widget.appo.doctorSpeciality), style: TextStyle( fontSize: 12.0, color: Colors.grey[900], @@ -139,7 +142,9 @@ class _AppointmentDetailsState extends State child: Text( "(" + widget.appo.noOfPatientsRate.toString() + - " Reviews)", + " " + + TranslationBase.of(context).reviews + + ")", style: TextStyle( fontSize: 14.0, color: Colors.blue[800], @@ -148,6 +153,17 @@ class _AppointmentDetailsState extends State )), ), ), + Container( + alignment: Alignment.center, + child: Text(DateUtil.getWeekDayMonthDayYearDateFormatted( + DateUtil.convertStringToDate( + widget.appo.appointmentDate), + projectViewModel.isArabic ? "ar" : "en")), + ), + Container( + alignment: Alignment.center, + child: Text(widget.appo.startTime), + ), Container( margin: EdgeInsets.only(top: 10.0), child: Divider( @@ -493,6 +509,25 @@ class _AppointmentDetailsState extends State return width; } + String getDate(String date) { + DateTime dateObj = DateUtil.convertStringToDate(date); + return DateUtil.getWeekDay(dateObj.weekday) + + ", " + + dateObj.day.toString() + + " " + + DateUtil.getMonth(dateObj.month) + + " " + + dateObj.year.toString(); + } + + String getDoctorSpeciality(List docSpecial) { + String docSpeciality = ""; + docSpecial.forEach((v) { + docSpeciality = docSpeciality + v + " "; + }); + return docSpeciality; + } + DoctorList getDoctorObject() { DoctorList docObj = new DoctorList(); docObj.doctorID = widget.appo.doctorID; diff --git a/lib/pages/MyAppointments/MyAppointments.dart b/lib/pages/MyAppointments/MyAppointments.dart index aa3b72ae..47e539a0 100644 --- a/lib/pages/MyAppointments/MyAppointments.dart +++ b/lib/pages/MyAppointments/MyAppointments.dart @@ -419,4 +419,6 @@ class _MyAppointmentsState extends State ), ); } + + } diff --git a/lib/pages/MyAppointments/models/ArrivedButtons.dart b/lib/pages/MyAppointments/models/ArrivedButtons.dart index a30349ba..a5132883 100644 --- a/lib/pages/MyAppointments/models/ArrivedButtons.dart +++ b/lib/pages/MyAppointments/models/ArrivedButtons.dart @@ -40,7 +40,7 @@ class ArrivedButtons { "caller": "insertComplaint" }, { - "title": TranslationBase.of(AppGlobal.context).insurance, + "title": TranslationBase.of(AppGlobal.context).insuranceApproval, "subtitle": TranslationBase.of(AppGlobal.context).insuranceSubtitle, "icon": "assets/images/new-design/insurance_approvals_icon.png", "caller": "Insurance" @@ -58,4 +58,4 @@ class ArrivedButtons { "caller": "Survey" } ]; -} +} \ No newline at end of file diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index 76c0633c..d8c5fd47 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -437,12 +437,11 @@ class _AppointmentActionsState extends State { navigateToMedicinePrescriptionReport( prescriptionReportEnhList, res['ListPRM']); } else { - AppToast.showErrorToast(message: "Sorry there is no data"); + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); - print(err); - AppToast.showErrorToast(message: err); + // AppToast.showErrorToast(message: err); }); } diff --git a/lib/pages/MyAppointments/widgets/AppointmentCardView.dart b/lib/pages/MyAppointments/widgets/AppointmentCardView.dart index 25d5e931..a1e5c0e7 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentCardView.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentCardView.dart @@ -80,7 +80,12 @@ class _ApointmentCardState extends State { ), Container( margin: EdgeInsets.only(top: 3.0, bottom: 3.0), - child: Text(getDate(widget.appo.appointmentDate).trim(), + child: Text( + DateUtil.getWeekDayMonthDayYearDateFormatted( + DateUtil.convertStringToDate( + widget.appo.appointmentDate), + projectViewModel.isArabic ? "ar" : "en") + .trim(), style: TextStyle( fontSize: 12.0, color: Colors.grey[600], @@ -104,33 +109,38 @@ class _ApointmentCardState extends State { Container( transform: Matrix4.translationValues(15.0, -40.0, 0.0), - child: projectViewModel.isArabic ? Image.asset( - "assets/images/new-design/arrow_menu_black-ar.png", - width: 25.0, - height: 25.0) : Image.asset( - "assets/images/new-design/arrow_menu_black-en.png", - width: 25.0, - height: 25.0), + child: projectViewModel.isArabic + ? Image.asset( + "assets/images/new-design/arrow_menu_black-ar.png", + width: 25.0, + height: 25.0) + : Image.asset( + "assets/images/new-design/arrow_menu_black-en.png", + width: 25.0, + height: 25.0), ), ], ), - widget.appo.patientStatusType == AppointmentType.BOOKED ? - Container( - child: CountdownTimer( - endTime: DateTime.now().millisecondsSinceEpoch + - (widget.appo.remaniningHoursTocanPay * 1000) * - 60, - widgetBuilder: (_, CurrentRemainingTime time) { - return Text( - '${time.days}:${time.hours}:${time.min}:${time.sec} ' + - TranslationBase.of(context) - .upcomingTimeLeft, - style: TextStyle( - fontSize: 12.0, - color: Color(0xff40ACC9))); - }, - ), - ) : Container(), + (widget.appo.patientStatusType == AppointmentType.BOOKED || + widget.appo.patientStatusType == + AppointmentType.CONFIRMED) + ? Container( + child: CountdownTimer( + endTime: DateTime.now().millisecondsSinceEpoch + + (widget.appo.remaniningHoursTocanPay * 1000) * + 60, + widgetBuilder: (_, CurrentRemainingTime time) { + return Text( + '${time.days}:${time.hours}:${time.min}:${time.sec} ' + + TranslationBase.of(context) + .upcomingTimeLeft, + style: TextStyle( + fontSize: 12.0, + color: Color(0xff40ACC9))); + }, + ), + ) + : Container(), ], ), ), diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 86e98b07..61107e30 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -945,8 +945,7 @@ String get fileno => localizedValues['fileno'][locale.languageCode]; String get insurCards => localizedValues['insur-cards'][locale.languageCode]; String get labResult => localizedValues['labResult'][locale.languageCode]; String get details => localizedValues['details'][locale.languageCode]; - - + String get age => localizedValues['age'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate {