diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 1cdecf5b..f94a41cf 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -522,12 +522,9 @@ const Map localizedValues = { "PaymentOnline": {"en": "Service", "ar": "الالكتروني"}, "OnlineCheckIn": {"en": "Online Check-In", "ar": "مدفوعات معلقة"}, "MyBalances": {"en": "My Balances", "ar": "رصيدي"}, - "BalanceAmount": { "en": "Wallet Amount", "ar": "مبلغ المحفظة"}, - "TotalBalance": { "en": "Total Amount", "ar": "المبلغ الإجمالي"}, - "CreateAdvancedPayment": { - "en": "Recharge Wallet", - "ar": "إعادة شحن المحفظة" - }, + "BalanceAmount": {"en": "Wallet Amount", "ar": "مبلغ المحفظة"}, + "TotalBalance": {"en": "Total Amount", "ar": "المبلغ الإجمالي"}, + "CreateAdvancedPayment": {"en": "Recharge Wallet", "ar": "إعادة شحن المحفظة"}, "AdvancePayment": {"en": "Advance Payment", "ar": "الدفع مقدما"}, "AdvancePaymentLabel": { "en": @@ -1045,10 +1042,11 @@ const Map localizedValues = { "ar": "هذه الخدمة تم تصميمها لتتمكن من ربط الملفات الطبية للعائلة بملفك الطبي حتى تتمكن من إدارة سجلاتهم عن طريق تسجيل الدخول إلى ملفك الطبي." }, - "dental-complains": { - "en": "Symptoms", - "ar": "الأعراض" + "update-succ": { + "en": "Successfully updated profile", + "ar": "تم تحديث البيانات بنجاح" }, + "dental-complains": {"en": "Symptoms", "ar": "الأعراض"}, "empty-result": { "en": "There is no search results found", "ar": "لايوجد نتائج" @@ -1078,120 +1076,40 @@ const Map localizedValues = { "en": "Covid-19 Drive-Thru Test", "ar": "فحص كورونا من داخل السيارة" }, - "pharmacy": { - "en": "Pharmacy", - "ar": "الصيدلية" - }, - "ereferral": { - "en": "E-Referral", - "ar": "طلب التحويل" - }, - "child-vaccine": { - "en": "Child Vaccines", - "ar": "تطعيمات الأطفال" - }, - "calculators": { - "en": "Health Calculators", - "ar": "الحاسبات الصحية" - }, - "converters": { - "en": "Health Converter", - "ar": "تحويل القياسات" - }, - "h2o": { - "en": "Water Tracker", - "ar": "حساب كمية الماء" - }, - "v-tour": { - "en": "Virtual Tour", - "ar": "جولة إفتراضية" - }, - "hmg-news": { - "en": "HMG News", - "ar": "أخبار المجموعة" - }, - "blood-d": { - "en": "Blood Donation", - "ar": "تبرع بالدم" - }, - "symptomCheckerTitle": { - "en": "Symptom Checker", - "ar": "مدقق الأعراض" - }, - "latest-news": { - "en": "Latest News", - "ar": "أحدث الأخبار" - }, - "our-location": { - "en": "Our Locations", - "ar": "موقعنا" - }, - "pharmacies": { - "en": "Pharmacies", - "ar": "الصيدليات" - }, - "hospitals": { - "en": "Hospitals", - "ar": "المستشفيات" - }, - "wallet": { - "en": "Wallet", - "ar": "محفظة نقود" - }, - "hmg": { - "en": "Al Habib", - "ar": "الحبيب" - }, + "pharmacy": {"en": "Pharmacy", "ar": "الصيدلية"}, + "ereferral": {"en": "E-Referral", "ar": "طلب التحويل"}, + "child-vaccine": {"en": "Child Vaccines", "ar": "تطعيمات الأطفال"}, + "calculators": {"en": "Health Calculators", "ar": "الحاسبات الصحية"}, + "converters": {"en": "Health Converter", "ar": "تحويل القياسات"}, + "h2o": {"en": "Water Tracker", "ar": "حساب كمية الماء"}, + "v-tour": {"en": "Virtual Tour", "ar": "جولة إفتراضية"}, + "hmg-news": {"en": "HMG News", "ar": "أخبار المجموعة"}, + "blood-d": {"en": "Blood Donation", "ar": "تبرع بالدم"}, + "symptomCheckerTitle": {"en": "Symptom Checker", "ar": "مدقق الأعراض"}, + "latest-news": {"en": "Latest News", "ar": "أحدث الأخبار"}, + "our-location": {"en": "Our Locations", "ar": "موقعنا"}, + "pharmacies": {"en": "Pharmacies", "ar": "الصيدليات"}, + "hospitals": {"en": "Hospitals", "ar": "المستشفيات"}, + "wallet": {"en": "Wallet", "ar": "محفظة نقود"}, + "hmg": {"en": "Al Habib", "ar": "الحبيب"}, - "requested": { - "en": "Requested", - "ar": "مطلوب" - }, - "ready": { - "en": "Ready", - "ar": "جاهز" - }, - "completed": { - "en": "Completed", - "ar": "مكتمل" - }, - "cancelled": { - "en": "Cancelled", - "ar": "ملغى" - }, + "requested": {"en": "Requested", "ar": "مطلوب"}, + "ready": {"en": "Ready", "ar": "جاهز"}, + "completed": {"en": "Completed", "ar": "مكتمل"}, + "cancelled": {"en": "Cancelled", "ar": "ملغى"}, "request-medical-report": { "en": "Request medical report", "ar": "طلب تقرير طبي" }, - "insur-cards": { - "en": "Insurance Cards", - "ar": "بطاقات التأمين" - }, - 'labResult': { - "en": "Lab results", - "ar": "نتائج التحاليل المخبرية" - }, - 'details':{ - 'en':'Details', - 'ar':'التفاصيل' - }, - "active-insurence": { - "en": "Active", - "ar": "نشطة" - }, - "not-active": { - "en": "Not Active", - "ar": "غير نشط" - }, - "card-detail": { - "en": "Insurance Details", - "ar": "منافعك التامينية" - }, - "Dr": { - "en": "Dr. ", - "ar": "الدكتور." - }, + "insur-cards": {"en": "Insurance Cards", "ar": "بطاقات التأمين"}, + 'labResult': {"en": "Lab results", "ar": "نتائج التحاليل المخبرية"}, + 'details': {'en': 'Details', 'ar': 'التفاصيل'}, + "age": {"en": "Age", "ar": "العمر"}, + "active-insurence": {"en": "Active", "ar": "نشطة"}, + "not-active": {"en": "Not Active", "ar": "غير نشط"}, + "card-detail": {"en": "Insurance Details", "ar": "منافعك التامينية"}, + "Dr": {"en": "Dr. ", "ar": "الدكتور."}, "sendSuc":{ "en":"A copy has been sent to the email", "ar":"تم إرسال نسخة إلى البريد الإلكتروني" diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 408f8a6e..9154b9d3 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -157,9 +157,13 @@ class BaseAppClient { onFailure('Please Check The Internet Connection', -1); } } catch (e) { - print(e); - onFailure('Failed to connect to the server', -1); - // onFailure(e.toString(), -1); + //print(e); + // + if (e is String) { + onFailure(e.toString(), -1); + } else { + onFailure('Failed to connect to the server', -1); + } } } 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/DoctorProfile.dart b/lib/pages/BookAppointment/DoctorProfile.dart index 20e4ae09..392eb24c 100644 --- a/lib/pages/BookAppointment/DoctorProfile.dart +++ b/lib/pages/BookAppointment/DoctorProfile.dart @@ -53,17 +53,6 @@ class _DoctorProfileState extends State length: 2, vsync: this, initialIndex: widget.isOpenAppt == true ? 1 : 0); - - // event.controller.stream.listen((p) { - // if (p['clinic_id'] != null && - // p['doctor_id'] != null && - // p['project_id'] != null) { - // setState(() { - // // need to take the data from here - // // dropdownValue = p['clinic_id']; - // }); - // } - // }); _tabController = new TabController(length: 2, vsync: this); widget.authUser = new AuthenticatedUser(); widget.doctor.speciality = widget.docProfileList.specialty; @@ -164,7 +153,7 @@ class _DoctorProfileState extends State alignment: Alignment.center, child: Text( "(" + - widget.doctor.noOfPatientsRate.toString() + + widget.docProfileList.noOfPatientsRate.toString() + " " + TranslationBase.of(context).reviews + ")", @@ -496,7 +485,7 @@ class _DoctorProfileState extends State } double getRatingWidth(int patientNumber) { - var width = (patientNumber / this.widget.doctor.noOfPatientsRate) * 100; + var width = (patientNumber / this.widget.docProfileList.noOfPatientsRate) * 100; return width; } 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 109af9d1..4fc038a6 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -1,11 +1,17 @@ +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'; 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'; @@ -26,6 +32,8 @@ class _AppointmentDetailsState extends State with SingleTickerProviderStateMixin { static TabController _tabController; + List doctorDetailsList = List(); + @override void initState() { _tabController = new TabController(length: 2, vsync: this); @@ -34,38 +42,38 @@ 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, bottomSheet: AppointmentDetails.showFooterButton ? Container( - width: MediaQuery.of(context).size.width, - height: 50.0, - margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: goToBookConfirm, - child: Text(TranslationBase.of(context).bookNow, - style: TextStyle(fontSize: 18.0)), - ), - ), - ) + width: MediaQuery.of(context).size.width, + height: 50.0, + margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: new Color(0xFF60686b), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: goToBookConfirm, + child: Text(TranslationBase.of(context).bookNow, + style: TextStyle(fontSize: 18.0)), + ), + ), + ) : null, body: Container( color: new Color(0xFFf6f6f6), @@ -88,7 +96,8 @@ class _AppointmentDetailsState extends State ), ), Container( - margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), + margin: + EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), alignment: Alignment.center, child: Text( widget.appo.doctorTitle + @@ -103,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], @@ -123,19 +132,37 @@ class _AppointmentDetailsState extends State emptyIcon: Icons.star, ), ), + InkWell( + onTap: () { + getDoctorRatingsDetails(); + }, + child: Container( + margin: EdgeInsets.only(top: 5.0), + alignment: Alignment.center, + child: Text( + "(" + + widget.appo.noOfPatientsRate.toString() + + " " + + TranslationBase.of(context).reviews + + ")", + style: TextStyle( + fontSize: 14.0, + color: Colors.blue[800], + letterSpacing: 1.0, + decoration: TextDecoration.underline, + )), + ), + ), Container( - margin: EdgeInsets.only(top: 5.0), alignment: Alignment.center, - child: Text( - "(" + - widget.appo.noOfPatientsRate.toString() + - " Reviews)", - style: TextStyle( - fontSize: 14.0, - color: Colors.blue[800], - letterSpacing: 1.0, - decoration: TextDecoration.underline, - )), + 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), @@ -171,8 +198,14 @@ class _AppointmentDetailsState extends State child: TabBarView( physics: NeverScrollableScrollPhysics(), children: [ - AppointmentActions(appo: widget.appo, tabController: _tabController, enableFooterButton: enableFooterButton), - DocAvailableAppointments(doctor: getDoctorObject(), isLiveCareAppointment: widget.appo.isLiveCareAppointment) + AppointmentActions( + appo: widget.appo, + tabController: _tabController, + enableFooterButton: enableFooterButton), + DocAvailableAppointments( + doctor: getDoctorObject(), + isLiveCareAppointment: + widget.appo.isLiveCareAppointment) ], controller: _tabController, ), @@ -208,7 +241,292 @@ class _AppointmentDetailsState extends State selectedTime: DocAvailableAppointments.selectedTime))); } + getDoctorRatingsDetails() { + GifLoaderDialogUtils.showMyDialog(context); + DoctorsListService service = new DoctorsListService(); + service.getDoctorsRatingDetails(widget.appo.doctorID, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + doctorDetailsList.clear(); + res['DoctorRatingDetailsList'].forEach((v) { + doctorDetailsList.add(new DoctorRateDetails.fromJson(v)); + }); + showRatingDialog(doctorDetailsList); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + print(err); + }); + } + + void showRatingDialog(List doctorDetailsList) { + showGeneralDialog( + barrierColor: Colors.black.withOpacity(0.5), + transitionBuilder: (context, a1, a2, widget) { + final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0; + return Transform( + transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0), + child: Opacity( + opacity: a1.value, + child: Dialog( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + // height: 400.0, + width: MediaQuery.of(context).size.width * 0.8, + color: Colors.white, + child: Column( + children: [ + Container( + alignment: Alignment.center, + width: MediaQuery.of(context).size.width, + color: Theme.of(context).primaryColor, + margin: EdgeInsets.only(bottom: 5.0), + padding: EdgeInsets.all(10.0), + child: Text( + TranslationBase.of(context).doctorRating, + style: TextStyle( + fontSize: 22.0, color: Colors.white))), + Container( + margin: EdgeInsets.only(top: 0.0), + child: Text( + this + .widget + .appo + .actualDoctorRate + .ceilToDouble() + .toString(), + style: TextStyle( + fontSize: 32.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 5.0), + alignment: Alignment.center, + child: RatingBar.readOnly( + initialRating: + this.widget.appo.actualDoctorRate.toDouble(), + size: 35.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text( + this.widget.appo.noOfPatientsRate.toString() + + " " + + TranslationBase.of(context).reviews, + style: TextStyle( + fontSize: 14.0, color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Row( + children: [ + Container( + width: 100.0, + margin: EdgeInsets.only( + top: 10.0, left: 15.0, right: 15.0), + child: Text( + TranslationBase.of(context).excellent, + style: TextStyle( + fontSize: 13.0, + color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth( + doctorDetailsList[0].patientNumber), + height: 6.0, + child: Container( + color: Colors.green[700], + ), + ), + ), + ], + ), + ), + Container( + child: Row( + children: [ + Container( + width: 100.0, + margin: EdgeInsets.only( + top: 10.0, left: 15.0, right: 15.0), + child: Text( + TranslationBase.of(context).v_good, + style: TextStyle( + fontSize: 13.0, + color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth( + doctorDetailsList[1].patientNumber), + height: 6.0, + child: Container( + color: Color(0xffB7B723), + ), + ), + ), + ], + ), + ), + Container( + child: Row( + children: [ + Container( + width: 100.0, + margin: EdgeInsets.only( + top: 10.0, left: 15.0, right: 15.0), + child: Text( + TranslationBase.of(context).good, + style: TextStyle( + fontSize: 13.0, + color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth( + doctorDetailsList[2].patientNumber), + height: 6.0, + child: Container( + color: Color(0xffEBA727), + ), + ), + ), + ], + ), + ), + Container( + child: Row( + children: [ + Container( + width: 100.0, + margin: EdgeInsets.only( + top: 10.0, left: 15.0, right: 15.0), + child: Text( + TranslationBase.of(context).average, + style: TextStyle( + fontSize: 13.0, + color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth( + doctorDetailsList[3].patientNumber), + height: 6.0, + child: Container( + color: Color(0xffEB7227), + ), + ), + ), + ], + ), + ), + Container( + child: Row( + children: [ + Container( + width: 100.0, + margin: EdgeInsets.only( + top: 10.0, left: 15.0, right: 15.0), + child: Text( + TranslationBase.of(context) + .below_average, + style: TextStyle( + fontSize: 13.0, + color: Colors.black))), + Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth( + doctorDetailsList[4].patientNumber), + height: 6.0, + child: Container( + color: Color(0xffE20C0C), + ), + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 40.0), + child: Divider()), + Container( + margin: EdgeInsets.only(top: 0.0), + child: Align( + alignment: FractionalOffset.bottomCenter, + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width, + height: 40.0, + child: RaisedButton( + elevation: 0.0, + color: Colors.white, + textColor: Colors.red, + hoverColor: Colors.transparent, + focusColor: Colors.transparent, + highlightColor: Colors.transparent, + disabledColor: new Color(0xFFbcc2c4), + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text( + TranslationBase.of(context).cancel, + style: TextStyle(fontSize: 18.0)), + ), + ), + ), + ), + ], + ), + ), + ], + ), + ), + ), + ); + }, + transitionDuration: Duration(milliseconds: 500), + barrierDismissible: true, + barrierLabel: '', + context: context, + pageBuilder: (context, animation1, animation2) {}); + } + + double getRatingWidth(int patientNumber) { + var width = (patientNumber / this.widget.appo.noOfPatientsRate) * 100; + 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(); 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 c0399b8a..d8c5fd47 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -88,7 +88,7 @@ class _AppointmentActionsState extends State { Container( // height: 100.0, margin: EdgeInsets.all(7.0), - padding: EdgeInsets.only(bottom: 15.0), + padding: EdgeInsets.only(bottom: 4.0), decoration: BoxDecoration( boxShadow: [ BoxShadow( @@ -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 1bbe471a..a1e5c0e7 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentCardView.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentCardView.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/AppointmentType.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; @@ -5,6 +6,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; import 'package:flutter_countdown_timer/current_remaining_time.dart'; import 'package:flutter_countdown_timer/flutter_countdown_timer.dart'; +import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; import '../AppointmentDetails.dart'; @@ -23,6 +25,7 @@ class AppointmentCard extends StatefulWidget { class _ApointmentCardState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return InkWell( onTap: () { navigateToAppointmentDetails(context, widget.appo); @@ -46,7 +49,7 @@ class _ApointmentCardState extends State { fit: BoxFit.fill, height: 60.0, width: 60.0), ), Container( - width: MediaQuery.of(context).size.width * 0.57, + width: MediaQuery.of(context).size.width * 0.61, margin: EdgeInsets.fromLTRB(20.0, 10.0, 10.0, 0.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -77,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], @@ -101,30 +109,38 @@ class _ApointmentCardState extends State { Container( transform: Matrix4.translationValues(15.0, -40.0, 0.0), - child: Image.asset( - "assets/images/new-design/arrow.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/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index fb8990b2..95e10879 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -62,7 +62,7 @@ class _ToDoState extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).todoList, imagesInfo: imagesInfo, - isShowAppBar: true, + isShowAppBar: false, description: TranslationBase.of(context).infoTodo, body: SingleChildScrollView( child: Column( @@ -212,17 +212,23 @@ class _ToDoState extends State { ), Container( child: CountdownTimer( - endTime: DateTime.now().millisecondsSinceEpoch + + endTime: DateTime.now() + .millisecondsSinceEpoch + (widget.appoList[index] - .remaniningHoursTocanPay * - 1000) * + .remaniningHoursTocanPay * + 1000) * 60, - widgetBuilder: (_, CurrentRemainingTime time) { + widgetBuilder: + (_, CurrentRemainingTime time) { return Text( - '${time.days}:${time.hours}:${time.min}:${time.sec} ' + TranslationBase.of(context).upcomingTimeLeft, + '${time.days}:${time.hours}:${time.min}:${time.sec} ' + + TranslationBase.of( + context) + .upcomingTimeLeft, style: TextStyle( fontSize: 12.0, - color: Color(0xff40ACC9))); + color: + Color(0xff40ACC9))); }, ), ), @@ -529,7 +535,7 @@ class _ToDoState extends State { }).catchError((err) { print(err); GifLoaderDialogUtils.hideDialog(context); - AppToast.showErrorToast(message: err); + err != null ?? AppToast.showErrorToast(message: err); }); } diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index ad26b29b..1706ce8a 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -27,7 +27,7 @@ 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:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import '../../locator.dart'; class HomePage extends StatefulWidget { @@ -43,8 +43,8 @@ class _HomePageState extends State { ToDoCountProviderModel toDoProvider; - AuthenticatedUserObject authenticatedUserObject = locator(); - + AuthenticatedUserObject authenticatedUserObject = + locator(); @override Widget build(BuildContext context) { @@ -687,7 +687,7 @@ class _HomePageState extends State { ], ), ), - height: 100, + height: 106, imageName: 'ask_doctor_bg.png', //color: Colors.grey[700], width: MediaQuery.of(context).size.width * 0.45, @@ -780,7 +780,9 @@ class DashboardItem extends StatelessWidget { this.width, this.height, this.color, - this.opacity = 1.0,this.icon,this.margin=0}) + this.opacity = 1.0, + this.icon, + this.margin = 0}) : super(key: key); final bool hasBorder; final String imageName; diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 8de82ed1..d348060a 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -52,6 +52,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { ProjectViewModel projectViewModel; var notificationCount = ''; var themeNotifier; + ///inject the user data AuthenticatedUserObject authenticatedUserObject = locator(); @@ -140,18 +141,17 @@ class _LandingPageState extends State with WidgetsBindingObserver { _firebaseMessaging.setAutoInitEnabled(true); locationUtils = - new LocationUtils(isShowConfirmDialog: true, context: context); + new LocationUtils(isShowConfirmDialog: true, context: context); WidgetsBinding.instance .addPostFrameCallback((_) => locationUtils.getCurrentLocation()); - if (Platform.isIOS) { _firebaseMessaging.requestNotificationPermissions(); } _firebaseMessaging.getToken().then((String token) async { sharedPref.setString(PUSH_TOKEN, token); - if (token != null && await sharedPref.getObject(USER_PROFILE) ==null) { + if (token != null && await sharedPref.getObject(USER_PROFILE) == null) { DEVICE_TOKEN = token; checkUserStatus(token); } @@ -159,122 +159,124 @@ class _LandingPageState extends State with WidgetsBindingObserver { }).catchError((err) { print(err); }); + // + // //_firebase Background message handler Future.delayed(Duration.zero, () => setTheme()); //_firebase Background message handler // _firebaseMessaging.configure( - // onMessage: (Map message) async { - // showDialog("onMessage: $message"); - // print("onMessage: $message"); - // print(message); - // print(message['name']); - // print(message['appointmentdate']); - // - // if (Platform.isIOS) { - // if (message['is_call'] == "true") { - // var route = ModalRoute.of(context); - // - // if (route != null) { - // print(route.settings.name); - // } - // - // Map myMap = new Map.from(message); - // print(myMap); - // LandingPage.isOpenCallPage = true; - // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); - // if (!isPageNavigated) { - // isPageNavigated = true; - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => IncomingCall( - // incomingCallData: LandingPage.incomingCallData))) - // .then((value) { - // isPageNavigated = false; - // }); - // } - // } else { - // print("Is Call Not Found iOS"); - // } - // } else { - // print("Is Call Not Found iOS"); - // } - // - // if (Platform.isAndroid) { - // if (message['data'].containsKey("is_call")) { - // var route = ModalRoute.of(context); - // - // if (route != null) { - // print(route.settings.name); - // } - // - // Map myMap = - // new Map.from(message['data']); - // print(myMap); - // LandingPage.isOpenCallPage = true; - // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); - // if (!isPageNavigated) { - // isPageNavigated = true; - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => IncomingCall( - // incomingCallData: LandingPage.incomingCallData))) - // .then((value) { - // isPageNavigated = false; - // }); - // } - // } else { - // print("Is Call Not Found Android"); - // } - // } else { - // print("Is Call Not Found Android"); - // } - // }, - // onBackgroundMessage: Platform.isIOS ? null : myBackgroundMessageHandler, - // onLaunch: (Map message) async { - // print("onLaunch: $message"); - // showDialog("onLaunch: $message"); - // }, - // onResume: (Map message) async { - // print("onResume: $message"); - // print(message); - // print(message['name']); - // print(message['appointmentdate']); - // - // showDialog("onResume: $message"); - // - // if (Platform.isIOS) { - // if (message['is_call'] == "true") { - // var route = ModalRoute.of(context); - // - // if (route != null) { - // print(route.settings.name); - // } - // - // Map myMap = - // new Map.from(message); - // print(myMap); - // LandingPage.isOpenCallPage = true; - // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); - // if (!isPageNavigated) { - // isPageNavigated = true; - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => IncomingCall( - // incomingCallData: LandingPage.incomingCallData))) - // .then((value) { - // isPageNavigated = false; - // }); - // } - // } else { - // print("Is Call Not Found iOS"); - // } - // } else { - // print("Is Call Not Found iOS"); - // } - // }, - // ); + // // onMessage: (Map message) async { + // // showDialog("onMessage: $message"); + // // print("onMessage: $message"); + // // print(message); + // // print(message['name']); + // // print(message['appointmentdate']); + // // + // // if (Platform.isIOS) { + // // if (message['is_call'] == "true") { + // // var route = ModalRoute.of(context); + // // + // // if (route != null) { + // // print(route.settings.name); + // // } + // // + // // Map myMap = new Map.from(message); + // // print(myMap); + // // LandingPage.isOpenCallPage = true; + // // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); + // // if (!isPageNavigated) { + // // isPageNavigated = true; + // // Navigator.push( + // // context, + // // MaterialPageRoute( + // // builder: (context) => IncomingCall( + // // incomingCallData: LandingPage.incomingCallData))) + // // .then((value) { + // // isPageNavigated = false; + // // }); + // // } + // // } else { + // // print("Is Call Not Found iOS"); + // // } + // // } else { + // // print("Is Call Not Found iOS"); + // // } + // // + // // if (Platform.isAndroid) { + // // if (message['data'].containsKey("is_call")) { + // // var route = ModalRoute.of(context); + // // + // // if (route != null) { + // // print(route.settings.name); + // // } + // // + // // Map myMap = + // // new Map.from(message['data']); + // // print(myMap); + // // LandingPage.isOpenCallPage = true; + // // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); + // // if (!isPageNavigated) { + // // isPageNavigated = true; + // // Navigator.push( + // // context, + // // MaterialPageRoute( + // // builder: (context) => IncomingCall( + // // incomingCallData: LandingPage.incomingCallData))) + // // .then((value) { + // // isPageNavigated = false; + // // }); + // // } + // // } else { + // // print("Is Call Not Found Android"); + // // } + // // } else { + // // print("Is Call Not Found Android"); + // // } + // // }, + // // onBackgroundMessage: Platform.isIOS ? null : myBackgroundMessageHandler, + // // onLaunch: (Map message) async { + // // print("onLaunch: $message"); + // // showDialog("onLaunch: $message"); + // // }, + // // onResume: (Map message) async { + // // print("onResume: $message"); + // // print(message); + // // print(message['name']); + // // print(message['appointmentdate']); + // // + // // showDialog("onResume: $message"); + // // + // // if (Platform.isIOS) { + // // if (message['is_call'] == "true") { + // // var route = ModalRoute.of(context); + // // + // // if (route != null) { + // // print(route.settings.name); + // // } + // // + // // Map myMap = + // // new Map.from(message); + // // print(myMap); + // // LandingPage.isOpenCallPage = true; + // // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); + // // if (!isPageNavigated) { + // // isPageNavigated = true; + // // Navigator.push( + // // context, + // // MaterialPageRoute( + // // builder: (context) => IncomingCall( + // // incomingCallData: LandingPage.incomingCallData))) + // // .then((value) { + // // isPageNavigated = false; + // // }); + // // } + // // } else { + // // print("Is Call Not Found iOS"); + // // } + // // } else { + // // print("Is Call Not Found iOS"); + // // } + // // }, + // ); } showDialogs(String message) { @@ -390,7 +392,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { notificationCount, style: new TextStyle( color: Colors.white, - fontSize: projectViewModel.isArabic ? 8 : 9, + fontSize: projectViewModel.isArabic ? 8 : 9, ), textAlign: TextAlign.center, ), @@ -414,7 +416,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { SETTINGS, ); else - login(); + login(); }, //do something, ) ], @@ -428,7 +430,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { children: [ HomePage( goToMyProfile: () { - _changeCurrentTab(1); + // _changeCurrentTab(1); }, ), MedicalProfilePage(), @@ -464,50 +466,51 @@ class _LandingPageState extends State with WidgetsBindingObserver { case 2: return TranslationBase.of(context).bookAppo; case 3: - return TranslationBase.of(context).myFamily; - case 4: return TranslationBase.of(context).services; + case 4: + return TranslationBase.of(context).bookAppo; } } - setTheme() async{ - // - // defaultTheme = - // ThemeData( - // fontFamily:projectViewModel.isArabic ? 'Cairo' : 'WorkSans', - // primarySwatch: Colors.blue, - // visualDensity: VisualDensity.adaptivePlatformDensity, - // brightness: Brightness.light, - // pageTransitionsTheme: const PageTransitionsTheme( - // builders: { - // TargetPlatform.android: ZoomPageTransitionsBuilder(), - // TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), - // }, - // ), - // hintColor: Colors.grey[400], - // disabledColor: Colors.grey[300], - // errorColor: Color.fromRGBO(235, 80, 60, 1.0), - // scaffoldBackgroundColor: Color(0xffEEEEEE), - // textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), - // textSelectionHandleColor: Colors.grey, - // canvasColor: Colors.white, - // backgroundColor: Colors.white, - // highlightColor: Colors.grey[100].withOpacity(0.4), - // splashColor: Colors.transparent, - // primaryColor: Color(0xff40ACC9), - // bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), - // cursorColor: Colors.grey, - // cardColor: Colors.white, - // iconTheme: IconThemeData(), - // appBarTheme: AppBarTheme( - // color: Color(0xff40ACC9), - // brightness: Brightness.dark, - // elevation: 10.0, - // actionsIconTheme: IconThemeData( - // color: Color(0xff40ACC9), - // ), - // ), - // ); - // themeNotifier.setTheme(defaultTheme); + + setTheme() async { + // + // defaultTheme = + // ThemeData( + // fontFamily:projectViewModel.isArabic ? 'Cairo' : 'WorkSans', + // primarySwatch: Colors.blue, + // visualDensity: VisualDensity.adaptivePlatformDensity, + // brightness: Brightness.light, + // pageTransitionsTheme: const PageTransitionsTheme( + // builders: { + // TargetPlatform.android: ZoomPageTransitionsBuilder(), + // TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), + // }, + // ), + // hintColor: Colors.grey[400], + // disabledColor: Colors.grey[300], + // errorColor: Color.fromRGBO(235, 80, 60, 1.0), + // scaffoldBackgroundColor: Color(0xffEEEEEE), + // textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), + // textSelectionHandleColor: Colors.grey, + // canvasColor: Colors.white, + // backgroundColor: Colors.white, + // highlightColor: Colors.grey[100].withOpacity(0.4), + // splashColor: Colors.transparent, + // primaryColor: Color(0xff40ACC9), + // bottomSheetTheme: BottomSheetThemeData(backgroundColor: Color(0xffE0E0E0)), + // cursorColor: Colors.grey, + // cardColor: Colors.white, + // iconTheme: IconThemeData(), + // appBarTheme: AppBarTheme( + // color: Color(0xff40ACC9), + // brightness: Brightness.dark, + // elevation: 10.0, + // actionsIconTheme: IconThemeData( + // color: Color(0xff40ACC9), + // ), + // ), + // ); + // themeNotifier.setTheme(defaultTheme); } void checkUserStatus(token) async { authService @@ -522,8 +525,9 @@ class _LandingPageState extends State with WidgetsBindingObserver { .then((res) => {print(res)}); authService.getDashboard().then((value) => { setState(() { - notificationCount = value['List_PatientDashboard'] - [0]['UnreadPatientNotificationCount'].toString(); + notificationCount = value['List_PatientDashboard'][0] + ['UnreadPatientNotificationCount'] + .toString(); }) }); } @@ -555,6 +559,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { _changeCurrentTab(2); } } + login() async { var data = await sharedPref.getObject(IMEI_USER_DATA); sharedPref.remove(REGISTER_DATA_FOR_LOGIIN); diff --git a/lib/pages/login/login-type.dart b/lib/pages/login/login-type.dart index dcd58b9d..6113fb71 100644 --- a/lib/pages/login/login-type.dart +++ b/lib/pages/login/login-type.dart @@ -14,159 +14,168 @@ class LoginType extends StatelessWidget { @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle: TranslationBase.of(context).login, + appBarTitle: TranslationBase.of(context).login, isShowAppBar: true, isShowDecPage: false, - body: Padding( - padding: EdgeInsets.all(20), - child: Column( - children: [ - Expanded( - flex: 4, - child: Column( - // mainAxisAlignment: MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Image.asset( - 'assets/images/DQ/dq_logo_icon.png', - height: 90, - width: 90, - ), - AppText( - TranslationBase.of(context).logintypeRadio, - fontSize: SizeConfig.textMultiplier * 3.5, - textAlign: TextAlign.start, - marginBottom: 20.0, - marginTop: 20.0, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, + body: SingleChildScrollView( + child: Container( + padding: + EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30), + height: SizeConfig.realScreenHeight * .9, + width: SizeConfig.realScreenWidth, + child: Column( + children: [ + Expanded( + flex: 4, + child: Column( + // mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Expanded( - child: InkWell( - onTap: () => { - LoginType.loginType = 1, - Navigator.of(context) - .pushNamed(LOGIN_PAGE) - }, - child: RoundedContainer( - borderColor: Colors.grey, - showBorder: true, - child: Padding( - padding: EdgeInsets.fromLTRB( - 20, 10, 20, 10), - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Image.asset( - 'assets/images/id_card_icon.png', - height: SizeConfig - .imageSizeMultiplier * - 12, - width: SizeConfig - .imageSizeMultiplier * - 15, - ), - SizedBox( - height: 20, + Image.asset( + 'assets/images/DQ/dq_logo_icon.png', + height: 90, + width: 90, + ), + AppText( + TranslationBase.of(context).logintypeRadio, + fontSize: SizeConfig.textMultiplier * 3.5, + textAlign: TextAlign.start, + marginBottom: 20.0, + marginTop: 20.0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: InkWell( + onTap: () => { + LoginType.loginType = 1, + Navigator.of(context) + .pushNamed(LOGIN_PAGE) + }, + child: RoundedContainer( + borderColor: Colors.grey, + showBorder: true, + child: Padding( + padding: EdgeInsets.fromLTRB( + 20, 10, 20, 10), + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Image.asset( + 'assets/images/id_card_icon.png', + height: SizeConfig + .imageSizeMultiplier * + 12, + width: SizeConfig + .imageSizeMultiplier * + 15, + ), + SizedBox( + height: 20, + ), + AppText( + TranslationBase.of(context) + .idNo, + fontSize: SizeConfig + .textMultiplier * + 2, + fontWeight: FontWeight.bold, + ) + ], ), - AppText( - TranslationBase.of(context) - .idNo, - fontSize: - SizeConfig.textMultiplier * + )))), + Expanded( + child: InkWell( + onTap: () => { + LoginType.loginType = 2, + Navigator.of(context) + .pushNamed(LOGIN_PAGE) + }, + child: RoundedContainer( + borderColor: Colors.grey, + showBorder: true, + child: Padding( + padding: EdgeInsets.fromLTRB( + 25, 10, 25, 10), + child: Column( + children: [ + Image.asset( + 'assets/images/my_file_white_icon.png', + height: SizeConfig + .imageSizeMultiplier * + 12, + width: SizeConfig + .imageSizeMultiplier * + 15, + ), + SizedBox( + height: 20, + ), + AppText( + TranslationBase.of(context) + .fileNo, + fontSize: SizeConfig + .textMultiplier * 2, - fontWeight: FontWeight.bold, - ) - ], - ), - )))), - Expanded( + fontWeight: FontWeight.bold, + ) + ], + ), + )))) + ], + ), + SizedBox( + height: 25, + ), + Divider( + color: Colors.grey, + height: 2, + ), + Center( child: InkWell( onTap: () => { - LoginType.loginType = 2, Navigator.of(context) - .pushNamed(LOGIN_PAGE) + .pushNamed(FORGOT_PASSWORD) }, - child: RoundedContainer( - borderColor: Colors.grey, - showBorder: true, - child: Padding( - padding: EdgeInsets.fromLTRB( - 25, 10, 25, 10), - child: Column( - children: [ - Image.asset( - 'assets/images/my_file_white_icon.png', - height: SizeConfig - .imageSizeMultiplier * - 12, - width: SizeConfig - .imageSizeMultiplier * - 15, - ), - SizedBox( - height: 20, - ), - AppText( - TranslationBase.of(context) - .fileNo, - fontSize: - SizeConfig.textMultiplier * - 2, - fontWeight: FontWeight.bold, - ) - ], - ), - )))) - ], - ), - SizedBox(height: 25,), - Divider( - color: Colors.grey, - height: 2, - ), - Center( - child: InkWell( - onTap: () => { - Navigator.of(context) - .pushNamed(FORGOT_PASSWORD) - }, - child: AppText( - TranslationBase.of(context).forgotPassword, - fontSize: SizeConfig.textMultiplier * 2.5, - marginTop: 20.0, - underline: true))) - ]), - ), - Expanded( - flex: 1, - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Divider( - color: Colors.grey, - height: 2, - ), - SizedBox(height: 10,), - Row( + child: AppText( + TranslationBase.of(context) + .forgotPassword, + fontSize: + SizeConfig.textMultiplier * 2.5, + marginTop: 20.0, + underline: true))) + ]), + ), + Expanded( + flex: 1, + child: Column( + mainAxisAlignment: MainAxisAlignment.end, children: [ - - Expanded( - child: DefaultButton( - TranslationBase.of(context).registerNow, - () => { - Navigator.of(context).pushNamed( - REGISTER, - ) - }, - )), + Divider( + color: Colors.grey, + height: 2, + ), + SizedBox( + height: 10, + ), + Row( + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).registerNow, + () => { + Navigator.of(context).pushNamed( + REGISTER, + ) + }, + )), + ], + ), ], - ), - ], - )) - ], - ))); + )) + ], + )))); } } diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index db4ba713..8cbaab5a 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -153,18 +153,14 @@ class _Login extends State { } void validateForm() { - //TODO fix login - if (util.validateIDBox(nationalIDorFile.text, loginType) == - true /*&& - mobileNo.length >= 9 */ - && + if (util.validateIDBox(nationalIDorFile.text, loginType) == true && util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true) { setState(() { isButtonDisabled = false; }); } else { setState(() { - isButtonDisabled = false; + isButtonDisabled = true; }); } } diff --git a/lib/pages/medical/medical_profile_page.dart b/lib/pages/medical/medical_profile_page.dart index 41746f3c..37592733 100644 --- a/lib/pages/medical/medical_profile_page.dart +++ b/lib/pages/medical/medical_profile_page.dart @@ -81,11 +81,11 @@ class _MedicalProfilePageState extends State { padding: EdgeInsets.symmetric(vertical: 5.0), child: Column( children: [ - if(model.isLogin) - Container( - width: double.infinity, - height: 55, - ), + if (model.isLogin) + Container( + width: double.infinity, + height: 55, + ), Row( children: [ Expanded( @@ -112,29 +112,63 @@ class _MedicalProfilePageState extends State { .myAppointmentsList, hasBadge: true, ), - Positioned( - right: 0.0, - child: Badge( - toAnimate: false, - position: - BadgePosition.topEnd(), - shape: BadgeShape.circle, - badgeColor: Color(0xFF40ACC9) - .withOpacity(1.0), - borderRadius: - BorderRadius.circular(8), - badgeContent: Container( - padding: - EdgeInsets.all(2.0), - child: Text( - appoCountProvider.count - .toString(), - style: TextStyle( - color: Colors.white, - fontSize: 16.0)), - ), - ), - ), + projectViewModel.isArabic + ? Positioned( + left: 0.0, + child: Badge( + toAnimate: false, + shape: + BadgeShape.circle, + badgeColor: Color( + 0xFF40ACC9) + .withOpacity(1.0), + borderRadius: + BorderRadius + .circular(8), + badgeContent: Container( + padding: + EdgeInsets.all( + 2.0), + child: Text( + appoCountProvider + .count + .toString(), + style: TextStyle( + color: Colors + .white, + fontSize: + 16.0)), + ), + ), + ) + : Positioned( + right: 0.0, + child: Badge( + toAnimate: false, + shape: + BadgeShape.circle, + badgeColor: Color( + 0xFF40ACC9) + .withOpacity(1.0), + borderRadius: + BorderRadius + .circular(8), + badgeContent: Container( + padding: + EdgeInsets.all( + 2.0), + child: Text( + appoCountProvider + .count + .toString(), + style: TextStyle( + color: Colors + .white, + fontSize: + 16.0)), + ), + ), + ), ]) : MedicalProfileItem( title: TranslationBase.of(context) @@ -156,7 +190,8 @@ class _MedicalProfilePageState extends State { child: MedicalProfileItem( title: TranslationBase.of(context).lab, imagePath: 'lab_result_icon.png', - subTitle: TranslationBase.of(context).labSubtitle, + subTitle: TranslationBase.of(context) + .labSubtitle, ), ), ), diff --git a/lib/pages/medical/radiology/radiology_details_page.dart b/lib/pages/medical/radiology/radiology_details_page.dart index f4e9f0e5..0e0967d0 100644 --- a/lib/pages/medical/radiology/radiology_details_page.dart +++ b/lib/pages/medical/radiology/radiology_details_page.dart @@ -28,13 +28,24 @@ class RadiologyDetailsPage extends StatelessWidget { baseViewModel: model, body: SingleChildScrollView( child: Column( + mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, children: [ + Text( + '${finalRadiology.reportData}', + textAlign: TextAlign.center, + ), Padding( padding: const EdgeInsets.all(8.0), - child: Texts('${finalRadiology.reportData}',textAlign: TextAlign.start,fontSize: 17,), + child: Texts( + '${finalRadiology.reportData}', + textAlign: TextAlign.start, + fontSize: 17, + ), ), - SizedBox(height: MediaQuery.of(context).size.height * 0.2,) + SizedBox( + height: MediaQuery.of(context).size.height * 0.2, + ) ], ), ), @@ -43,6 +54,7 @@ class RadiologyDetailsPage extends StatelessWidget { height: model.radImageURL.isNotEmpty ? MediaQuery.of(context).size.height * 0.2:MediaQuery.of(context).size.height * 0.15, color: Colors.grey[100], child: Column( + mainAxisSize: MainAxisSize.min, children: [ Divider(), if(model.radImageURL.isNotEmpty) diff --git a/lib/pages/settings/profile_setting.dart b/lib/pages/settings/profile_setting.dart index c9089351..13ca5da6 100644 --- a/lib/pages/settings/profile_setting.dart +++ b/lib/pages/settings/profile_setting.dart @@ -9,9 +9,9 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; class ProfileSettings extends StatefulWidget { - @override _ProfileSettings createState() => _ProfileSettings(); } @@ -32,10 +32,10 @@ class _ProfileSettings extends State }); super.initState(); } - Widget build(BuildContext context) { + Widget build(BuildContext context) { return BaseView( - onModelReady: (model) =>{}, + onModelReady: (model) => {}, builder: (_, model, wi) => Container( child: ListView(scrollDirection: Axis.vertical, children: [ @@ -82,7 +82,6 @@ class _ProfileSettings extends State setState(() { language = value; }); - }, ) ], @@ -102,7 +101,6 @@ class _ProfileSettings extends State setState(() { language = value; }); - }, ) ], @@ -164,7 +162,7 @@ class _ProfileSettings extends State children: [ AppText(TranslationBase.of(context).email), TextField( - controller: emailController, + controller: emailController, decoration: InputDecoration( suffixIcon: Icon(Icons.edit), )) @@ -179,7 +177,7 @@ class _ProfileSettings extends State children: [ AppText(TranslationBase.of(context).emergencyName), TextField( - controller: emergencyContactName, + controller: emergencyContactName, decoration: InputDecoration( suffixIcon: Icon(Icons.edit), )) @@ -209,7 +207,7 @@ class _ProfileSettings extends State child: DefaultButton( TranslationBase.of(context).submit, () { - saveSettings(); + saveSettings(); }, )), ], @@ -217,14 +215,15 @@ class _ProfileSettings extends State ]))); } - getSettings(context){ + getSettings(context) { GifLoaderDialogUtils.showMyDialog(context); - authService.getSettings().then((result)=>{ - GifLoaderDialogUtils.hideDialog(context), - setValue(result["PateintInfoForUpdateList"][0]) - }); + authService.getSettings().then((result) => { + GifLoaderDialogUtils.hideDialog(context), + setValue(result["PateintInfoForUpdateList"][0]) + }); } - setValue(value){ + + setValue(value) { setState(() { this.language = int.parse(value["PreferredLanguage"]); this.emailAlert = value["IsEmailAlertRequired"]; @@ -233,20 +232,21 @@ class _ProfileSettings extends State this.emergencyContact.text = value["EmergencyContactNo"]; this.emergencyContactName.text = value["EmergencyContactName"]; }); - } - saveSettings(){ + + saveSettings() { GifLoaderDialogUtils.showMyDialog(context); Map request = {}; - request["EmailAddress"] =this.emailController.text; + request["EmailAddress"] = this.emailController.text; request["EmergencyContactName"] = this.emergencyContactName.text; request["EmergencyContactNo"] = this.emergencyContact.text; request["IsEmailAlertRequired"] = this.emailAlert; request["IsSMSAlertRequired"] = this.smsAlert; request["PreferredLanguage"] = this.language.toString(); - authService.saveSettings(request).then((result)=>{ - print(result), - GifLoaderDialogUtils.hideDialog(context) - }); + authService.saveSettings(request).then((result) => { + AppToast.showSuccessToast( + message: TranslationBase.of(context).profileUpdate), + GifLoaderDialogUtils.hideDialog(context) + }); } } diff --git a/lib/services/authentication/auth_provider.dart b/lib/services/authentication/auth_provider.dart index 59f51bfc..07e1e301 100644 --- a/lib/services/authentication/auth_provider.dart +++ b/lib/services/authentication/auth_provider.dart @@ -173,15 +173,19 @@ class AuthProvider with ChangeNotifier { request.generalid = GENERAL_ID; request.languageID = LANGUAGE_ID; request.patientOutSA = request.zipCode == '966' ? 0 : 1; - - dynamic localRes; - await new BaseAppClient().post(CHECK_PATIENT_AUTH, - onSuccess: (dynamic response, int statusCode) { - localRes = response; - }, onFailure: (String error, int statusCode) { + try { + dynamic localRes; + await new BaseAppClient().post(CHECK_PATIENT_AUTH, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request.toJson()); + return Future.value(localRes); + } catch (error) { throw error; - }, body: request.toJson()); - return Future.value(localRes); + //throw error; + } } Future getLoginInfo(request) async { diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 31523ec5..44280337 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -148,7 +148,7 @@ class TranslationBase { String get idNo => localizedValues['national-id'][locale.languageCode]; String get fileNo => localizedValues['fileNo'][locale.languageCode]; -String get fileno => localizedValues['fileno'][locale.languageCode]; + String get fileno => localizedValues['fileno'][locale.languageCode]; String get forgotPassword => localizedValues['forgotFileNo'][locale.languageCode]; @@ -791,7 +791,8 @@ String get fileno => localizedValues['fileno'][locale.languageCode]; String get modes => localizedValues['modes'][locale.languageCode]; String get vibration => localizedValues['vibration'][locale.languageCode]; String get blindMode => localizedValues['blind-modes'][locale.languageCode]; - String get invertTheme => localizedValues['invert-theme'][locale.languageCode]; + String get invertTheme => + localizedValues['invert-theme'][locale.languageCode]; String get offTheme => localizedValues['off-theme'][locale.languageCode]; String get dimTheme => localizedValues['dim-theme'][locale.languageCode]; String get bwTheme => localizedValues['bw-theme'][locale.languageCode]; @@ -805,8 +806,7 @@ String get fileno => localizedValues['fileno'][locale.languageCode]; localizedValues['accessibility'][locale.languageCode]; String get selectClinic => localizedValues['selectClinic'][locale.languageCode]; - String get reviews => - localizedValues['reviews'][locale.languageCode]; + String get reviews => localizedValues['reviews'][locale.languageCode]; String get orderStatus => localizedValues['orderStatus'][locale.languageCode]; String get cancelOrder => localizedValues['CancelOrder'][locale.languageCode]; @@ -814,9 +814,12 @@ String get fileno => localizedValues['fileno'][locale.languageCode]; String get feedback => localizedValues['Feedback'][locale.languageCode]; String get liveChat => localizedValues['LiveChat'][locale.languageCode]; String get service => localizedValues['Service'][locale.languageCode]; - String get hMGServiceLabel => localizedValues['HMGServiceLabel'][locale.languageCode]; - String get healthWeatherIndicators => localizedValues['HealthWeatherIndicators'][locale.languageCode]; - String get healthTipsBasedOnCurrentWeather => localizedValues['HealthTipsBasedOnCurrentWeather'][locale.languageCode]; + String get hMGServiceLabel => + localizedValues['HMGServiceLabel'][locale.languageCode]; + String get healthWeatherIndicators => + localizedValues['HealthWeatherIndicators'][locale.languageCode]; + String get healthTipsBasedOnCurrentWeather => + localizedValues['HealthTipsBasedOnCurrentWeather'][locale.languageCode]; String get moreDetails => localizedValues['MoreDetails'][locale.languageCode]; String get sendCopy => localizedValues['SendCopy'][locale.languageCode]; String get resendOrder => localizedValues['ResendOrder'][locale.languageCode]; @@ -830,7 +833,8 @@ String get fileno => localizedValues['fileno'][locale.languageCode]; String get mass => localizedValues['mass'][locale.languageCode]; String get tempC => localizedValues['temp-c'][locale.languageCode]; String get bpm => localizedValues['bpm'][locale.languageCode]; - String get respirationSigns => localizedValues['respiration-signs'][locale.languageCode]; + String get respirationSigns => + localizedValues['respiration-signs'][locale.languageCode]; String get sysDias => localizedValues['sys-dias'][locale.languageCode]; String get body => localizedValues['body'][locale.languageCode]; String get feedbackTitle => localizedValues['feedback'][locale.languageCode]; @@ -839,26 +843,39 @@ String get fileno => localizedValues['fileno'][locale.languageCode]; String get likeToHear => localizedValues['like-to-hear'][locale.languageCode]; String get subject => localizedValues['subject'][locale.languageCode]; String get message => localizedValues['message'][locale.languageCode]; - String get emptySubject => localizedValues['empty-subject'][locale.languageCode]; - String get emptyMessage => localizedValues['empty-message'][locale.languageCode]; - String get selectAttachment => localizedValues['select-attachment'][locale.languageCode]; - String get complainAppo => localizedValues['complain-appo'][locale.languageCode]; - String get complainWithoutAppo => localizedValues['complain-without-appo'][locale.languageCode]; + String get emptySubject => + localizedValues['empty-subject'][locale.languageCode]; + String get emptyMessage => + localizedValues['empty-message'][locale.languageCode]; + String get selectAttachment => + localizedValues['select-attachment'][locale.languageCode]; + String get complainAppo => + localizedValues['complain-appo'][locale.languageCode]; + String get complainWithoutAppo => + localizedValues['complain-without-appo'][locale.languageCode]; String get question => localizedValues['question'][locale.languageCode]; - String get messageType => localizedValues['message-type'][locale.languageCode]; + String get messageType => + localizedValues['message-type'][locale.languageCode]; String get compliment => localizedValues['compliment'][locale.languageCode]; String get suggestion => localizedValues['suggestion'][locale.languageCode]; - String get yourFeedback => localizedValues['your-feedback'][locale.languageCode]; + String get yourFeedback => + localizedValues['your-feedback'][locale.languageCode]; String get selectPart => localizedValues['select-part'][locale.languageCode]; String get number => localizedValues['number'][locale.languageCode]; - String get notClassified => localizedValues['not-classified'][locale.languageCode]; - String get searchItemError => localizedValues['searchItemError'][locale.languageCode]; + String get notClassified => + localizedValues['not-classified'][locale.languageCode]; + String get searchItemError => + localizedValues['searchItemError'][locale.languageCode]; String get youCanFind => localizedValues['YouCanFind'][locale.languageCode]; - String get itemInSearch => localizedValues['ItemInSearch'][locale.languageCode]; + String get itemInSearch => + localizedValues['ItemInSearch'][locale.languageCode]; String get invoiceNo => localizedValues['InvoiceNo'][locale.languageCode]; - String get specialResult => localizedValues['SpecialResult'][locale.languageCode]; - String get generalResult => localizedValues['GeneralResult'][locale.languageCode]; - String get showMoreBtn => localizedValues['show-more-btn'][locale.languageCode]; + String get specialResult => + localizedValues['SpecialResult'][locale.languageCode]; + String get generalResult => + localizedValues['GeneralResult'][locale.languageCode]; + String get showMoreBtn => + localizedValues['show-more-btn'][locale.languageCode]; String get value => localizedValues['value'][locale.languageCode]; String get range => localizedValues['range'][locale.languageCode]; String get outpatient => localizedValues['out-patient'][locale.languageCode]; @@ -868,71 +885,102 @@ String get fileno => localizedValues['fileno'][locale.languageCode]; String get sendCopyRad => localizedValues['send-copy'][locale.languageCode]; String get appoSurvey => localizedValues['appoSurvey'][locale.languageCode]; String get labResults => localizedValues['labResults'][locale.languageCode]; - String get doctorRating => localizedValues['doctorRating'][locale.languageCode]; + String get doctorRating => + localizedValues['doctorRating'][locale.languageCode]; String get good => localizedValues['good'][locale.languageCode]; String get v_good => localizedValues['v-good'][locale.languageCode]; String get excellent => localizedValues['excellent'][locale.languageCode]; - String get below_average => localizedValues['below-average'][locale.languageCode]; + String get below_average => + localizedValues['below-average'][locale.languageCode]; String get infoSigns => localizedValues['info-signs'][locale.languageCode]; - String get infoAdvancePayment => localizedValues['info-advance-payment'][locale.languageCode]; - String get infoMyBalance => localizedValues['info-my-balance'][locale.languageCode]; + String get infoAdvancePayment => + localizedValues['info-advance-payment'][locale.languageCode]; + String get infoMyBalance => + localizedValues['info-my-balance'][locale.languageCode]; String get erContant => localizedValues['er-contant'][locale.languageCode]; String get er => localizedValues['er'][locale.languageCode]; - String get transportationService => localizedValues['transportation-Service'][locale.languageCode]; - String get infoAmbulance => localizedValues['info-ambulance'][locale.languageCode]; - String get transportHeading => localizedValues['RRT-transport-heading'][locale.languageCode]; + String get transportationService => + localizedValues['transportation-Service'][locale.languageCode]; + String get infoAmbulance => + localizedValues['info-ambulance'][locale.languageCode]; + String get transportHeading => + localizedValues['RRT-transport-heading'][locale.languageCode]; String get sar => localizedValues['sar'][locale.languageCode]; - String get directionHeading => localizedValues['RRT-direction-heading'][locale.languageCode]; + String get directionHeading => + localizedValues['RRT-direction-heading'][locale.languageCode]; String get toHospital => localizedValues['to-hospital'][locale.languageCode]; - String get fromHospital => localizedValues['from-hospital'][locale.languageCode]; + String get fromHospital => + localizedValues['from-hospital'][locale.languageCode]; String get oneDirec => localizedValues['one-direc'][locale.languageCode]; String get twoDirec => localizedValues['two-direc'][locale.languageCode]; - String get pickupLocation => localizedValues['pickup-location'][locale.languageCode]; + String get pickupLocation => + localizedValues['pickup-location'][locale.languageCode]; String get pickupSpot => localizedValues['pickup-spot'][locale.languageCode]; String get insideHome => localizedValues['inside-home'][locale.languageCode]; String get haveAppo => localizedValues['have-appo'][locale.languageCode]; - String get dropoffLocation => localizedValues['dropoff-location'][locale.languageCode]; + String get dropoffLocation => + localizedValues['dropoff-location'][locale.languageCode]; String get selectAll => localizedValues['select-all'][locale.languageCode]; String get selectMap => localizedValues['select-map'][locale.languageCode]; - String get noAppointment => localizedValues['no-appointment'][locale.languageCode]; - String get patientShareB => localizedValues['patient-share'][locale.languageCode]; - String get patientShareTax => localizedValues['patient-share-tax'][locale.languageCode]; - String get patientShareTotal => localizedValues['patient-share-total'][locale.languageCode]; - String get selectAmbulate => localizedValues['select-ambulate'][locale.languageCode]; + String get noAppointment => + localizedValues['no-appointment'][locale.languageCode]; + String get patientShareB => + localizedValues['patient-share'][locale.languageCode]; + String get patientShareTax => + localizedValues['patient-share-tax'][locale.languageCode]; + String get patientShareTotal => + localizedValues['patient-share-total'][locale.languageCode]; + String get selectAmbulate => + localizedValues['select-ambulate'][locale.languageCode]; String get wheelchair => localizedValues['wheelchair'][locale.languageCode]; String get walker => localizedValues['walker"'][locale.languageCode]; String get stretcher => localizedValues['stretcher'][locale.languageCode]; String get none => localizedValues['none'][locale.languageCode]; String get RRTSummary => localizedValues['RRT-Summary'][locale.languageCode]; String get billAmount => localizedValues['bill-amount'][locale.languageCode]; - String get transportMethod => localizedValues['transport-method'][locale.languageCode]; + String get transportMethod => + localizedValues['transport-method'][locale.languageCode]; String get directions => localizedValues['directions'][locale.languageCode]; - String get infoMyAppointments => localizedValues['info-my-appointments'][locale.languageCode]; + String get infoMyAppointments => + localizedValues['info-my-appointments'][locale.languageCode]; String get infoTodo => localizedValues['info-todo'][locale.languageCode]; String get familyInfo => localizedValues['family-info'][locale.languageCode]; - String get dentalComplaints => localizedValues['dental-complains'][locale.languageCode]; - String get emptyResult => localizedValues['empty-result'][locale.languageCode]; - - String get noBookedAppo => localizedValues['no-booked-appointment'][locale.languageCode]; - String get noConfirmedAppo => localizedValues['no-confirmed-appointment'][locale.languageCode]; - String get noArrivedAppo => localizedValues['no-arrived-appointment'][locale.languageCode]; - String get upcomingEmpty => localizedValues['upcoming-empty'][locale.languageCode]; - String get upcomingTimeLeft => localizedValues['upcoming-timeLeft'][locale.languageCode]; - - String get covidTestAllServices => localizedValues['covid-test-all-services'][locale.languageCode]; + String get profileUpdate => + localizedValues['update-succ'][locale.languageCode]; + String get dentalComplaints => + localizedValues['dental-complains'][locale.languageCode]; + String get emptyResult => + localizedValues['empty-result'][locale.languageCode]; + + String get noBookedAppo => + localizedValues['no-booked-appointment'][locale.languageCode]; + String get noConfirmedAppo => + localizedValues['no-confirmed-appointment'][locale.languageCode]; + String get noArrivedAppo => + localizedValues['no-arrived-appointment'][locale.languageCode]; + String get upcomingEmpty => + localizedValues['upcoming-empty'][locale.languageCode]; + String get upcomingTimeLeft => + localizedValues['upcoming-timeLeft'][locale.languageCode]; + + String get covidTestAllServices => + localizedValues['covid-test-all-services'][locale.languageCode]; String get pharmacy => localizedValues['pharmacy'][locale.languageCode]; String get ereferral => localizedValues['ereferral'][locale.languageCode]; - String get childVaccine => localizedValues['child-vaccine'][locale.languageCode]; + String get childVaccine => + localizedValues['child-vaccine'][locale.languageCode]; String get calculators => localizedValues['calculators'][locale.languageCode]; String get converters => localizedValues['converters'][locale.languageCode]; String get h2o => localizedValues['h2o'][locale.languageCode]; String get vTour => localizedValues['v-tour'][locale.languageCode]; String get hmgNews => localizedValues['hmg-news'][locale.languageCode]; String get bloodD => localizedValues['blood-d'][locale.languageCode]; - String get symptomCheckerTitle => localizedValues['symptomCheckerTitle'][locale.languageCode]; + String get symptomCheckerTitle => + localizedValues['symptomCheckerTitle'][locale.languageCode]; String get latestNews => localizedValues['latest-news'][locale.languageCode]; - String get ourLocation => localizedValues['our-location'][locale.languageCode]; + String get ourLocation => + localizedValues['our-location'][locale.languageCode]; String get pharmacies => localizedValues['pharmacies'][locale.languageCode]; String get hospitals => localizedValues['hospitals'][locale.languageCode]; String get wallet => localizedValues['wallet'][locale.languageCode]; @@ -941,11 +989,14 @@ String get fileno => localizedValues['fileno'][locale.languageCode]; String get ready => localizedValues['ready'][locale.languageCode]; String get completed => localizedValues['completed'][locale.languageCode]; String get cancelled => localizedValues['cancelled'][locale.languageCode]; - String get requestMedicalReport => localizedValues['request-medical-report'][locale.languageCode]; + String get requestMedicalReport => + localizedValues['request-medical-report'][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 activeInsurence => localizedValues['active-insurence'][locale.languageCode]; + String get age => localizedValues['age'][locale.languageCode]; + String get activeInsurence => + localizedValues['active-insurence'][locale.languageCode]; String get notActive => localizedValues['not-active'][locale.languageCode]; String get cardDetail => localizedValues['card-detail'][locale.languageCode]; String get dr => localizedValues['Dr'][locale.languageCode]; diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index cc77d17d..41686aab 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -40,19 +40,15 @@ class _AppDrawerState extends State { var familyFileProvider = FamilyFilesProvider(); AuthenticatedUser user; AuthenticatedUser mainUser; - AuthenticatedUserObject authenticatedUserObject = locator< - AuthenticatedUserObject>(); + AuthenticatedUserObject authenticatedUserObject = + locator(); VitalSignService _vitalSignService = locator(); - @override Widget build(BuildContext context) { projectProvider = Provider.of(context); return SizedBox( - width: MediaQuery - .of(context) - .size - .width * 0.75, + width: MediaQuery.of(context).size.width * 0.75, child: Container( color: Colors.white, child: Drawer( @@ -64,359 +60,329 @@ class _AppDrawerState extends State { padding: EdgeInsets.zero, children: [ Container( - height: SizeConfig.screenHeight * .30, + height: SizeConfig.screenHeight * .27, + padding: EdgeInsets.all(15), child: InkWell( - child: DrawerHeader( - child: Column( - children: [ - Container( - child: - Image.asset('assets/images/DQ/DQ_logo.png'), - margin: EdgeInsets.all( - SizeConfig.imageSizeMultiplier * 4), - ), - (user != null && projectProvider.isLogin) - ? Padding( - padding: EdgeInsets.all(15), - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Row( - children: [ + child: Column( + children: [ + Container( + child: + Image.asset('assets/images/DQ/DQ_logo.png'), + margin: EdgeInsets.all( + SizeConfig.imageSizeMultiplier * 4), + ), + (user != null && projectProvider.isLogin) + ? Padding( + padding: EdgeInsets.all(10), + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Row( + children: [ + Padding( + padding: + EdgeInsets.only(right: 5), + child: Icon( + Icons.account_circle, + color: Color(0xFF40ACC9), + )), + AppText( + user.firstName + + ' ' + + user.lastName, + color: Color(0xFF40ACC9), + ) + ], + ), + Row(children: [ Padding( - padding: EdgeInsets.only( - right: 5), - child: Icon( - Icons.account_circle, - color: Color(0xFF40ACC9), - )), - AppText( - user.firstName + - ' ' + - user.lastName, - color: Color(0xFF40ACC9), - ) - ], - ), - Row(children: [ - Padding( - padding: EdgeInsets.only( - left: 30, top: 5), - child: Column( - children: [ - AppText( - TranslationBase - .of( - context) - .fileno + - ": " + - user.patientID - .toString(), - color: - Color(0xFF40ACC9), - fontSize: SizeConfig - .textMultiplier * - 1.5, - ), - AppText( - user.bloodGroup != null - ? 'Blood Group: ' + - user.bloodGroup - : '', - fontSize: SizeConfig - .textMultiplier * - 1.5, - ), - ], - )) - ]) - ])) - : SizedBox(), - ], - ), + padding: + EdgeInsets.only(left: 30), + child: Column( + children: [ + AppText( + TranslationBase.of( + context) + .fileno + + ": " + + user.patientID + .toString(), + color: Color(0xFF40ACC9), + fontSize: SizeConfig + .textMultiplier * + 1.5, + ), + AppText( + user.bloodGroup != null + ? 'Blood Group: ' + + user.bloodGroup + : '', + fontSize: SizeConfig + .textMultiplier * + 1.5, + ), + ], + )) + ]) + ])) + : SizedBox(), + ], ), ), ), Column( mainAxisAlignment: MainAxisAlignment.start, children: [ - InkWell( - child: DrawerItem( - TranslationBase - .of(context) - .arabicChange, - Icons.translate), - onTap: () { - // Navigator.of(context).pushNamed( - // WELCOME_LOGIN, - // ); - if (projectProvider.isArabic) { - projectProvider.changeLanguage('en'); - } else { - projectProvider.changeLanguage('ar'); - } - }, - ), (user != null && projectProvider.isLogin) ? Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - user.isFamily == null || user.isFamily == false - ? InkWell( - child: DrawerItem( - TranslationBase - .of(context) - .family, - Icons.group, - textColor: Color(0xFF40ACC9), - iconColor: Color(0xFF40ACC9), - bottomLine: false, - sideArrow: true, - ), - onTap: () { - Navigator.of(context).pushNamed( - MY_FAMILIY, - ); - }, - ) - : SizedBox(), - FutureBuilder( - future: getFamilyFiles(), // async work - builder: (BuildContext context, - AsyncSnapshot< - GetAllSharedRecordsByStatusResponse> - snapshot) { - switch (snapshot.connectionState) { - case ConnectionState.waiting: - return Padding( - padding: EdgeInsets.all(10), - child: Text('Loading....')); - default: - if (snapshot.hasError) - return Padding( - padding: EdgeInsets.all(10), - child: Text(snapshot.error)); - else - return Container( - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - // <--- left side - color: Colors.grey[200], - width: 1.0, - ), - )), - child: Column( - children: [ - user.isFamily == true - ? Container( - padding: - EdgeInsets.only( - bottom: 5), - child: InkWell( - onTap: () { - switchUser( - mainUser, - context); - }, - child: Row( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: < - Widget>[ - Expanded( - child: Icon( - Icons - .person), - ), - Expanded( - flex: 7, - child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: < - Widget>[ - AppText( - mainUser - .firstName + - ' ' + - mainUser - .lastName), - AppText( - TranslationBase - .of( - context) - .fileno + - ": " + - mainUser - .patientID - .toString()), - ])), - ], - ))) - : SizedBox(), - Column( - mainAxisAlignment: - MainAxisAlignment - .start, - mainAxisSize: - MainAxisSize.min, - children: snapshot.data - .getAllSharedRecordsByStatusList - .map( - (result) { - return result - .status == - 3 - ? Container( - padding: EdgeInsets - .only( - bottom: - 5), + mainAxisAlignment: MainAxisAlignment.start, + children: [ + user.isFamily == null || + user.isFamily == false + ? InkWell( + child: DrawerItem( + TranslationBase.of(context).family, + Icons.group, + textColor: Color(0xFF40ACC9), + iconColor: Color(0xFF40ACC9), + bottomLine: false, + sideArrow: true, + ), + onTap: () { + Navigator.of(context).pushNamed( + MY_FAMILIY, + ); + }, + ) + : SizedBox(), + FutureBuilder( + future: getFamilyFiles(), // async work + builder: (BuildContext context, + AsyncSnapshot< + GetAllSharedRecordsByStatusResponse> + snapshot) { + switch (snapshot.connectionState) { + case ConnectionState.waiting: + return Padding( + padding: EdgeInsets.all(10), + child: Text('Loading....')); + default: + if (snapshot.hasError) + return Padding( + padding: EdgeInsets.all(10), + child: Text(snapshot.error)); + else + return Container( + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + // <--- left side + color: Colors.grey[200], + width: 1.0, + ), + )), + child: Column( + children: [ + user.isFamily == true + ? Container( + padding: + EdgeInsets.only( + bottom: 5), child: InkWell( onTap: () { switchUser( - result, + mainUser, context); }, child: Row( crossAxisAlignment: - CrossAxisAlignment - .start, + CrossAxisAlignment + .start, children: < Widget>[ Expanded( - child: - Icon(Icons - .person, - color: result - .responseID == - user - .patientID - ? Color( - 0xFF40ACC9) - : Colors - .black), + child: Icon( + Icons + .person), ), Expanded( flex: 7, - child: Padding( - padding: EdgeInsets - .only( - left: 5, - right: 5), - child: Column( - crossAxisAlignment: CrossAxisAlignment - .start, - children: < - Widget>[ - AppText( - result - .patientName, - color: result - .responseID == - user - .patientID - ? Color( - 0xFF40ACC9) - : Colors - .black), - AppText( - TranslationBase - .of( - context) - .fileno + - ": " + - result - .iD - .toString(), - color: result - .responseID == - user - .patientID - ? Color( - 0xFF40ACC9) - : Colors - .black), - ]))), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText(mainUser.firstName + ' ' + mainUser.lastName), + AppText(TranslationBase.of(context).fileno + ": " + mainUser.patientID.toString()), + ])), ], ))) - : SizedBox(); - }).toList()) - ], - )); - } - }, - ), - InkWell( - child: DrawerItem( - TranslationBase - .of(context) - .notification, - Icons.notifications), - onTap: () { - //NotificationsPage - Navigator.of(context).pop(); - Navigator.push( - context, - MaterialPageRoute( - builder: (BuildContext context) => - NotificationsPage())); - }, - ), - InkWell( - child: DrawerItem( - TranslationBase - .of(context) - .appsetting, - Icons.settings_input_composite), - onTap: () { - Navigator.of(context).pushNamed( - SETTINGS, - ); - }, - ), - InkWell( - child: DrawerItem( - TranslationBase - .of(context) - .rateApp, - Icons.star), - onTap: () { - if (Platform.isIOS) { - launch( - "https://apps.apple.com/sa/app/dr-suliaman-alhabib/id733503978"); - } else { - launch( - "https://play.google.com/store/apps/details?id=com.ejada.hmg&hl=en"); - } - }, - ), - InkWell( - child: DrawerItem( - TranslationBase - .of(context) - .logout, - Icons.lock_open), - onTap: () { - logout(); - }, - ) - ], - ) - : InkWell( - child: DrawerItem( - TranslationBase - .of(context) - .loginregister, - Icons.lock_open), - onTap: () { - login(); - }, - ), + : SizedBox(), + Column( + mainAxisAlignment: + MainAxisAlignment + .start, + mainAxisSize: + MainAxisSize.min, + children: snapshot.data + .getAllSharedRecordsByStatusList + .map( + (result) { + return result + .status == + 3 + ? Container( + padding: EdgeInsets + .only( + bottom: + 5), + child: InkWell( + onTap: () { + switchUser( + result, + context); + }, + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: < + Widget>[ + Expanded( + child: + Icon(Icons.person, color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black), + ), + Expanded( + flex: 7, + child: Padding( + padding: EdgeInsets.only(left: 5, right: 5), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + AppText(result.patientName, color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black), + AppText(TranslationBase.of(context).fileno + ": " + result.iD.toString(), color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black), + ]))), + ], + ))) + : SizedBox(); + }).toList()) + ], + )); + } + }, + ), + InkWell( + child: DrawerItem( + TranslationBase.of(context) + .arabicChange, + Icons.translate), + onTap: () { + if (projectProvider.isArabic) { + projectProvider.changeLanguage('en'); + } else { + projectProvider.changeLanguage('ar'); + } + }, + ), + InkWell( + child: DrawerItem( + TranslationBase.of(context) + .notification, + Icons.notifications), + onTap: () { + //NotificationsPage + Navigator.of(context).pop(); + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + NotificationsPage())); + }, + ), + InkWell( + child: DrawerItem( + TranslationBase.of(context).appsetting, + Icons.settings_input_composite), + onTap: () { + Navigator.of(context).pushNamed( + SETTINGS, + ); + }, + ), + InkWell( + child: DrawerItem( + TranslationBase.of(context).rateApp, + Icons.star), + onTap: () { + if (Platform.isIOS) { + launch( + "https://apps.apple.com/sa/app/dr-suliaman-alhabib/id733503978"); + } else { + launch( + "https://play.google.com/store/apps/details?id=com.ejada.hmg&hl=en"); + } + }, + ), + InkWell( + child: DrawerItem( + TranslationBase.of(context).logout, + Icons.lock_open), + onTap: () { + logout(); + }, + ) + ], + ) + : Column( + children: [ + InkWell( + child: DrawerItem( + TranslationBase.of(context) + .loginregister, + Icons.lock_open), + onTap: () { + login(); + }, + ), + SizedBox( + height: 120, + ), + InkWell( + child: DrawerItem( + TranslationBase.of(context) + .arabicChange, + Icons.translate), + onTap: () { + if (projectProvider.isArabic) { + projectProvider.changeLanguage('en'); + } else { + projectProvider.changeLanguage('ar'); + } + }, + ), + InkWell( + child: DrawerItem( + TranslationBase.of(context).appsetting, + Icons.settings_input_composite), + onTap: () { + Navigator.of(context).pushNamed( + SETTINGS, + ); + }, + ), + InkWell( + child: DrawerItem( + TranslationBase.of(context).rateApp, + Icons.star), + onTap: () { + if (Platform.isIOS) { + launch( + "https://apps.apple.com/sa/app/dr-suliaman-alhabib/id733503978"); + } else { + launch( + "https://play.google.com/store/apps/details?id=com.ejada.hmg&hl=en"); + } + }, + ) + ], + ) ], ) ], @@ -435,9 +401,7 @@ class _AppDrawerState extends State { children: [ Column( children: [ - Text(TranslationBase - .of(context) - .poweredBy), + Text(TranslationBase.of(context).poweredBy), Image.asset( 'assets/images/cs_logo_container.png', width: SizeConfig.imageSizeMultiplier * 30, @@ -526,12 +490,11 @@ class _AppDrawerState extends State { this .familyFileProvider .silentLoggin(user is AuthenticatedUser ? null : user, - mainUser: user is AuthenticatedUser) + mainUser: user is AuthenticatedUser) .then((value) { GifLoaderDialogUtils.hideDialog(context); loginAfter(value, context); - }) - .catchError((err) { + }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); print(err); AppToast.showErrorToast(message: err); diff --git a/lib/widgets/others/floating_button_search.dart b/lib/widgets/others/floating_button_search.dart index 2d1f9109..afe4a299 100644 --- a/lib/widgets/others/floating_button_search.dart +++ b/lib/widgets/others/floating_button_search.dart @@ -826,13 +826,13 @@ class _FloatingSearchButton extends State speak() async { if (_currentLocaleId == 'en' && results['ReturnMessage'] != null) { - await flutterTts.setVoice("en-us-x-sfg#male_2-local"); + //await flutterTts.setVoice("en-us-x-sfg#male_2-local"); await flutterTts.setLanguage("en-US"); await flutterTts.speak(results['ReturnMessage']); } else if (results['ReturnMessage_Ar'] != null) { await flutterTts.setLanguage("ar-SA"); - await flutterTts.setVoice("ar-sa-x-sfg#male_1-local"); + //await flutterTts.setVoice("ar-sa-x-sfg#male_1-local"); await flutterTts.speak(results['ReturnMessage_Ar']); } // Future.delayed(const Duration(seconds: 10), () {