From df31c82fd5ecd30924232289833cc6ea8131af94 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Wed, 6 Oct 2021 12:18:11 +0300 Subject: [PATCH] doctor header review on tap improvement. --- lib/models/header_model.dart | 5 +- lib/pages/BookAppointment/BookConfirm.dart | 1 + lib/pages/BookAppointment/BookSuccess.dart | 1 + lib/pages/BookAppointment/DoctorProfile.dart | 1 + .../BookAppointment/book_reminder_page.dart | 5 +- .../MyAppointments/AppointmentDetails.dart | 20 +- lib/pages/medical/eye/EyeHomePage.dart | 10 +- .../my_invoices/invoice_detail_page.dart | 156 +++--------- .../prescription_details_page.dart | 1 + .../prescription_items_page.dart | 1 + .../radiology/radiology_details_page.dart | 1 + .../LabResult/laboratory_result_widget.dart | 1 + lib/widgets/new_design/doctor_header.dart | 235 +++++++++++++++++- 13 files changed, 294 insertions(+), 144 deletions(-) diff --git a/lib/models/header_model.dart b/lib/models/header_model.dart index f80091f3..b1da8b17 100644 --- a/lib/models/header_model.dart +++ b/lib/models/header_model.dart @@ -1,5 +1,6 @@ class HeaderModel { String doctorName; + int doctorId; String doctorImageURL; List speciality; String invoiceNo; @@ -12,6 +13,6 @@ class HeaderModel { int totalReviews; String email; - HeaderModel(this.doctorName, this.doctorImageURL, this.speciality, this.invoiceNo, this.projectName, this.date, this.time, this.nationalityFlagURL, this.doctorRate, this.actualDoctorRate, - this.totalReviews, this.email); + HeaderModel(this.doctorName, this.doctorId, this.doctorImageURL, this.speciality, this.invoiceNo, this.projectName, this.date, this.time, this.nationalityFlagURL, this.doctorRate, + this.actualDoctorRate, this.totalReviews, this.email); } diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index fe49fd52..4a47dee1 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -74,6 +74,7 @@ class _BookConfirmState extends State { DoctorHeader( headerModel: HeaderModel( widget.doctor.name, + widget.doctor.doctorID, widget.doctor.doctorImageURL, widget.doctor.speciality, "", diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index d9499eeb..2c278f5e 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -60,6 +60,7 @@ class _BookSuccessState extends State { DoctorHeader( headerModel: HeaderModel( widget.docObject.name, + widget.docObject.doctorID, widget.docObject.doctorImageURL, widget.docObject.speciality, "", diff --git a/lib/pages/BookAppointment/DoctorProfile.dart b/lib/pages/BookAppointment/DoctorProfile.dart index 6d3a3afa..5e35d06a 100644 --- a/lib/pages/BookAppointment/DoctorProfile.dart +++ b/lib/pages/BookAppointment/DoctorProfile.dart @@ -103,6 +103,7 @@ class _DoctorProfileState extends State with TickerProviderStateM DoctorHeader( headerModel: HeaderModel( widget.doctor.name, + widget.doctor.doctorID, widget.doctor.doctorImageURL, widget.doctor.speciality, "", diff --git a/lib/pages/BookAppointment/book_reminder_page.dart b/lib/pages/BookAppointment/book_reminder_page.dart index fcdd8fd4..8066e369 100644 --- a/lib/pages/BookAppointment/book_reminder_page.dart +++ b/lib/pages/BookAppointment/book_reminder_page.dart @@ -70,6 +70,7 @@ class _BookReminderPageState extends State { DoctorHeader( headerModel: HeaderModel( widget.docObject.name, + widget.docObject.doctorID, widget.docObject.doctorImageURL, widget.docObject.speciality, "", @@ -191,7 +192,7 @@ class _BookReminderPageState extends State { disabledTextColor: Colors.white, disabledColor: CustomColors.green, onPressed: () async { - print(widget.patientShareResponse.appointmentNo); + print(widget.patientShareResponse.appointmentNo); showReminderDialog( context, widget.dateTime, @@ -201,7 +202,7 @@ class _BookReminderPageState extends State { widget.appoTimeFormatted, onSuccess: () { AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); - navigateToBookSuccess(context); + navigateToBookSuccess(context); }, ); }, diff --git a/lib/pages/MyAppointments/AppointmentDetails.dart b/lib/pages/MyAppointments/AppointmentDetails.dart index 13b86071..8bcfe9ca 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -94,6 +94,7 @@ class _AppointmentDetailsState extends State with SingleTick DoctorHeader( headerModel: HeaderModel( widget.appo.doctorTitle + " " + widget.appo.doctorNameObj, + widget.appo.doctorID, widget.appo.doctorImageURL, widget.appo.doctorSpeciality, "", @@ -107,7 +108,8 @@ class _AppointmentDetailsState extends State with SingleTick "", //model.user.emailAddress, ), - isNeedToShowButton: (widget.appo.clinicID == 17 || widget.appo.clinicID == 23 || widget.appo.clinicID == 265 || widget.appo.isExecludeDoctor || widget.appo.isLiveCareAppointment) ? false : true, + isNeedToShowButton: + (widget.appo.clinicID == 17 || widget.appo.clinicID == 23 || widget.appo.clinicID == 265 || widget.appo.isExecludeDoctor || widget.appo.isLiveCareAppointment) ? false : true, buttonTitle: TranslationBase.of(context).schedule, buttonIcon: 'assets/images/new/Boo_ Appointment.svg', showConfirmMessageDialog: false, @@ -357,13 +359,15 @@ class _AppointmentDetailsState extends State with SingleTick 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], + Expanded( + child: Container( + margin: EdgeInsets.only(top: 10.0), + child: SizedBox( + width: getRatingWidth(doctorDetailsList[0].patientNumber), + height: 6.0, + child: Container( + color: Colors.green[700], + ), ), ), ), diff --git a/lib/pages/medical/eye/EyeHomePage.dart b/lib/pages/medical/eye/EyeHomePage.dart index 4c945f7a..3d59af3d 100644 --- a/lib/pages/medical/eye/EyeHomePage.dart +++ b/lib/pages/medical/eye/EyeHomePage.dart @@ -41,10 +41,7 @@ class _EyeHomePageState extends State with SingleTickerProviderStat super.initState(); _tabController = TabController(length: 2, vsync: this); _tabController.addListener(() { - - setState(() { - - }); + setState(() {}); }); } @@ -61,7 +58,7 @@ class _EyeHomePageState extends State with SingleTickerProviderStat builder: (_, model, w) => AppScaffold( isShowAppBar: true, isShowDecPage: false, - appBarTitle: widget.appointmentAllHistoryResultList.doctorTitle + " " + widget.appointmentAllHistoryResultList.doctorNameObj, + appBarTitle: widget.appointmentAllHistoryResultList.doctorTitle + " " + widget.appointmentAllHistoryResultList.doctorNameObj, showNewAppBarTitle: true, showNewAppBar: true, backgroundColor: CustomColors.appBackgroudGreyColor, @@ -70,6 +67,7 @@ class _EyeHomePageState extends State with SingleTickerProviderStat DoctorHeader( headerModel: HeaderModel( widget.appointmentAllHistoryResultList.doctorTitle + " " + widget.appointmentAllHistoryResultList.doctorNameObj, + widget.appointmentAllHistoryResultList.doctorID, widget.appointmentAllHistoryResultList.doctorImageURL, widget.appointmentAllHistoryResultList.doctorSpeciality, "", @@ -83,7 +81,7 @@ class _EyeHomePageState extends State with SingleTickerProviderStat "", //model.user.emailAddress, ), - isNeedToShowButton: _tabController.index==0?true:projectViewModel.havePrivilege(15), + isNeedToShowButton: _tabController.index == 0 ? true : projectViewModel.havePrivilege(15), showConfirmMessageDialog: true, onRatingAndReviewTap: getDoctorRatingsDetails, onTap: () { diff --git a/lib/pages/medical/my_invoices/invoice_detail_page.dart b/lib/pages/medical/my_invoices/invoice_detail_page.dart index 13fd8e6f..0f35a96f 100644 --- a/lib/pages/medical/my_invoices/invoice_detail_page.dart +++ b/lib/pages/medical/my_invoices/invoice_detail_page.dart @@ -27,8 +27,7 @@ class InvoiceDetail extends StatefulWidget { final DentalInvoiceDetailResponse dentalInvoiceDetailResponse; final BuildContext context; - InvoiceDetail(this.doctor, this.listDentalAppointments, - this.dentalInvoiceDetailResponse, this.context); + InvoiceDetail(this.doctor, this.listDentalAppointments, this.dentalInvoiceDetailResponse, this.context); @override _InvoiceDetailState createState() => _InvoiceDetailState(); @@ -50,11 +49,7 @@ class _InvoiceDetailState extends State { ProjectViewModel projectViewModel = Provider.of(context); generateInvoiceDetails(); return AppScaffold( - appBarTitle: widget.doctor.doctorTitle != null - ? widget.doctor.doctorTitle.toString() - : TranslationBase.of(context).dr + - " " + - widget.doctor.name.toString(), + appBarTitle: widget.doctor.doctorTitle != null ? widget.doctor.doctorTitle.toString() : TranslationBase.of(context).dr + " " + widget.doctor.name.toString(), isShowAppBar: true, isShowDecPage: false, showNewAppBar: true, @@ -67,6 +62,7 @@ class _InvoiceDetailState extends State { DoctorHeader( headerModel: HeaderModel( widget.doctor.name, + widget.doctor.doctorID, widget.doctor.doctorImageURL, widget.doctor.speciality, widget.doctor.clinicName, @@ -76,7 +72,7 @@ class _InvoiceDetailState extends State { widget.doctor.nationalityFlagURL, widget.doctor.doctorRate, widget.doctor.actualDoctorRate, - widget.doctor.noOfPatientsRate, + widget.doctor.noOfPatientsRate ?? 0, projectViewModel.user.emailAddress), onTap: () { sendInvoiceEmail(); @@ -86,8 +82,7 @@ class _InvoiceDetailState extends State { child: Card( elevation: 3.0, shape: cardRadius(12), - margin: EdgeInsets.only( - left: 16, top: 8, right: 16, bottom: 16), + margin: EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16), child: Padding( padding: const EdgeInsets.all(12.0), child: Column( @@ -112,8 +107,7 @@ class _InvoiceDetailState extends State { child: Card( elevation: 3.0, shape: cardRadius(12), - margin: EdgeInsets.only( - left: 16, top: 8, right: 16, bottom: 16), + margin: EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16), child: Padding( padding: const EdgeInsets.all(15.0), child: Column( @@ -121,29 +115,12 @@ class _InvoiceDetailState extends State { children: [ Container( margin: EdgeInsets.only(bottom: 10.0), - child: Text(TranslationBase.of(context).cardDetail, - style: TextStyle( - color: Colors.black, - letterSpacing: -0.64, - fontSize: 18.0, - fontWeight: FontWeight.bold)), + child: Text(TranslationBase.of(context).cardDetail, style: TextStyle(color: Colors.black, letterSpacing: -0.64, fontSize: 18.0, fontWeight: FontWeight.bold)), ), - myRichText( - TranslationBase.of(context).insuranceCompany + - ": ", - widget.dentalInvoiceDetailResponse - .listEInvoiceForDental[0].companyName, - projectViewModel.isArabic), + myRichText(TranslationBase.of(context).insuranceCompany + ": ", widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].companyName, projectViewModel.isArabic), myRichText( TranslationBase.of(context).insuranceID + ": ", - widget - .dentalInvoiceDetailResponse - .listEInvoiceForDental[0] - .insuranceID != - null - ? widget.dentalInvoiceDetailResponse - .listEInvoiceForDental[0].insuranceID - : "N/A", + widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].insuranceID != null ? widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].insuranceID : "N/A", projectViewModel.isArabic), ], ), @@ -155,8 +132,7 @@ class _InvoiceDetailState extends State { child: Card( elevation: 3.0, shape: cardRadius(12), - margin: EdgeInsets.only( - left: 16, top: 8, right: 16, bottom: 16), + margin: EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16), child: Padding( padding: const EdgeInsets.all(15.0), child: Column( @@ -164,13 +140,7 @@ class _InvoiceDetailState extends State { children: [ Container( margin: EdgeInsets.only(bottom: 10.0), - child: Text( - TranslationBase.of(context).totalBalance, - style: TextStyle( - letterSpacing: -0.64, - color: Colors.black, - fontSize: 18.0, - fontWeight: FontWeight.bold)), + child: Text(TranslationBase.of(context).totalBalance, style: TextStyle(letterSpacing: -0.64, color: Colors.black, fontSize: 18.0, fontWeight: FontWeight.bold)), ), Container( width: double.infinity, @@ -178,15 +148,10 @@ class _InvoiceDetailState extends State { child: Row( children: [ Expanded( - child: _getNormalText( - TranslationBase.of(context).discount), + child: _getNormalText(TranslationBase.of(context).discount), ), Expanded( - child: _getNormalText( - this.totalDiscount.toString() + - " " + - TranslationBase.of(context).sar, - isBold: true), + child: _getNormalText(this.totalDiscount.toString() + " " + TranslationBase.of(context).sar, isBold: true), ) ], ), @@ -198,26 +163,13 @@ class _InvoiceDetailState extends State { child: Row( children: [ Expanded( - child: _getNormalText( - TranslationBase.of(context) - .totalVAT - .toString() + - " (" + - widget - .dentalInvoiceDetailResponse - .listEInvoiceForDental[0] - .listConsultation[0] - .vATPercentage - .toString() + - "%): "), + child: _getNormalText(TranslationBase.of(context).totalVAT.toString() + + " (" + + widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[0].vATPercentage.toString() + + "%): "), ), Expanded( - child: _getNormalText( - num.tryParse(this.totalVAT.toString()) - .toStringAsFixed(2) + - " " + - TranslationBase.of(context).sar, - isBold: true), + child: _getNormalText(num.tryParse(this.totalVAT.toString()).toStringAsFixed(2) + " " + TranslationBase.of(context).sar, isBold: true), ) ], ), @@ -229,15 +181,10 @@ class _InvoiceDetailState extends State { child: Row( children: [ Expanded( - child: _getNormalText( - TranslationBase.of(context).total), + child: _getNormalText(TranslationBase.of(context).total), ), Expanded( - child: _getNormalText( - this.subTotal.toString() + - " " + - TranslationBase.of(context).sar, - isBold: true), + child: _getNormalText(this.subTotal.toString() + " " + TranslationBase.of(context).sar, isBold: true), ) ], ), @@ -249,15 +196,10 @@ class _InvoiceDetailState extends State { child: Row( children: [ Expanded( - child: _getNormalText( - TranslationBase.of(context).paid), + child: _getNormalText(TranslationBase.of(context).paid), ), Expanded( - child: _getNormalText( - this.grandTotal.toString() + - " " + - TranslationBase.of(context).sar, - isBold: true), + child: _getNormalText(this.grandTotal.toString() + " " + TranslationBase.of(context).sar, isBold: true), ) ], ), @@ -284,10 +226,8 @@ class _InvoiceDetailState extends State { List listConsultations = new List(); - widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation - .forEach((item) { - var i = listConsultations - .indexWhere((x) => x.procedureID == item.procedureID); + widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation.forEach((item) { + var i = listConsultations.indexWhere((x) => x.procedureID == item.procedureID); if (i <= -1) { listConsultations.add(item); } @@ -308,16 +248,10 @@ class _InvoiceDetailState extends State { GifLoaderDialogUtils.showMyDialog(widget.context); MyInvoicesService myInvoicesService = new MyInvoicesService(); - myInvoicesService - .sendDentalAppointmentInvoiceEmail( - widget.listDentalAppointments.projectID, - widget.listDentalAppointments.appointmentNo, - widget.context) - .then((res) { + myInvoicesService.sendDentalAppointmentInvoiceEmail(widget.listDentalAppointments.projectID, widget.listDentalAppointments.appointmentNo, widget.context).then((res) { GifLoaderDialogUtils.hideDialog(widget.context); if (res['MessageStatus'] == 1) { - AppToast.showSuccessToast( - message: TranslationBase.of(widget.context).emailSentSuccessfully); + AppToast.showSuccessToast(message: TranslationBase.of(widget.context).emailSentSuccessfully); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } @@ -342,37 +276,17 @@ class _InvoiceDetailState extends State { ], ), ); - for (int i = 0; - i < - widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0] - .listConsultation.length; - i++) { + for (int i = 0; i < widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation.length; i++) { tableRow.add( TableRow(children: [ - Utils.tableColumnValue( - '${widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[i].procedureName}', - isLast: i == - (widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0] - .listConsultation.length - - 1)), - Utils.tableColumnValue( - '${widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[i].quantity}', - isLast: i == - (widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0] - .listConsultation.length - - 1)), - Utils.tableColumnValue( - '${widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[i].price.toString() + " " + TranslationBase.of(context).sar}', - isLast: i == - (widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0] - .listConsultation.length - - 1)), - Utils.tableColumnValue( - '${widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[i].total.toString() + " " + TranslationBase.of(context).sar}', - isLast: i == - (widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0] - .listConsultation.length - - 1)), + Utils.tableColumnValue('${widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[i].procedureName}', + isLast: i == (widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation.length - 1)), + Utils.tableColumnValue('${widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[i].quantity}', + isLast: i == (widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation.length - 1)), + Utils.tableColumnValue('${widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[i].price.toString() + " " + TranslationBase.of(context).sar}', + isLast: i == (widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation.length - 1)), + Utils.tableColumnValue('${widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation[i].total.toString() + " " + TranslationBase.of(context).sar}', + isLast: i == (widget.dentalInvoiceDetailResponse.listEInvoiceForDental[0].listConsultation.length - 1)), ]), ); } diff --git a/lib/pages/medical/prescriptions/prescription_details_page.dart b/lib/pages/medical/prescriptions/prescription_details_page.dart index 9289ed75..5b47d8f9 100644 --- a/lib/pages/medical/prescriptions/prescription_details_page.dart +++ b/lib/pages/medical/prescriptions/prescription_details_page.dart @@ -38,6 +38,7 @@ class PrescriptionDetailsPage extends StatelessWidget { DoctorHeader( headerModel: HeaderModel( prescriptions.doctorName, + prescriptions.doctorID, prescriptions.doctorImageURL, prescriptions.speciality, "", diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index 8695a88f..1b593d07 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -49,6 +49,7 @@ class PrescriptionItemsPage extends StatelessWidget { DoctorHeader( headerModel: HeaderModel( prescriptions.doctorName, + prescriptions.doctorID, prescriptions.doctorImageURL, prescriptions.speciality, "", diff --git a/lib/pages/medical/radiology/radiology_details_page.dart b/lib/pages/medical/radiology/radiology_details_page.dart index 1a61def8..e84a5063 100644 --- a/lib/pages/medical/radiology/radiology_details_page.dart +++ b/lib/pages/medical/radiology/radiology_details_page.dart @@ -40,6 +40,7 @@ class RadiologyDetailsPage extends StatelessWidget { DoctorHeader( headerModel: new HeaderModel( finalRadiology.doctorName, + finalRadiology.doctorID, finalRadiology.doctorImageURL, finalRadiology.speciality, finalRadiology.invoiceNo.toString(), diff --git a/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart b/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart index 82d53327..ba88263b 100644 --- a/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart +++ b/lib/widgets/data_display/medical/LabResult/laboratory_result_widget.dart @@ -44,6 +44,7 @@ class _LaboratoryResultWidgetState extends State { DoctorHeader( headerModel: HeaderModel( widget.patientLabOrder.doctorName, + widget.patientLabOrder.doctorID, widget.patientLabOrder.doctorImageURL, widget.patientLabOrder.speciality, widget.billNo, diff --git a/lib/widgets/new_design/doctor_header.dart b/lib/widgets/new_design/doctor_header.dart index 06f392bd..df882a7c 100644 --- a/lib/widgets/new_design/doctor_header.dart +++ b/lib/widgets/new_design/doctor_header.dart @@ -1,6 +1,10 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorRateDetails.dart'; import 'package:diplomaticquarterapp/models/header_model.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/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; @@ -27,7 +31,7 @@ class DoctorHeader extends StatelessWidget { this.isNeedToShowButton = true, this.buttonIcon, this.showConfirmMessageDialog = true, - this.onRatingAndReviewTap}) + @required this.onRatingAndReviewTap}) : super(key: key); ProjectViewModel projectViewModel; @@ -100,7 +104,11 @@ class DoctorHeader extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ InkWell( - onTap: onRatingAndReviewTap, + onTap: () { + if ((headerModel?.totalReviews ?? 0) > 0) { + getDoctorRatingsDetails(context); + } + }, child: Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, @@ -122,10 +130,10 @@ class DoctorHeader extends StatelessWidget { style: TextStyle( fontSize: 12, fontWeight: FontWeight.w600, - color: onRatingAndReviewTap != null ? Colors.blue[600] : Color(0xff2B353E), + color: (headerModel?.totalReviews ?? 0) > 0 ? Colors.blue[600] : Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12, - decoration: onRatingAndReviewTap != null ? TextDecoration.underline : null, + decoration: (headerModel?.totalReviews ?? 0) > 0 ? TextDecoration.underline : null, ), ), ], @@ -141,7 +149,8 @@ class DoctorHeader extends StatelessWidget { }, child: Container( padding: EdgeInsets.only(top: 10, bottom: 10, right: 21, left: 15), - decoration: BoxDecoration(color: Color(0XFFD02127), borderRadius: projectViewModel.isArabic ? BorderRadius.only(topRight: Radius.circular(10)) : BorderRadius.only(topLeft: Radius.circular(10))), + decoration: BoxDecoration( + color: Color(0XFFD02127), borderRadius: projectViewModel.isArabic ? BorderRadius.only(topRight: Radius.circular(10)) : BorderRadius.only(topLeft: Radius.circular(10))), child: Row( mainAxisSize: MainAxisSize.min, children: [ @@ -175,4 +184,220 @@ class DoctorHeader extends StatelessWidget { ), ); } + + void getDoctorRatingsDetails(context) { + GifLoaderDialogUtils.showMyDialog(context); + List doctorDetailsList = List(); + + DoctorsListService service = new DoctorsListService(); + service.getDoctorsRatingDetails(headerModel.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, context); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); + print(err); + }); + } + + void showRatingDialog(List doctorDetailsList, context) { + 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.headerModel.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.headerModel.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.headerModel.totalReviews.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.headerModel.totalReviews) * 100; + return width; + } }