From 468bb0356c15a803eb4f08e7130b66e1a3fc0f31 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 9 Dec 2020 12:38:56 +0300 Subject: [PATCH 1/6] updates & fixes --- lib/pages/ToDoList/ToDo.dart | 22 +++-- lib/pages/medical/medical_profile_page.dart | 93 +++++++++++++------ .../radiology/radiology_details_page.dart | 6 +- 3 files changed, 83 insertions(+), 38 deletions(-) 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/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 9f8a0640..ce4a4e3a 100644 --- a/lib/pages/medical/radiology/radiology_details_page.dart +++ b/lib/pages/medical/radiology/radiology_details_page.dart @@ -27,17 +27,21 @@ class RadiologyDetailsPage extends StatelessWidget { baseViewModel: model, body: SingleChildScrollView( child: Column( + mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text('${finalRadiology.reportData}',textAlign: TextAlign.center,), + SizedBox( + height: 160.0, + ) ], ), ), bottomSheet: Container( width: double.infinity, - height: MediaQuery.of(context).size.height * 0.2, color: Colors.grey[100], child: Column( + mainAxisSize: MainAxisSize.min, children: [ Divider(), Container( From c4bb75eab4492cb47748657784c80fbb4e42131b Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 9 Dec 2020 18:40:32 +0300 Subject: [PATCH 2/6] Doctor rating fixed --- lib/pages/BookAppointment/DoctorProfile.dart | 15 +- .../MyAppointments/AppointmentDetails.dart | 355 ++++++++++++++++-- .../widgets/AppointmentActions.dart | 2 +- .../widgets/AppointmentCardView.dart | 12 +- 4 files changed, 331 insertions(+), 53 deletions(-) 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/MyAppointments/AppointmentDetails.dart b/lib/pages/MyAppointments/AppointmentDetails.dart index 109af9d1..4143d090 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -1,8 +1,11 @@ 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/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'; @@ -26,6 +29,8 @@ class _AppointmentDetailsState extends State with SingleTickerProviderStateMixin { static TabController _tabController; + List doctorDetailsList = List(); + @override void initState() { _tabController = new TabController(length: 2, vsync: this); @@ -46,26 +51,26 @@ class _AppointmentDetailsState extends State 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 +93,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 + @@ -123,19 +129,24 @@ class _AppointmentDetailsState extends State emptyIcon: Icons.star, ), ), - 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, - )), + InkWell( + onTap: () { + getDoctorRatingsDetails(); + }, + child: 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, + )), + ), ), Container( margin: EdgeInsets.only(top: 10.0), @@ -171,8 +182,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 +225,273 @@ 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; + } DoctorList getDoctorObject() { DoctorList docObj = new DoctorList(); diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index c0399b8a..76c0633c 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( diff --git a/lib/pages/MyAppointments/widgets/AppointmentCardView.dart b/lib/pages/MyAppointments/widgets/AppointmentCardView.dart index 1bbe471a..25d5e931 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, @@ -101,8 +104,11 @@ class _ApointmentCardState extends State { Container( transform: Matrix4.translationValues(15.0, -40.0, 0.0), - child: Image.asset( - "assets/images/new-design/arrow.png", + 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), ), From 21ccf1ef86b54f8ce0c8433b7d260f1f101f5fb8 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Wed, 9 Dec 2020 21:48:21 +0300 Subject: [PATCH 3/6] bug fixes --- lib/core/service/client/base_app_client.dart | 10 +- lib/pages/landing/home_page.dart | 185 ++++++----- lib/pages/login/login-type.dart | 295 +++++++++--------- lib/pages/login/login.dart | 57 ++-- .../authentication/auth_provider.dart | 20 +- .../others/floating_button_search.dart | 4 +- 6 files changed, 312 insertions(+), 259 deletions(-) diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 0e940a53..1caea0fe 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/landing/home_page.dart b/lib/pages/landing/home_page.dart index fbdaf906..41f9f309 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 { @@ -49,8 +49,8 @@ class _HomePageState extends State { // }); // super.initState(); // } - AuthenticatedUserObject authenticatedUserObject = locator(); - + AuthenticatedUserObject authenticatedUserObject = + locator(); @override Widget build(BuildContext context) { @@ -93,9 +93,10 @@ class _HomePageState extends State { ) ], ), - ), - Container(width: double.infinity, height:projectViewModel.isArabic ? 120:110), + Container( + width: double.infinity, + height: projectViewModel.isArabic ? 120 : 110), ], ), Positioned( @@ -110,7 +111,7 @@ class _HomePageState extends State { Orientation.landscape ? 0.02 : 0.03), - child: (!model.isLogin ) + child: (!model.isLogin) ? Container( width: double.infinity, height: 160, @@ -179,7 +180,6 @@ class _HomePageState extends State { color: Theme.of(context) .primaryColor, fontSize: 14, - ), ), ), @@ -307,7 +307,9 @@ class _HomePageState extends State { bold: true, ), Texts( - TranslationBase.of(context).height, + TranslationBase.of( + context) + .height, color: Colors.white, fontSize: 10, ), @@ -339,7 +341,9 @@ class _HomePageState extends State { bold: true, ), Texts( - TranslationBase.of(context).weight, + TranslationBase.of( + context) + .weight, color: Colors.white, fontSize: 10, ) @@ -353,8 +357,10 @@ class _HomePageState extends State { ), Expanded( child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.center, children: [ Image.asset( 'assets/images/blood-drop.png', @@ -368,7 +374,9 @@ class _HomePageState extends State { color: Colors.white, ), Texts( - TranslationBase.of(context).bloodType, + TranslationBase.of( + context) + .bloodType, color: Colors.white, fontSize: 10, ) @@ -407,28 +415,35 @@ class _HomePageState extends State { padding: const EdgeInsets.all(15.0), child: Column( children: [ - SizedBox(height: 15,), - + SizedBox( + height: 15, + ), Container( width: 60, decoration: BoxDecoration( color: Colors.white, shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(12) - ), - child: Center(child: Image.asset('assets/images/vital_sign_icon.png', + borderRadius: + BorderRadius.circular(12)), + child: Center( + child: Image.asset( + 'assets/images/vital_sign_icon.png', width: 80, height: 50, - fit: BoxFit.contain,)), + fit: BoxFit.contain, + )), + ), + SizedBox( + height: 20, ), - SizedBox(height: 20,), Texts( - TranslationBase.of(context) - .vitalSigns, + TranslationBase.of(context).vitalSigns, textAlign: TextAlign.center, color: Colors.white, bold: true, - fontSize: projectViewModel.isArabic? SizeConfig.textMultiplier * 1.5 :SizeConfig.textMultiplier * 1.7, + fontSize: projectViewModel.isArabic + ? SizeConfig.textMultiplier * 1.5 + : SizeConfig.textMultiplier * 1.7, ) ], ), @@ -456,26 +471,35 @@ class _HomePageState extends State { padding: const EdgeInsets.all(15.0), child: Column( children: [ - SizedBox(height: 15,), + SizedBox( + height: 15, + ), Container( width: 50, decoration: BoxDecoration( color: Colors.white, shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(12) - ), - child: Center(child: Image.asset('assets/images/search_medicine_icon.png', + borderRadius: + BorderRadius.circular(12)), + child: Center( + child: Image.asset( + 'assets/images/search_medicine_icon.png', width: 50, height: 50, - fit: BoxFit.contain,)), + fit: BoxFit.contain, + )), + ), + SizedBox( + height: 20, ), - SizedBox(height: 20,), Texts( TranslationBase.of(context).searchMedicine, textAlign: TextAlign.center, color: Colors.white, bold: true, - fontSize: projectViewModel.isArabic? SizeConfig.textMultiplier * 1.5 :SizeConfig.textMultiplier * 1.7, + fontSize: projectViewModel.isArabic + ? SizeConfig.textMultiplier * 1.5 + : SizeConfig.textMultiplier * 1.7, ) ], ), @@ -487,8 +511,9 @@ class _HomePageState extends State { ), ), Expanded( - child: DashboardItem(opacity: 1.0, - onTap: (){ + child: DashboardItem( + opacity: 1.0, + onTap: () { Navigator.push( context, FadePage( @@ -501,25 +526,35 @@ class _HomePageState extends State { padding: const EdgeInsets.all(15.0), child: Column( children: [ - SizedBox(height: 15,), + SizedBox( + height: 15, + ), Container( decoration: BoxDecoration( color: Colors.white, shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(12) - ), - child: Center(child: Image.asset('assets/images/online_payment_icon.png', + borderRadius: + BorderRadius.circular(12)), + child: Center( + child: Image.asset( + 'assets/images/online_payment_icon.png', width: 80, height: 50, - fit: BoxFit.contain,)), + fit: BoxFit.contain, + )), + ), + SizedBox( + height: 15, ), - SizedBox(height: 15,), Texts( - TranslationBase.of(context).onlinePaymentService, + TranslationBase.of(context) + .onlinePaymentService, textAlign: TextAlign.center, color: Colors.white, bold: true, - fontSize: projectViewModel.isArabic? SizeConfig.textMultiplier * 1.5 :SizeConfig.textMultiplier * 1.7, + fontSize: projectViewModel.isArabic + ? SizeConfig.textMultiplier * 1.5 + : SizeConfig.textMultiplier * 1.7, ) ], ), @@ -555,34 +590,33 @@ class _HomePageState extends State { ); }, child: MedicalProfileItem( - title: TranslationBase.of(context) - .myAppointments, + title: + TranslationBase.of(context).myAppointments, imagePath: 'my_appointment_icon.png', - subTitle: TranslationBase.of(context).myAppointmentsList, + subTitle: TranslationBase.of(context) + .myAppointmentsList, ), ), ), Expanded( flex: 1, child: InkWell( - onTap: () => Navigator.push(context, - FadePage(page: LabsHomePage())), + onTap: () => Navigator.push( + context, FadePage(page: LabsHomePage())), child: MedicalProfileItem( title: TranslationBase.of(context).lab, imagePath: 'lab_result_icon.png', - subTitle: - TranslationBase.of(context).lab, + subTitle: TranslationBase.of(context).lab, ), ), ), Expanded( flex: 1, child: InkWell( - onTap: () => Navigator.push(context, - FadePage(page: RadiologyHomePage())), + onTap: () => Navigator.push( + context, FadePage(page: RadiologyHomePage())), child: MedicalProfileItem( - title: TranslationBase.of(context) - .radiology, + title: TranslationBase.of(context).radiology, imagePath: 'radiology_icon.png', subTitle: TranslationBase.of(context) .radiologySubtitle, @@ -605,8 +639,7 @@ class _HomePageState extends State { ); }, child: MedicalProfileItem( - title: TranslationBase.of(context) - .medicines, + title: TranslationBase.of(context).medicines, imagePath: 'prescription_icon.png', subTitle: TranslationBase.of(context) .medicinesSubtitle, @@ -625,8 +658,7 @@ class _HomePageState extends State { ); }, child: MedicalProfileItem( - title: TranslationBase.of(context) - .myDoctor, + title: TranslationBase.of(context).myDoctor, imagePath: 'doctor_icon.png', subTitle: TranslationBase.of(context) .myDoctorSubtitle, @@ -637,12 +669,11 @@ class _HomePageState extends State { flex: 1, child: InkWell( onTap: () { - Navigator.push(context, - FadePage(page: InsuranceCard())); + Navigator.push( + context, FadePage(page: InsuranceCard())); }, child: MedicalProfileItem( - title: TranslationBase.of(context) - .insurance, + title: TranslationBase.of(context).insurance, imagePath: 'insurance_card_icon.png', subTitle: TranslationBase.of(context) .insuranceSubtitle, @@ -651,7 +682,6 @@ class _HomePageState extends State { ), ], ), - ], ), ), @@ -664,7 +694,7 @@ class _HomePageState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ DashboardItem( - opacity:1.0, + opacity: 1.0, child: Container( width: double.infinity, padding: EdgeInsets.all(10), @@ -677,31 +707,38 @@ class _HomePageState extends State { bold: true, ), Texts( - TranslationBase.of(context).viewAllHabibMedicalService, + TranslationBase.of(context) + .viewAllHabibMedicalService, color: Colors.white, fontWeight: FontWeight.normal, fontSize: 10, ), - Expanded( - child: Container(), - ), - Texts( + // Expanded( + // child: Container(), + // ), + Text( TranslationBase.of(context).viewAll, - color: Colors.white, - bold: true, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold), + overflow: TextOverflow.ellipsis, ) ], ), ), - height: 100, + height: 106, imageName: 'ask_doctor_bg.png', - //color: Colors.grey[700], + //color: Colors.grey[700], width: MediaQuery.of(context).size.width * 0.45, onTap: () => Navigator.push( - context, FadePage(page: AllHabibMedicalService(goToMyProfile: widget.goToMyProfile,))), + context, + FadePage( + page: AllHabibMedicalService( + goToMyProfile: widget.goToMyProfile, + ))), ), DashboardItem( - opacity:1.0, + opacity: 1.0, onTap: () { Navigator.push( context, FadePage(page: ContactUsPage())); @@ -721,7 +758,7 @@ class _HomePageState extends State { TranslationBase.of(context).viewAllWaysReachUs, color: Colors.white, fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 1.0 , + fontSize: SizeConfig.textMultiplier * 1.0, ), Expanded( child: Container(), @@ -786,7 +823,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/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 a1540ef7..cb3ae1a4 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -93,23 +93,24 @@ class _Login extends State { onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value), - Directionality( - textDirection:TextDirection.ltr,child:Container( - child: TextFields( - fontWeight: FontWeight.normal, - controller: nationalIDorFile, - onChanged: (value) => {validateForm()}, - prefixIcon: Icon( - loginType == 1 - ? Icons.chrome_reader_mode - : Icons.receipt, - color: Color(0xFF40ACC9)), - padding: EdgeInsets.only( - top: 20, bottom: 20, left: 10, right: 10), - hintText: loginType == 1 - ? TranslationBase.of(context).nationalID - : TranslationBase.of(context).fileNo, - ))) + Directionality( + textDirection: TextDirection.ltr, + child: Container( + child: TextFields( + fontWeight: FontWeight.normal, + controller: nationalIDorFile, + onChanged: (value) => {validateForm()}, + prefixIcon: Icon( + loginType == 1 + ? Icons.chrome_reader_mode + : Icons.receipt, + color: Color(0xFF40ACC9)), + padding: EdgeInsets.only( + top: 20, bottom: 20, left: 10, right: 10), + hintText: loginType == 1 + ? TranslationBase.of(context).nationalID + : TranslationBase.of(context).fileNo, + ))) ], ), ), @@ -122,7 +123,9 @@ class _Login extends State { color: Colors.grey, height: 2, ), - SizedBox(height: 10,), + SizedBox( + height: 10, + ), Row( children: [ Expanded( @@ -152,18 +155,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; }); } } @@ -209,15 +208,13 @@ class _Login extends State { okText: TranslationBase.of(context).confirm, cancelText: TranslationBase.of(context).cancel_nocaps, okFunction: () => { - ConfirmDialog.closeAlertDialog(context), + ConfirmDialog.closeAlertDialog(context), Navigator.of(context).pushNamed( REGISTER, ), - }, cancelFunction: () => {ConfirmDialog.closeAlertDialog(context)}); dialog.showAlertDialog(context); - }); // SMSOTP.showLoadingDialog(context, false), } @@ -244,9 +241,9 @@ class _Login extends State { this.authService.checkActivationCode(request, code).then((result) => { sharedPref.remove(FAMILY_FILE), result = CheckActivationCode.fromJson(result), - result.list.isFamily =false, - this.sharedPref.setObject(USER_PROFILE, result.list), - this.sharedPref.setObject(MAIN_USER, result.list), + result.list.isFamily = false, + this.sharedPref.setObject(USER_PROFILE, result.list), + this.sharedPref.setObject(MAIN_USER, result.list), this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), this.sharedPref.setString(TOKEN, result.authenticationTokenID), authenticatedUserObject.getUser(), 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/widgets/others/floating_button_search.dart b/lib/widgets/others/floating_button_search.dart index 2bfacaea..babbf052 100644 --- a/lib/widgets/others/floating_button_search.dart +++ b/lib/widgets/others/floating_button_search.dart @@ -823,13 +823,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), () { From 9d3c64200e835f20237aef1b4e5aa8392677e6ac Mon Sep 17 00:00:00 2001 From: Haroon Amjad Date: Thu, 10 Dec 2020 01:24:51 +0300 Subject: [PATCH 4/6] 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 { From e28209d4e8808941b0262b4f1e8ddae8e448d04b Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Thu, 10 Dec 2020 08:23:19 +0300 Subject: [PATCH 5/6] bug fixes --- lib/config/localized_values.dart | 4 + lib/pages/landing/landing_page.dart | 335 +++++------ lib/pages/settings/profile_setting.dart | 42 +- lib/uitl/translations_delegate_base.dart | 116 ++-- lib/widgets/drawer/app_drawer_widget.dart | 645 ++++++++++------------ 5 files changed, 576 insertions(+), 566 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index e6be280b..68927062 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1044,5 +1044,9 @@ const Map localizedValues = { "Through this service, you will be able to link your family medical files to your medical file so that you can manage their records by login to your medical file.", "ar": "هذه الخدمة تم تصميمها لتتمكن من ربط الملفات الطبية للعائلة بملفك الطبي حتى تتمكن من إدارة سجلاتهم عن طريق تسجيل الدخول إلى ملفك الطبي." + }, + "update-succ": { + "en": "Successfully updated profile", + "ar": "تم تحديث البيانات بنجاح" } }; diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 8de82ed1..27797c30 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, ), @@ -405,16 +407,18 @@ class _LandingPageState extends State with WidgetsBindingObserver { IconButton( //iconSize: 70, icon: Icon( - projectViewModel.isLogin ? Icons.settings : Icons.login, + projectViewModel.isLogin && projectViewModel.user != null + ? Icons.settings + : Icons.login, color: Colors.white, ), onPressed: () { - if (projectViewModel.isLogin) + if (projectViewModel.isLogin && projectViewModel.user != null) Navigator.of(context).pushNamed( SETTINGS, ); else - login(); + login(); }, //do something, ) ], @@ -428,7 +432,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { children: [ HomePage( goToMyProfile: () { - _changeCurrentTab(1); + // _changeCurrentTab(1); }, ), MedicalProfilePage(), @@ -464,50 +468,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 +527,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 +561,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/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/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 2cb521d9..46347d4b 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,50 +885,69 @@ 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 profileUpdate => + localizedValues['update-succ'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index a45cba96..71cc3d2b 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -41,19 +41,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( @@ -65,359 +61,329 @@ class _AppDrawerState extends State { padding: EdgeInsets.zero, children: [ Container( - height: SizeConfig.screenHeight * .30, + height: SizeConfig.screenHeight * .25, + 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"); + } + }, + ) + ], + ) ], ) ], @@ -436,9 +402,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, @@ -527,12 +491,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); From 9d9d77ee3ac666d3c7c646b332a74a5d524d6054 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Thu, 10 Dec 2020 11:35:54 +0300 Subject: [PATCH 6/6] bug fixes --- lib/pages/landing/landing_page.dart | 6 ++---- lib/widgets/drawer/app_drawer_widget.dart | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 27797c30..d348060a 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -407,13 +407,11 @@ class _LandingPageState extends State with WidgetsBindingObserver { IconButton( //iconSize: 70, icon: Icon( - projectViewModel.isLogin && projectViewModel.user != null - ? Icons.settings - : Icons.login, + projectViewModel.isLogin ? Icons.settings : Icons.login, color: Colors.white, ), onPressed: () { - if (projectViewModel.isLogin && projectViewModel.user != null) + if (projectViewModel.isLogin) Navigator.of(context).pushNamed( SETTINGS, ); diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 48a09fb4..41686aab 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -60,7 +60,7 @@ class _AppDrawerState extends State { padding: EdgeInsets.zero, children: [ Container( - height: SizeConfig.screenHeight * .25, + height: SizeConfig.screenHeight * .27, padding: EdgeInsets.all(15), child: InkWell( child: Column(