From 747a0b7da4a6eb4b5c87cc68c7e8180fc74e71d0 Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Mon, 29 Mar 2021 15:18:38 +0300 Subject: [PATCH] change the lab result design --- .../profile/lab_result/labs_home_page.dart | 121 +++----- .../radiology/radiology_home_page.dart | 16 +- .../prescription/prescriptions_page.dart | 25 +- lib/util/date-utils.dart | 5 +- .../shared/app_expandable_notifier_new.dart | 1 + lib/widgets/shared/doctor_card.dart | 258 +++++++----------- 6 files changed, 165 insertions(+), 261 deletions(-) diff --git a/lib/screens/patients/profile/lab_result/labs_home_page.dart b/lib/screens/patients/profile/lab_result/labs_home_page.dart index c0118e5f..e2388156 100644 --- a/lib/screens/patients/profile/lab_result/labs_home_page.dart +++ b/lib/screens/patients/profile/lab_result/labs_home_page.dart @@ -5,6 +5,8 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/lab_result/laboratory_result_page.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/app_expandable_notifier_new.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/doctor_card.dart'; @@ -20,94 +22,61 @@ class LabsHomePage extends StatelessWidget { Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; - ProjectViewModel projectViewModel = Provider.of(context); + String patientType = routeArgs['patient-type']; + String arrivalType = routeArgs['arrival-type']; return BaseView( onModelReady: (model) => model.getLabs(patient), builder: (context, LabsViewModel model, widget) => AppScaffold( baseViewModel: model, - isShowAppBar: true, - appBarTitle: TranslationBase.of(context).labOrders, + isShowAppBar: false, body: SingleChildScrollView( physics: BouncingScrollPhysics(), child: FractionallySizedBox( widthFactor: 1.0, - child: Center( - child: Column( - children: [ - Row( - children: [ - Expanded( - flex: 1, - child: InkWell( - onTap: () => model.setFilterType(FilterType.Clinic), - child: ListTile( - title: Text(TranslationBase.of(context).clinic), - leading: Radio( - value: FilterType.Clinic, - groupValue: model.filterType, - onChanged: (FilterType value) { - model.setFilterType(value); - }, - ), - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => model.setFilterType(FilterType.Hospital), - child: ListTile( - title: Text(TranslationBase.of(context).hospital), - leading: Radio( - value: FilterType.Hospital, - groupValue: model.filterType, - onChanged: (FilterType value) => - model.setFilterType(value), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + PatientProfileHeaderNewDesign(patient,arrivalType??'0',patientType), + SizedBox(height: 12,), + Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts('Lab',style: "caption2",color: Colors.black,fontSize: 13,), + Texts('Result',bold: true,fontSize: 22,), + ], + ), + ), + ...List.generate( + model.patientLabOrdersList.length, + (index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: model + .patientLabOrdersList[index].patientLabOrdersList + .map((labOrder) { + return DoctorCard( + onTap: () => Navigator.push( + context, + FadePage( + page: LaboratoryResultPage( + patientLabOrders: labOrder, + patient: patient, ), ), ), - ) - ], + doctorName: labOrder.doctorName, + invoiceNO: ' ${labOrder.invoiceNo}', + profileUrl: labOrder.doctorImageURL, + branch: labOrder.projectName, + appointmentDate: labOrder.orderDate, + orderNo: labOrder.orderNo, + ); + }).toList(), ), - ...List.generate( - model.patientLabOrdersList.length, - (index) => AppExpandableNotifier( - title: model.patientLabOrdersList[index].filterName, - bodyWidget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: model - .patientLabOrdersList[index].patientLabOrdersList - .map((labOrder) { - return DoctorCard( - onTap: () => Navigator.push( - context, - FadePage( - page: LaboratoryResultPage( - patientLabOrders: labOrder, - patient: patient, - ), - ), - ), - isInOutPatient: labOrder.isInOutPatient, - name: labOrder.doctorName, - billNo: ' ${labOrder.invoiceNo}', - profileUrl: labOrder.doctorImageURL, - subName: labOrder.projectName, - isLiveCareAppointment: - labOrder.isLiveCareAppointment, - date: projectViewModel.isArabic - ? DateUtils.getMonthDayYearDateFormattedAr( - labOrder.orderDate) - : DateUtils.getMonthDayYearDateFormatted( - labOrder.orderDate), - ); - }).toList(), - ), - ), - ) - ], - ), + ) + ], ), ), ), diff --git a/lib/screens/patients/profile/radiology/radiology_home_page.dart b/lib/screens/patients/profile/radiology/radiology_home_page.dart index cce155d2..4698def1 100644 --- a/lib/screens/patients/profile/radiology/radiology_home_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_home_page.dart @@ -88,18 +88,12 @@ class RadiologyHomePage extends StatelessWidget { ), ), child: DoctorCard( - isInOutPatient: radiology.isInOutPatient, - isLiveCareAppointment: - radiology.isLiveCareAppointment, - name: radiology.doctorName, + doctorName: radiology.doctorName, profileUrl: radiology.doctorImageURL, - billNo: '${radiology.invoiceNo}', - subName: '${radiology.projectName}', - date: projectViewModel.isArabic - ? DateUtils.getMonthDayYearDateFormattedAr( - radiology.orderDate) - : DateUtils.getMonthDayYearDateFormatted( - radiology.orderDate), + invoiceNO: '${radiology.invoiceNo}', + branch: '${radiology.projectName}', + appointmentDate: radiology.orderDate, + orderNo: radiology.orderNo.toString(), ), ); }).toList(), diff --git a/lib/screens/prescription/prescriptions_page.dart b/lib/screens/prescription/prescriptions_page.dart index d595ff0b..039bd7f2 100644 --- a/lib/screens/prescription/prescriptions_page.dart +++ b/lib/screens/prescription/prescriptions_page.dart @@ -93,24 +93,15 @@ class PrescriptionsPage extends StatelessWidget { ), ), child: DoctorCard( - name: prescriptions.doctorName, + doctorName: prescriptions.doctorName, profileUrl: prescriptions.doctorImageURL, - rat: - prescriptions.actualDoctorRate.toDouble(), - subName: prescriptions.name, - isInOutPatient: prescriptions.isInOutPatient, - isLiveCareAppointment: - prescriptions.isLiveCareAppointment, - date: projectViewModel.isArabic - ? DateUtils - .getMonthDayYearDateFormattedAr( - DateUtils.convertStringToDate( - prescriptions - .appointmentDate)) - : DateUtils.getMonthDayYearDateFormatted( - DateUtils.convertStringToDate( - prescriptions.appointmentDate)), - ), + branch: prescriptions.name, + appointmentDate: DateUtils.getDateTimeFromServerFormat(prescriptions.appointmentDate,), + orderNo: prescriptions.appointmentNo.toString(), + invoiceNO:prescriptions.appointmentNo.toString(), + + ) + ); }).toList(), )), diff --git a/lib/util/date-utils.dart b/lib/util/date-utils.dart index 4c11e43b..a78b34c8 100644 --- a/lib/util/date-utils.dart +++ b/lib/util/date-utils.dart @@ -271,10 +271,9 @@ class DateUtils { /// [dateTime] convert DateTime to data formatted static String getDayMonthYearDateFormatted(DateTime dateTime,{bool isArabic = false}) { if (dateTime != null) - return isArabic? getMonthArabic(dateTime.month): getMonth(dateTime.month) + - " " + - dateTime.day.toString() + + return dateTime.day.toString()+" "+ "${isArabic? getMonthArabic(dateTime.month): getMonth(dateTime.month) }"+ " " + + dateTime.year.toString(); else return ""; diff --git a/lib/widgets/shared/app_expandable_notifier_new.dart b/lib/widgets/shared/app_expandable_notifier_new.dart index ea5777a5..848f5265 100644 --- a/lib/widgets/shared/app_expandable_notifier_new.dart +++ b/lib/widgets/shared/app_expandable_notifier_new.dart @@ -47,6 +47,7 @@ class _AppExpandableNotifier extends State { child: Padding( padding: const EdgeInsets.only(left: 10, right: 10, top: 4), child: Card( + color: Colors.grey[200], clipBehavior: Clip.antiAlias, child: Column( children: [ diff --git a/lib/widgets/shared/doctor_card.dart b/lib/widgets/shared/doctor_card.dart index 6493c916..047d567c 100644 --- a/lib/widgets/shared/doctor_card.dart +++ b/lib/widgets/shared/doctor_card.dart @@ -1,7 +1,8 @@ - import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/large_avatar.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -11,28 +12,22 @@ import 'StarRating.dart'; import 'Text.dart'; class DoctorCard extends StatelessWidget { - final String name; - final String subName; - final double rat; - final String date; + final String doctorName; + final String branch; + final DateTime appointmentDate; final String profileUrl; - final String billNo; + final String invoiceNO; + final String orderNo; final Function onTap; - final Function onEmailTap; - final bool isInOutPatient; - final bool isLiveCareAppointment; DoctorCard( - {this.name, - this.subName, - this.rat, - this.date, + {this.doctorName, + this.branch, this.profileUrl, - this.billNo, + this.invoiceNO, this.onTap, - this.onEmailTap, - this.isInOutPatient, - this.isLiveCareAppointment = false}); + this.appointmentDate, + this.orderNo}); @override Widget build(BuildContext context) { @@ -42,155 +37,110 @@ class DoctorCard extends StatelessWidget { decoration: BoxDecoration( border: Border.all( width: 0.5, - color: Theme.of(context).primaryColor, + color: Colors.white, ), borderRadius: BorderRadius.all( - Radius.circular(8.0), + Radius.circular(15.0), ), color: Colors.white), - child: InkWell( - onTap: onTap, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Container( - width: projectViewModel.isArabic ? 27 : 20, - height: date == null - ? projectViewModel.isArabic - ? 185 - : 100 - : 180, - decoration: BoxDecoration( - //Colors.red[900] Color(0xff404545) - color: isLiveCareAppointment - ? Color(0xff404545) - : !isInOutPatient - ? Colors.red[900] - : Theme.of(context).primaryColor, - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic - ? Radius.circular(0) - : Radius.circular(8), - bottomLeft: projectViewModel.isArabic - ? Radius.circular(0) - : Radius.circular(8), - topRight: projectViewModel.isArabic - ? Radius.circular(8) - : Radius.circular(0), - bottomRight: projectViewModel.isArabic - ? Radius.circular(8) - : Radius.circular(0), + child: Padding( + padding: const EdgeInsets.all(15.0), + child: InkWell( + onTap: onTap, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: Texts( + doctorName, + bold: true, + )), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Texts( + '${DateUtils.getDayMonthYearDateFormatted(appointmentDate, isArabic: projectViewModel.isArabic)}', + color: Colors.black, + fontWeight: FontWeight.w600, + fontSize: 14, + ), + Texts( + '${DateUtils.getHour(appointmentDate)}', + fontWeight: FontWeight.w600, + color: Colors.grey[700], + fontSize: 14, + ), + ], ), ), - child: RotatedBox( - quarterTurns: 3, - child: Center( - child: Text( - isLiveCareAppointment - ? TranslationBase.of(context) - .liveCare - .toUpperCase() - : !isInOutPatient - ? TranslationBase.of(context) - .inPatient - .toUpperCase() - : TranslationBase.of(context) - .outpatient - .toUpperCase(), - style: TextStyle(color: Colors.white), - ), - )), - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(10.0), - child: Row( + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Container( + child: LargeAvatar( + name: doctorName, + url: profileUrl, + ), + width: 55, + height: 55, + ), + Expanded( + flex: 4, + child: Container( + margin: EdgeInsets.all(10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Expanded( - flex: 1, - child: LargeAvatar( - name: name, - url: profileUrl, + if (orderNo != null) + Row( + children: [ + Texts( + 'order No:', + color: Colors.grey[500], + ), + Texts( + orderNo ?? '', + ) + ], ), - ), - Expanded( - flex: 4, - child: Container( - margin: EdgeInsets.all(10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - TranslationBase.of(context).dr + - " " + - name, - bold: true, - ), - Texts( - subName, - ), - if (billNo != null) - Row( - children: [ - Texts( - '${TranslationBase.of(context).billNo}: ', - ), - Texts( - billNo, - ) - ], - ), - if (rat != null) - StarRating( - totalAverage: rat, forceStars: true), - ], - ), + if (invoiceNO != null) + Row( + children: [ + Texts( + 'Invoice:', + color: Colors.grey[500], + ), + Texts( + invoiceNO, + ) + ], ), - ), - if (onEmailTap != null) - InkWell( - onTap: onEmailTap, - child: Icon( - Icons.email, - color: Theme.of(context).primaryColor, + Row( + children: [ + Texts( + 'Branch:', + color: Colors.grey[500], ), - ), - ], - ), - ), - if (date != null) - Divider( - height: 8, - color: Colors.grey[400], - ), - if (date != null) - Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Icon( - Icons.calendar_today_outlined, - size: 30, - color: Colors.red, - ), - Expanded( - child: Texts( - date, - variant: 'bodyText', - ), + Texts( + branch, + ) + ], ) - ], - ) - ], + ]), + ), ), - ) - ], - ), - ], + Icon( + EvaIcons.eye, + ) + ], + ), + ], + ), ), ), );