From 8e27d8210a3e17abc5aaceb25a0df65b2e2f30a5 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Tue, 28 Sep 2021 15:33:32 +0300 Subject: [PATCH] prescription detail ui changes. --- .../prescription_details_page.dart | 174 ++++---------- .../prescription_items_page.dart | 7 +- .../dialogs/confirm_send_email_dialog.dart | 169 +++++++------- .../new_confirm_send_email_dialog.dart | 219 ------------------ 4 files changed, 140 insertions(+), 429 deletions(-) delete mode 100644 lib/widgets/dialogs/new_confirm_send_email_dialog.dart diff --git a/lib/pages/medical/prescriptions/prescription_details_page.dart b/lib/pages/medical/prescriptions/prescription_details_page.dart index afe8fe47..4d012cce 100644 --- a/lib/pages/medical/prescriptions/prescription_details_page.dart +++ b/lib/pages/medical/prescriptions/prescription_details_page.dart @@ -1,25 +1,23 @@ +import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; -import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/models/header_model.dart'; -import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog_prescription.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; class PrescriptionDetailsPage extends StatelessWidget { final PrescriptionReport prescriptionReport; - - PrescriptionDetailsPage({Key key, this.prescriptionReport}); + final Prescriptions prescriptions; + PrescriptionDetailsPage({Key key, this.prescriptionReport, this.prescriptions}); @override Widget build(BuildContext context) { @@ -34,17 +32,17 @@ class PrescriptionDetailsPage extends StatelessWidget { children: [ DoctorHeader( headerModel: HeaderModel( - prescriptionReport?.doctorName ?? "" + "a", - "", - [], + prescriptions.doctorName, + prescriptions.doctorImageURL, + prescriptions.speciality, "", - "", - DateUtil.convertStringToDate(prescriptionReport.orderDate), - DateUtil.formatDateToTime(DateUtil.convertStringToDate(prescriptionReport.orderDate)), - null, - null, - null, - null, + prescriptions.name, + DateUtil.convertStringToDate(prescriptions.appointmentDate), + DateUtil.formatDateToTime(DateUtil.convertStringToDate(prescriptions.appointmentDate)), + prescriptions.nationalityFlagURL, + prescriptions.doctorRate, + prescriptions.actualDoctorRate, + prescriptions.noOfPatientsRate, "", ), isNeedToShowButton: false, @@ -68,123 +66,49 @@ class PrescriptionDetailsPage extends StatelessWidget { ), ], ), - child: Table(children: fullData(context)), - ), - Container( - width: double.infinity, - margin: EdgeInsets.only(top: 10, left: 10, right: 10), - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - border: Border.all(color: Colors.grey[200], width: 0.5), - ), - child: Row( - children: [ - ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(5)), - child: Image.network( - prescriptionReport.imageSRCUrl, - fit: BoxFit.cover, - width: 60, - height: 70, - ), - ), - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts(prescriptionReport.itemDescription.isNotEmpty ? prescriptionReport.itemDescription : prescriptionReport.itemDescriptionN ?? ''), - ), - ), - ) - ], - ), - ), - Container( - color: Colors.white, - margin: EdgeInsets.only(top: 10, left: 10, right: 10), - child: Table( - border: TableBorder.symmetric(inside: BorderSide(width: 0.5), outside: BorderSide(width: 0.5)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ - TableRow( - children: [ - Container( - color: Colors.white, - height: 40, - width: double.infinity, - child: Center( - child: Texts( - TranslationBase.of(context).route, - fontSize: 14, - ))), - Container( - color: Colors.white, - height: 40, - width: double.infinity, - child: Center( - child: Texts( - TranslationBase.of(context).frequency, - fontSize: 14, - ))), - Container( - color: Colors.white, - height: 40, - width: double.infinity, - padding: EdgeInsets.symmetric(horizontal: 4), - child: Center( - child: Texts( - "${TranslationBase.of(context).dailyDoses}", - fontSize: 14, - ))), + Row( + children: [ Container( - color: Colors.white, - height: 40, - width: double.infinity, - child: Center( - child: Texts( - TranslationBase.of(context).duration, - fontSize: 14, - ))), + decoration: BoxDecoration( + border: Border.all(width: 1.0, color: Color(0xffEBEBEB)), + borderRadius: BorderRadius.all(Radius.circular(30.0)), + ), + child: ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(30)), + child: Image.network( + prescriptionReport.imageSRCUrl, + fit: BoxFit.cover, + width: 48, + height: 48, + ), + ), + ), + SizedBox(width: 12), + Expanded( + child: Text( + (prescriptionReport.itemDescription.isNotEmpty ? prescriptionReport.itemDescription : prescriptionReport.itemDescriptionN ?? '').toLowerCase().capitalizeFirstofEach, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64), + ), + ) ], ), - TableRow( - children: [ - Container(color: Colors.white, height: 50, width: double.infinity, child: Center(child: Text(prescriptionReport.routeN ?? ''))), - Container(color: Colors.white, height: 50, width: double.infinity, child: Center(child: Text(prescriptionReport.frequencyN ?? ''))), - Container(color: Colors.white, height: 50, width: double.infinity, child: Center(child: Text('${prescriptionReport.doseDailyQuantity}'))), - Container(color: Colors.white, height: 50, width: double.infinity, child: Center(child: Text('${prescriptionReport.days}'))) - ], + SizedBox(height: 12), + Table(children: fullData(context)), + Text( + TranslationBase.of(context).remarks, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48), + ), + Text( + prescriptionReport.remarks, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), ), ], ), ), - Container( - margin: EdgeInsets.only(top: 10, left: 10, right: 10), - width: double.infinity, - color: Colors.white, - padding: EdgeInsets.all(5), - child: Center( - child: Column( - children: [ - Texts(TranslationBase.of(context).notes), - SizedBox( - height: 5, - ), - Divider( - height: 0.5, - color: Colors.grey[300], - ), - SizedBox( - height: 5, - ), - Texts(prescriptionReport.remarks ?? ''), - ], - ), - ), - ), ], ), ), diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index 171d8475..e531558a 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_inp.dart'; @@ -11,14 +12,13 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; -import 'package:diplomaticquarterapp/widgets/dialogs/new_confirm_send_email_dialog.dart'; import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; + import '../../../widgets/dialogs/confirm_send_email_dialog.dart'; import 'PrescriptionIDeliveryAddressPage.dart'; @@ -211,6 +211,7 @@ class PrescriptionItemsPage extends StatelessWidget { FadePage( page: PrescriptionDetailsPage( prescriptionReport: prescriptionReport, + prescriptions: prescriptions, ), ), ); @@ -330,7 +331,7 @@ class PrescriptionItemsPage extends StatelessWidget { void showConfirmMessage(BuildContext context, PrescriptionsViewModel model) { showDialog( context: context, - child: NewConfirmSendEmailDialog( + child: ConfirmSendEmailDialog( email: model.user.emailAddress, onTapSendEmail: () { model.sendPrescriptionEmail( diff --git a/lib/widgets/dialogs/confirm_send_email_dialog.dart b/lib/widgets/dialogs/confirm_send_email_dialog.dart index 540824ee..1e1baa28 100644 --- a/lib/widgets/dialogs/confirm_send_email_dialog.dart +++ b/lib/widgets/dialogs/confirm_send_email_dialog.dart @@ -1,15 +1,10 @@ -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/insert_user_activity_request_model.dart'; -import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/pages/settings/settings.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../routes.dart'; - class ConfirmSendEmailDialog extends StatefulWidget { final String email; final GestureTapCallback onTapSendEmail; @@ -28,93 +23,103 @@ class _ConfirmSendEmailDialogState extends State { @override Widget build(BuildContext context) { - return SimpleDialog( - contentPadding: EdgeInsets.fromLTRB(28.0, 24.0, 28.0, 0.0), - title: Center( - child: Texts( - TranslationBase.of(context).confirm, - color: Colors.black, - ), - ), - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.center, + return Dialog( + backgroundColor: Colors.white, + shape: RoundedRectangleBorder(), + insetPadding: EdgeInsets.only(left: 21, right: 21), + child: Container( + padding: EdgeInsets.only(left: 20, right: 20, top: 36, bottom: 36), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Center( - child: Texts( - TranslationBase.of(context).sendConfEmail, - fontSize: 14, - color: Colors.grey, - ), - ), - Texts( - widget.email, - color: Colors.grey, - ), - SizedBox( - height: 5, - ), - Divider(), - SizedBox( - height: 5.0, - ), - InkWell( - onTap: () { - Navigator.pop(context); - }, - child: Container( - width: double.maxFinite, - child: Center( - child: Texts( - TranslationBase.of(context).cancel, - color: Colors.red, + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Text( + TranslationBase.of(context).confirm, + style: TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: Color(0xff2B353E), height: 35 / 24, letterSpacing: -0.96), ), ), - ), + IconButton( + padding: EdgeInsets.zero, + icon: Icon(Icons.close), + constraints: BoxConstraints(), + onPressed: () { + Navigator.pop(context); + }, + ) + ], ), - SizedBox( - height: 15.0, + Text( + TranslationBase.of(context).sendConfEmail, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff808080), letterSpacing: -0.48), ), - InkWell( - onTap: () { - Navigator.pop(context); - widget.onTapSendEmail(); - }, - child: Container( - width: double.maxFinite, - child: Center( - child: Texts(TranslationBase.of(context).sendEmail), - ), + SizedBox(height: 18), + Container( + padding: EdgeInsets.symmetric(vertical: 16, horizontal: 11), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(10.0)), + color: Color(0xffEAEAEA), ), - ), - SizedBox( - height: 15.0, - ), - InkWell( - onTap: () - { - Navigator.pop(context); - Navigator.push( - context, - FadePage( - page: Settings(type: 1,), + child: Row( + children: [ + Expanded( + child: Text( + widget.email, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48), + ), ), - ); - - }, - child: Container( - width: double.maxFinite, - child: Center( - child: Texts(TranslationBase.of(context).updateEmail), - ), + IconButton( + padding: EdgeInsets.zero, + icon: Icon(Icons.edit), + iconSize: 16, + constraints: BoxConstraints(), + onPressed: () { + Navigator.pop(context); + Navigator.push( + context, + FadePage( + page: Settings( + type: 1, + ), + ), + ); + }, + ) + ], ), ), - SizedBox( - height: 20.0, + SizedBox(height: 18), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).cancel, + () { + Navigator.pop(context); + }, + textColor: Color(0xff2B353E), + color: Color(0xffEAEAEA), + ), + ), + SizedBox(width: 10), + Expanded( + child: DefaultButton( + TranslationBase.of(context).send, + () { + Navigator.pop(context); + widget.onTapSendEmail(); + }, + ), + ), + ], ), ], - ) - ], + ), + ), ); } } diff --git a/lib/widgets/dialogs/new_confirm_send_email_dialog.dart b/lib/widgets/dialogs/new_confirm_send_email_dialog.dart deleted file mode 100644 index 10585740..00000000 --- a/lib/widgets/dialogs/new_confirm_send_email_dialog.dart +++ /dev/null @@ -1,219 +0,0 @@ -import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/insert_user_activity_request_model.dart'; -import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; -import 'package:diplomaticquarterapp/pages/settings/settings.dart'; -import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -import '../../routes.dart'; - -class NewConfirmSendEmailDialog extends StatefulWidget { - final String email; - final GestureTapCallback onTapSendEmail; - - NewConfirmSendEmailDialog({this.email, this.onTapSendEmail}); - - @override - _NewConfirmSendEmailDialogState createState() => _NewConfirmSendEmailDialogState(); -} - -class _NewConfirmSendEmailDialogState extends State { - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - return Dialog( - backgroundColor: Colors.white, - shape: RoundedRectangleBorder(), - insetPadding: EdgeInsets.only(left: 21, right: 21), - child: Container( - padding: EdgeInsets.only(left: 20, right: 20, top: 36, bottom: 36), - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - child: Text( - TranslationBase.of(context).confirm, - style: TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: Color(0xff2B353E), height: 35 / 24, letterSpacing: -0.96), - ), - ), - IconButton( - padding: EdgeInsets.zero, - icon: Icon(Icons.close), - constraints: BoxConstraints(), - onPressed: () { - Navigator.pop(context); - }, - ) - ], - ), - Text( - TranslationBase.of(context).sendConfEmail, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff808080), letterSpacing: -0.48), - ), - SizedBox(height: 18), - Container( - padding: EdgeInsets.symmetric(vertical: 16, horizontal: 11), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(10.0)), - color: Color(0xffEAEAEA), - ), - child: Row( - children: [ - Expanded( - child: Text( - widget.email, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48), - ), - ), - IconButton( - padding: EdgeInsets.zero, - icon: Icon(Icons.edit), - iconSize: 16, - constraints: BoxConstraints(), - onPressed: () { - Navigator.pop(context); - Navigator.push( - context, - FadePage( - page: Settings( - type: 1, - ), - ), - ); - }, - ) - ], - ), - ), - SizedBox(height: 18), - Row( - mainAxisSize: MainAxisSize.min, - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).cancel, - () { - Navigator.pop(context); - }, - textColor: Color(0xff2B353E), - color: Color(0xffEAEAEA), - ), - ), - SizedBox(width: 10), - Expanded( - child: DefaultButton( - TranslationBase.of(context).send, - () { - Navigator.pop(context); - widget.onTapSendEmail(); - }, - ), - ), - ], - ), - ], - ), - ), - ); - return SimpleDialog( - // contentPadding: EdgeInsets.fromLTRB(28.0, 24.0, 28.0, 0.0), - title: Center( - child: Texts( - TranslationBase.of(context).confirm, - color: Colors.black, - ), - ), - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Center( - child: Texts( - TranslationBase.of(context).sendConfEmail, - fontSize: 14, - color: Colors.grey, - ), - ), - Texts( - widget.email, - color: Colors.grey, - ), - SizedBox( - height: 5, - ), - Divider(), - SizedBox( - height: 5.0, - ), - InkWell( - onTap: () { - Navigator.pop(context); - }, - child: Container( - width: double.maxFinite, - child: Center( - child: Texts( - TranslationBase.of(context).cancel, - color: Colors.red, - ), - ), - ), - ), - SizedBox( - height: 15.0, - ), - InkWell( - onTap: () { - Navigator.pop(context); - widget.onTapSendEmail(); - }, - child: Container( - width: double.maxFinite, - child: Center( - child: Texts(TranslationBase.of(context).sendEmail), - ), - ), - ), - SizedBox( - height: 15.0, - ), - InkWell( - onTap: () { - Navigator.pop(context); - Navigator.push( - context, - FadePage( - page: Settings( - type: 1, - ), - ), - ); - }, - child: Container( - width: double.maxFinite, - child: Center( - child: Texts(TranslationBase.of(context).updateEmail), - ), - ), - ), - SizedBox( - height: 20.0, - ), - ], - ) - ], - ); - } -}