From 528e16c3dcd2c4e17da4e6f4390639ca77e4a682 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Mon, 23 Aug 2021 16:20:52 +0300 Subject: [PATCH 1/3] lab result & radiolgy fix --- .../radiology/radiology_service.dart | 19 ++---- .../profile/lab_result/labs_home_page.dart | 66 +++++++------------ pubspec.lock | 6 +- 3 files changed, 31 insertions(+), 60 deletions(-) diff --git a/lib/core/service/patient_medical_file/radiology/radiology_service.dart b/lib/core/service/patient_medical_file/radiology/radiology_service.dart index df646ca9..f10f2253 100644 --- a/lib/core/service/patient_medical_file/radiology/radiology_service.dart +++ b/lib/core/service/patient_medical_file/radiology/radiology_service.dart @@ -9,19 +9,14 @@ class RadiologyService extends BaseService { List finalRadiologyList = List(); String url = ''; - Future getRadImageURL( - {int invoiceNo, - int lineItem, - int projectId, - @required PatiantInformtion patient}) async { + Future getRadImageURL({int invoiceNo, int lineItem, int projectId, @required PatiantInformtion patient}) async { hasError = false; final Map body = new Map(); body['InvoiceNo'] = invoiceNo; body['LineItemNo'] = lineItem; body['ProjectID'] = projectId; - await baseAppClient.postPatient(GET_RAD_IMAGE_URL, patient: patient, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.postPatient(GET_RAD_IMAGE_URL, patient: patient, onSuccess: (dynamic response, int statusCode) { url = response['Data']; }, onFailure: (String error, int statusCode) { hasError = true; @@ -29,24 +24,22 @@ class RadiologyService extends BaseService { }, body: body); } - Future getPatientRadOrders(PatiantInformtion patient, - {isInPatient = false}) async { + Future getPatientRadOrders(PatiantInformtion patient, {isInPatient = false}) async { String url = GET_PATIENT_ORDERS; final Map body = new Map(); if (isInPatient) { url = GET_IN_PATIENT_ORDERS; body['ProjectID'] = patient.projectId; } - + finalRadiologyList.clear(); hasError = false; - await baseAppClient.postPatient(url, patient: patient, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.postPatient(url, patient: patient, onSuccess: (dynamic response, int statusCode) { finalRadiologyList = []; String label = "ListRAD"; if (isInPatient) { label = "List_GetRadOreders"; } - if(response[label] == null || response[label].length == 0){ + if (response[label] == null || response[label].length == 0) { label = "FinalRadiologyList"; } response[label].forEach((radiology) { 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 dfc1a1e8..48c35952 100644 --- a/lib/screens/patients/profile/lab_result/labs_home_page.dart +++ b/lib/screens/patients/profile/lab_result/labs_home_page.dart @@ -29,7 +29,6 @@ class _LabsHomePageState extends State { bool isInpatient; bool isFromLiveCare; - @override void didChangeDependencies() { super.didChangeDependencies(); @@ -66,8 +65,7 @@ class _LabsHomePageState extends State { SizedBox( height: 12, ), - if (model.patientLabOrdersList.isNotEmpty && - patient.patientStatusType != 43) + if (model.patientLabOrdersList.isNotEmpty && patient.patientStatusType != 43) Padding( padding: const EdgeInsets.all(8.0), child: Column( @@ -87,8 +85,7 @@ class _LabsHomePageState extends State { ], ), ), - if (patient.patientStatusType != null && - patient.patientStatusType == 43) + if (patient.patientStatusType != null && patient.patientStatusType == 43) Padding( padding: const EdgeInsets.all(8.0), child: Column( @@ -108,8 +105,7 @@ class _LabsHomePageState extends State { ], ), ), - if ((patient.patientStatusType != null && - patient.patientStatusType == 43) || + if ((patient.patientStatusType != null && patient.patientStatusType == 43) || (isFromLiveCare && patient.appointmentNo != null)) AddNewOrder( onTap: () { @@ -146,37 +142,26 @@ class _LabsHomePageState extends State { width: 20, height: 160, decoration: BoxDecoration( - color: model.patientLabOrdersList[index] - .isLiveCareAppointment + color: model.patientLabOrdersList[index].isLiveCareAppointment ? Colors.red[900] - : !model.patientLabOrdersList[index] - .isInOutPatient + : !model.patientLabOrdersList[index].isInOutPatient ? Colors.black : Color(0xffa9a089), 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) - ), + 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: RotatedBox( quarterTurns: 3, child: Center( child: Text( - model.patientLabOrdersList[index] - .isLiveCareAppointment - ? TranslationBase.of(context) - .liveCare - .toUpperCase() - : !model.patientLabOrdersList[index] - .isInOutPatient - ? TranslationBase.of(context) - .inPatientLabel - .toUpperCase() - : TranslationBase.of(context) - .outpatient - .toUpperCase(), + model.patientLabOrdersList[index].isLiveCareAppointment + ? TranslationBase.of(context).liveCare.toUpperCase() + : !model.patientLabOrdersList[index].isInOutPatient + ? TranslationBase.of(context).inPatientLabel.toUpperCase() + : TranslationBase.of(context).outpatient.toUpperCase(), style: TextStyle(color: Colors.white), ), )), @@ -190,24 +175,18 @@ class _LabsHomePageState extends State { page: LaboratoryResultPage( patientLabOrders: model.patientLabOrdersList[index], patient: patient, - isInpatient:isInpatient, + isInpatient: isInpatient, arrivalType: arrivalType, patientType: patientType, ), ), ), - doctorName: - model.patientLabOrdersList[index].doctorName, - invoiceNO: - ' ${model.patientLabOrdersList[index].invoiceNo}', - profileUrl: model - .patientLabOrdersList[index].doctorImageURL, - branch: - model.patientLabOrdersList[index].projectName, - clinic: model - .patientLabOrdersList[index].clinicDescription, - appointmentDate: - model.patientLabOrdersList[index].orderDate.add(Duration(days: 1)), + doctorName: model.patientLabOrdersList[index].doctorName, + invoiceNO: ' ${model.patientLabOrdersList[index].invoiceNo}', + profileUrl: model.patientLabOrdersList[index].doctorImageURL, + branch: model.patientLabOrdersList[index].projectName, + clinic: model.patientLabOrdersList[index].clinicDescription, + appointmentDate: model.patientLabOrdersList[index].orderDate, orderNo: model.patientLabOrdersList[index].orderNo, isShowTime: false, ), @@ -216,8 +195,7 @@ class _LabsHomePageState extends State { ), ), ), - if (model.patientLabOrdersList.isEmpty && - patient.patientStatusType != 43) + if (model.patientLabOrdersList.isEmpty && patient.patientStatusType != 43) Center( child: Column( crossAxisAlignment: CrossAxisAlignment.center, diff --git a/pubspec.lock b/pubspec.lock index e2215d0c..0229e774 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -664,7 +664,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0-nullsafety.4" mime: dependency: transitive description: @@ -956,7 +956,7 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.1" + version: "1.10.0-nullsafety.2" sticky_headers: dependency: "direct main" description: @@ -1154,5 +1154,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.10.0 <2.11.0" + dart: ">=2.10.0 <=2.11.0-213.1.beta" flutter: ">=1.22.0 <2.0.0" From 05355662327c50c9994f6d5a27ea15d62ee6ecee Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Mon, 23 Aug 2021 16:31:38 +0300 Subject: [PATCH 2/3] lab result & railogy fix --- .../profile/lab_result/LabResultWidget.dart | 63 +++++++++---------- .../lab_result/laboratory_result_widget.dart | 35 +++-------- 2 files changed, 38 insertions(+), 60 deletions(-) diff --git a/lib/screens/patients/profile/lab_result/LabResultWidget.dart b/lib/screens/patients/profile/lab_result/LabResultWidget.dart index 0d059000..81b61c42 100644 --- a/lib/screens/patients/profile/lab_result/LabResultWidget.dart +++ b/lib/screens/patients/profile/lab_result/LabResultWidget.dart @@ -18,12 +18,7 @@ class LabResultWidget extends StatelessWidget { final bool isInpatient; LabResultWidget( - {Key key, - this.filterName, - this.patientLabResultList, - this.patientLabOrder, - this.patient, - this.isInpatient}) + {Key key, this.filterName, this.patientLabResultList, this.patientLabOrder, this.patient, this.isInpatient}) : super(key: key); ProjectViewModel projectViewModel; @@ -37,32 +32,32 @@ class LabResultWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ // if (!isInpatient) - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(filterName), - InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: FlowChartPage( - filterName: filterName, - patientLabOrder: patientLabOrder, - patient: patient, - isInpatient: isInpatient, - ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText(filterName), + InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: FlowChartPage( + filterName: filterName, + patientLabOrder: patientLabOrder, + patient: patient, + isInpatient: isInpatient, ), - ); - }, - child: AppText( - TranslationBase.of(context).showMoreBtn, - textDecoration: TextDecoration.underline, - color: Colors.blue, - ), + ), + ); + }, + child: AppText( + TranslationBase.of(context).showMoreBtn, + textDecoration: TextDecoration.underline, + color: Colors.blue, ), - ], - ), + ), + ], + ), Row( children: [ Expanded( @@ -122,8 +117,7 @@ class LabResultWidget extends StatelessWidget { color: Colors.white, child: Center( child: AppText( - '${patientLabResultList[index].testCode}\n' + - patientLabResultList[index].description, + '${patientLabResultList[index].testCode}\n' + patientLabResultList[index].description, textAlign: TextAlign.center, ), ), @@ -135,9 +129,8 @@ class LabResultWidget extends StatelessWidget { color: Colors.white, child: Center( child: AppText( - patientLabResultList[index].resultValue ??""+ - " " + - "${patientLabResultList[index].uOM ?? ""}", + patientLabResultList[index].resultValue ?? + "" + " " + "${patientLabResultList[index].uOM ?? ""}", textAlign: TextAlign.center, ), ), diff --git a/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart b/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart index 08c247ee..5130f7ab 100644 --- a/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart +++ b/lib/screens/patients/profile/lab_result/laboratory_result_widget.dart @@ -88,20 +88,16 @@ class _LaboratoryResultWidgetState extends State { children: [ Expanded( child: Container( - margin: EdgeInsets.only( - left: 10, right: 10), + margin: EdgeInsets.only(left: 10, right: 10), child: AppText( - TranslationBase.of(context) - .generalResult, + TranslationBase.of(context).generalResult, bold: true, ))), Container( width: 25, height: 25, child: Icon( - _isShowMoreGeneral - ? Icons.keyboard_arrow_up - : Icons.keyboard_arrow_down, + _isShowMoreGeneral ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down, color: Colors.grey[800], size: 22, ), @@ -132,11 +128,8 @@ class _LaboratoryResultWidgetState extends State { model.labResultLists.length, (index) => LabResultWidget( patientLabOrder: widget.patientLabOrder, - filterName: model - .labResultLists[index].filterName, - patientLabResultList: model - .labResultLists[index] - .patientLabResultList, + filterName: model.labResultLists[index].filterName, + patientLabResultList: model.labResultLists[index].patientLabResultList, patient: widget.patient, isInpatient: widget.isInpatient, ), @@ -173,20 +166,16 @@ class _LaboratoryResultWidgetState extends State { children: [ Expanded( child: Container( - margin: EdgeInsets.only( - left: 10, right: 10), + margin: EdgeInsets.only(left: 10, right: 10), child: AppText( - TranslationBase.of(context) - .specialResult, + TranslationBase.of(context).specialResult, bold: true, ))), Container( width: 25, height: 25, child: Icon( - _isShowMore - ? Icons.keyboard_arrow_up - : Icons.keyboard_arrow_down, + _isShowMore ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down, color: Colors.grey[800], size: 22, ), @@ -211,14 +200,10 @@ class _LaboratoryResultWidgetState extends State { width: double.infinity, child: !Helpers.isTextHtml(widget.details) ? AppText( - widget.details ?? - TranslationBase.of(context) - .noDataAvailable, + widget.details ?? TranslationBase.of(context).noDataAvailable, ) : Html( - data: widget.details ?? - TranslationBase.of(context) - .noDataAvailable, + data: widget.details ?? TranslationBase.of(context).noDataAvailable, ), ), ), From de6936efb82ebb2ff923eac73e9032e19e3c1722 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Mon, 23 Aug 2021 16:52:31 +0300 Subject: [PATCH 3/3] Profile app bar copying & lab result --- .../profile/lab_result/LabResultWidget.dart | 3 + .../radiology/radiology_details_page.dart | 1 + .../profile/patient-profile-app-bar.dart | 519 +++++++++--------- lib/widgets/shared/app_texts_widget.dart | 50 +- 4 files changed, 262 insertions(+), 311 deletions(-) diff --git a/lib/screens/patients/profile/lab_result/LabResultWidget.dart b/lib/screens/patients/profile/lab_result/LabResultWidget.dart index 81b61c42..26d85f62 100644 --- a/lib/screens/patients/profile/lab_result/LabResultWidget.dart +++ b/lib/screens/patients/profile/lab_result/LabResultWidget.dart @@ -119,6 +119,7 @@ class LabResultWidget extends StatelessWidget { child: AppText( '${patientLabResultList[index].testCode}\n' + patientLabResultList[index].description, textAlign: TextAlign.center, + isCopyable: true, ), ), ), @@ -132,6 +133,7 @@ class LabResultWidget extends StatelessWidget { patientLabResultList[index].resultValue ?? "" + " " + "${patientLabResultList[index].uOM ?? ""}", textAlign: TextAlign.center, + isCopyable: true, ), ), ), @@ -144,6 +146,7 @@ class LabResultWidget extends StatelessWidget { child: AppText( patientLabResultList[index].referanceRange, textAlign: TextAlign.center, + isCopyable: true, ), ), ), diff --git a/lib/screens/patients/profile/radiology/radiology_details_page.dart b/lib/screens/patients/profile/radiology/radiology_details_page.dart index 93613275..1e742de9 100644 --- a/lib/screens/patients/profile/radiology/radiology_details_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_details_page.dart @@ -75,6 +75,7 @@ class RadiologyDetailsPage extends StatelessWidget { child: AppText( '${finalRadiology.reportData.trim()}', textAlign: TextAlign.start, + isCopyable: true, fontSize: 17, color: Color(0xff575757), ), diff --git a/lib/widgets/patients/profile/patient-profile-app-bar.dart b/lib/widgets/patients/profile/patient-profile-app-bar.dart index 5901f9b8..4d3b56ef 100644 --- a/lib/widgets/patients/profile/patient-profile-app-bar.dart +++ b/lib/widgets/patients/profile/patient-profile-app-bar.dart @@ -12,8 +12,7 @@ import 'package:url_launcher/url_launcher.dart'; import 'large_avatar.dart'; -class PatientProfileAppBar extends StatelessWidget - with PreferredSizeWidget { +class PatientProfileAppBar extends StatelessWidget with PreferredSizeWidget { final PatiantInformtion patient; final double height; final bool isInpatient; @@ -35,8 +34,7 @@ class PatientProfileAppBar extends StatelessWidget final bool isFromLabResult; final VoidCallback onPressed; - PatientProfileAppBar( - this.patient, + PatientProfileAppBar(this.patient, {this.height = 0.0, this.isInpatient = false, this.isDischargedPatient = false, @@ -53,8 +51,8 @@ class PatientProfileAppBar extends StatelessWidget this.episode, this.visitDate, this.isAppointmentHeader = false, - this.isFromLabResult = false, this.onPressed}); - + this.isFromLabResult = false, + this.onPressed}); @override Widget build(BuildContext context) { @@ -73,51 +71,44 @@ class PatientProfileAppBar extends StatelessWidget right: 5, bottom: 5, ), - decoration: BoxDecoration( - color: Colors.white, - border: Border( bottom: BorderSide(color:Color(0xFFEFEFEF))) - - ), + decoration: BoxDecoration(color: Colors.white, border: Border(bottom: BorderSide(color: Color(0xFFEFEFEF)))), child: Container( padding: EdgeInsets.only(left: 10, right: 10, bottom: 10), - - margin: EdgeInsets.only(top: SizeConfig.isHeightVeryShort?30: 50), + margin: EdgeInsets.only(top: SizeConfig.isHeightVeryShort ? 30 : 50), child: Column( children: [ Container( - padding: EdgeInsets.only(left: SizeConfig.isHeightVeryShort?0: 12.0), + padding: EdgeInsets.only(left: SizeConfig.isHeightVeryShort ? 0 : 12.0), child: Row(children: [ IconButton( icon: Icon(Icons.arrow_back_ios), color: Color(0xFF2B353E), //Colors.black, onPressed: () { - if(onPressed!=null) - onPressed(); - Navigator.pop(context); + if (onPressed != null) onPressed(); + Navigator.pop(context); }, ), Expanded( child: AppText( patient.firstName != null - ? (Helpers.capitalize(patient.firstName) + - " " + - Helpers.capitalize(patient.lastName)) - : Helpers.capitalize(patient.fullName??patient.patientDetails.fullName), + ? (Helpers.capitalize(patient.firstName) + " " + Helpers.capitalize(patient.lastName)) + : Helpers.capitalize(patient.fullName ?? patient.patientDetails.fullName), fontSize: SizeConfig.textMultiplier * 1.8, fontWeight: FontWeight.bold, fontFamily: 'Poppins', color: Color(0xFF2B353E), + isCopyable: true, ), ), gender == 1 ? Icon( - DoctorApp.male_2, - color: Colors.blue, - ) + DoctorApp.male_2, + color: Colors.blue, + ) : Icon( - DoctorApp.female_1, - color: Colors.pink, - ), + DoctorApp.female_1, + color: Colors.pink, + ), Container( margin: EdgeInsets.symmetric(horizontal: 4), child: InkWell( @@ -134,14 +125,12 @@ class PatientProfileAppBar extends StatelessWidget ), Row(children: [ Padding( - padding: EdgeInsets.only(left: SizeConfig.isHeightVeryShort?0: 12.0), + padding: EdgeInsets.only(left: SizeConfig.isHeightVeryShort ? 0 : 12.0), child: Container( - width: SizeConfig.getTextMultiplierBasedOnWidth()*20, - height: SizeConfig.getTextMultiplierBasedOnWidth()*20, + width: SizeConfig.getTextMultiplierBasedOnWidth() * 20, + height: SizeConfig.getTextMultiplierBasedOnWidth() * 20, child: Image.asset( - gender == 1 - ? 'assets/images/male_avatar.png' - : 'assets/images/female_avatar.png', + gender == 1 ? 'assets/images/male_avatar.png' : 'assets/images/female_avatar.png', fit: BoxFit.cover, ), ), @@ -155,33 +144,28 @@ class PatientProfileAppBar extends StatelessWidget children: [ patient.patientStatusType != null ? Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - patient.patientStatusType == 43 - ? AppText( - TranslationBase - .of(context) - .arrivedP, - color: Colors.green, - fontWeight: FontWeight.bold, - fontFamily: 'Poppins', - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, - ) + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + patient.patientStatusType == 43 + ? AppText( + TranslationBase.of(context).arrivedP, + color: Colors.green, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, + ) : AppText( TranslationBase.of(context).notArrived, color: Colors.red[800], fontWeight: FontWeight.bold, fontFamily: 'Poppins', - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, ), patient.startTime != null - ? AppText( - patient.startTime != null - ? patient.startTime - : '', + ? AppText(patient.startTime != null ? patient.startTime : '', fontWeight: FontWeight.w700, - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, color: Color(0xFF2E303A)) : SizedBox() ], @@ -194,17 +178,17 @@ class PatientProfileAppBar extends StatelessWidget Row( children: [ AppText( - TranslationBase - .of(context) - .fileNumber, - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, + TranslationBase.of(context).fileNumber, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, color: Color(0xFF575757), fontWeight: FontWeight.w600, ), - SizedBox(width: 1,), + SizedBox( + width: 1, + ), AppText( patient.patientId.toString(), - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, color: Color(0xFF2E303A), fontWeight: FontWeight.w700, isCopyable: true, @@ -214,23 +198,21 @@ class PatientProfileAppBar extends StatelessWidget Row( children: [ AppText( - patient.nationalityName ?? patient.nationality?? patient.nationalityId ?? '', + patient.nationalityName ?? patient.nationality ?? patient.nationalityId ?? '', fontWeight: FontWeight.bold, - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, ), patient.nationalityFlagURL != null ? ClipRRect( - borderRadius: BorderRadius.circular(20.0), - child: Image.network( - patient.nationalityFlagURL, - height: 25, - width: 30, - errorBuilder: (BuildContext context, - Object exception, - StackTrace stackTrace) { - return Text('No Image'); - }, - )) + borderRadius: BorderRadius.circular(20.0), + child: Image.network( + patient.nationalityFlagURL, + height: 25, + width: 30, + errorBuilder: (BuildContext context, Object exception, StackTrace stackTrace) { + return Text('No Image'); + }, + )) : SizedBox() ], ) @@ -246,35 +228,32 @@ class PatientProfileAppBar extends StatelessWidget ), children: [ new TextSpan( - text: TranslationBase - .of(context) - .age + " : ", - style: TextStyle(fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757),)), + text: TranslationBase.of(context).age + " : ", + style: TextStyle( + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, + fontWeight: FontWeight.w600, + color: Color(0xFF575757), + )), new TextSpan( text: - "${AppDateUtils.getAgeByBirthday( - patient.patientDetails != null - ? patient.patientDetails.dateofBirth ?? - "" - : patient.dateofBirth ?? "", context, - isServerFormat: !isFromLiveCare)}", + "${AppDateUtils.getAgeByBirthday(patient.patientDetails != null ? patient.patientDetails.dateofBirth ?? "" : patient.dateofBirth ?? "", context, isServerFormat: !isFromLiveCare)}", style: TextStyle( fontWeight: FontWeight.w700, - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, - color: Color(0xFF2E303A),)), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, + color: Color(0xFF2E303A), + )), ], ), ), ), - if ( patient.appointmentDate != null && patient.appointmentDate.isNotEmpty && !isFromLabResult) + if (patient.appointmentDate != null && patient.appointmentDate.isNotEmpty && !isFromLabResult) Row( mainAxisAlignment: MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).appointmentDate + - " : ", - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, + TranslationBase.of(context).appointmentDate + " : ", + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, color: Color(0xFF575757), fontWeight: FontWeight.w600, fontFamily: 'Poppins', @@ -283,13 +262,10 @@ class PatientProfileAppBar extends StatelessWidget width: 3.5, ), AppText( - AppDateUtils - .getDayMonthYearDateFormatted( - AppDateUtils.convertStringToDate( - patient.appointmentDate)) - , + AppDateUtils.getDayMonthYearDateFormatted( + AppDateUtils.convertStringToDate(patient.appointmentDate)), fontWeight: FontWeight.w700, - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, color: Color(0xFF2E303A), ), SizedBox( @@ -297,105 +273,96 @@ class PatientProfileAppBar extends StatelessWidget ) ], ), - if(isFromLabResult)Container( - child: RichText( - text: new TextSpan( - style: new TextStyle( - fontSize: 1.6 * SizeConfig.textMultiplier, - color: Colors.black, - fontFamily: 'Poppins', + if (isFromLabResult) + Container( + child: RichText( + text: new TextSpan( + style: new TextStyle( + fontSize: 1.6 * SizeConfig.textMultiplier, + color: Colors.black, + fontFamily: 'Poppins', + ), + children: [ + new TextSpan( + text: "Result Date: ", + style: TextStyle( + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, + color: Color(0xFF575757), + fontWeight: FontWeight.w600, + fontFamily: 'Poppins', + )), + new TextSpan( + text: + '${AppDateUtils.getDayMonthYearDateFormatted(appointmentDate, isArabic: projectViewModel.isArabic)}', + style: TextStyle(fontWeight: FontWeight.w700, fontSize: 12)), + ], ), - children: [ - new TextSpan( - text: "Result Date: ", - style: TextStyle( fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, - color: Color(0xFF575757), - fontWeight: FontWeight.w600, - fontFamily: 'Poppins',)), - new TextSpan( - text: - '${AppDateUtils.getDayMonthYearDateFormatted(appointmentDate, isArabic: projectViewModel.isArabic)}', - style: TextStyle( - fontWeight: FontWeight.w700, fontSize: 12)), - ], ), ), - ), // if(isInpatient) - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if(patient.admissionDate != null && patient.admissionDate.isNotEmpty) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (patient.admissionDate != null && patient.admissionDate.isNotEmpty) Container( child: RichText( text: new TextSpan( style: new TextStyle( - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, + fontWeight: FontWeight.w600, + color: Color(0xFF575757), fontFamily: 'Poppins', ), children: [ - new TextSpan( - text: patient.admissionDate == null - ? "" - : TranslationBase.of(context) - .admissionDate + - " : ", - style: TextStyle(fontSize: 10)), - new TextSpan( - text: patient.admissionDate == null - ? "" - : "${AppDateUtils - .getDayMonthYearDateFormatted( - (AppDateUtils - .getDateTimeFromServerFormat( - patient.admissionDate - .toString())))}", - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, - color: Color(0xFF2E303A),)), - ]))), - if (patient.admissionDate != null) - Row( - children: [ + new TextSpan( + text: patient.admissionDate == null + ? "" + : TranslationBase.of(context).admissionDate + " : ", + style: TextStyle(fontSize: 10)), + new TextSpan( + text: patient.admissionDate == null + ? "" + : "${AppDateUtils.getDayMonthYearDateFormatted((AppDateUtils.getDateTimeFromServerFormat(patient.admissionDate.toString())))}", + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, + color: Color(0xFF2E303A), + )), + ]))), + if (patient.admissionDate != null) + Row( + children: [ + AppText( + "${TranslationBase.of(context).numOfDays}: ", + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, + fontWeight: FontWeight.w600, + color: Color(0xFF575757), + isCopyable: true, + ), + if (isDischargedPatient && patient.dischargeDate != null) + AppText( + "${AppDateUtils.getDateTimeFromServerFormat(patient.dischargeDate).difference(AppDateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}", + fontWeight: FontWeight.w700, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, + color: Color(0xFF2E303A), + ) + else AppText( - "${TranslationBase.of(context).numOfDays}: ", - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757) + "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}", + fontWeight: FontWeight.w700, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, + color: Color(0xFF2E303A), + isCopyable: true, ), - if(isDischargedPatient && - patient.dischargeDate != null) - AppText( - "${AppDateUtils - .getDateTimeFromServerFormat( - patient.dischargeDate) - .difference(AppDateUtils - .getDateTimeFromServerFormat( - patient.admissionDate)) - .inDays + 1}", - fontWeight: FontWeight.w700, - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, - color: Color(0xFF2E303A), - ) - else - AppText( - "${DateTime - .now() - .difference(AppDateUtils - .getDateTimeFromServerFormat( - patient.admissionDate)) - .inDays + 1}", - fontWeight: FontWeight.w700, - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, - color: Color(0xFF2E303A),), - ], - ), - ], - ), + ], + ), + ], + ), ], ), ), ]), - if(isAppointmentHeader) + if (isAppointmentHeader) Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -403,16 +370,12 @@ class PatientProfileAppBar extends StatelessWidget width: 30, height: 30, margin: EdgeInsets.only( - left: projectViewModel.isArabic ? 10 : 85, - right: projectViewModel.isArabic ? 85 : 10, - top: 5), + left: projectViewModel.isArabic ? 10 : 85, right: projectViewModel.isArabic ? 85 : 10, top: 5), decoration: BoxDecoration( shape: BoxShape.rectangle, border: Border( - bottom: BorderSide( - color: Colors.grey[400], width: 2.5), - left: BorderSide( - color: Colors.grey[400], width: 2.5), + bottom: BorderSide(color: Colors.grey[400], width: 2.5), + left: BorderSide(color: Colors.grey[400], width: 2.5), )), ), Expanded( @@ -430,105 +393,105 @@ class PatientProfileAppBar extends StatelessWidget height: 25, margin: EdgeInsets.only(top: 10), ), - - Expanded( flex: 5, child: Container( margin: EdgeInsets.all(10), - child: Column( - crossAxisAlignment: CrossAxisAlignment - .start, - children: [ - AppText( - '${TranslationBase - .of(context) - .dr}$doctorName', - color: Color(0xFF2E303A), - fontWeight: FontWeight.w700, - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, - ), - if (orderNo != null && - !isPrescriptions) - Row( - children: [ - AppText('Order No: ', - - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757),), - AppText(orderNo ?? '', - fontSize: 12) - ], + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + AppText( + '${TranslationBase.of(context).dr}$doctorName', + color: Color(0xFF2E303A), + fontWeight: FontWeight.w700, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, + ), + if (orderNo != null && !isPrescriptions) + Row( + children: [ + AppText( + 'Order No: ', + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, + fontWeight: FontWeight.w600, + color: Color(0xFF575757), ), - if (invoiceNO != null && - !isPrescriptions) - Row( - children: [ - AppText('Invoice: ', - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757),), - AppText(invoiceNO ?? "", - fontSize: 12) - ], + AppText(orderNo ?? '', fontSize: 12) + ], + ), + if (invoiceNO != null && !isPrescriptions) + Row( + children: [ + AppText( + 'Invoice: ', + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, + fontWeight: FontWeight.w600, + color: Color(0xFF575757), ), - if (branch != null) - Row( - children: [ - AppText('Branch: ', - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757),), - AppText(branch ?? '', - fontSize: 12) - ], + AppText(invoiceNO ?? "", fontSize: 12) + ], + ), + if (branch != null) + Row( + children: [ + AppText( + 'Branch: ', + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, + fontWeight: FontWeight.w600, + color: Color(0xFF575757), ), - - if (clinic != null) - Row( - children: [ - AppText('Clinic: ', - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757),), - AppText(clinic ?? '', - fontSize: 12) - ], + AppText(branch ?? '', fontSize: 12) + ], + ), + if (clinic != null) + Row( + children: [ + AppText( + 'Clinic: ', + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, + fontWeight: FontWeight.w600, + color: Color(0xFF575757), ), - if (isMedicalFile && - episode != null) - Row( - children: [ - AppText('Episode: ', - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757),), - AppText(episode ?? '', - fontSize: 12) - ], + AppText(clinic ?? '', fontSize: 12) + ], + ), + if (isMedicalFile && episode != null) + Row( + children: [ + AppText( + 'Episode: ', + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, + fontWeight: FontWeight.w600, + color: Color(0xFF575757), ), - if (isMedicalFile && - visitDate != null) - Row( - children: [ - AppText('Visit Date: ', - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757),), - AppText(visitDate ?? '', - fontSize: 12) - ], + AppText(episode ?? '', fontSize: 12) + ], + ), + if (isMedicalFile && visitDate != null) + Row( + children: [ + AppText( + 'Visit Date: ', + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, + fontWeight: FontWeight.w600, + color: Color(0xFF575757), ), - if (!isMedicalFile) - Row( - - children: [ - AppText( - !isPrescriptions - ? 'Result Date:' - : 'Prescriptions Date ', - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontWeight: FontWeight.w600,color: Color(0xFF575757), - ), - AppText( - '${AppDateUtils - .getDayMonthYearDateFormatted( - appointmentDate, - isArabic: projectViewModel - .isArabic)}', - fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, - ) - ], + AppText(visitDate ?? '', fontSize: 12) + ], + ), + if (!isMedicalFile) + Row( + children: [ + AppText( + !isPrescriptions ? 'Result Date:' : 'Prescriptions Date ', + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, + fontWeight: FontWeight.w600, + color: Color(0xFF575757), + ), + AppText( + '${AppDateUtils.getDayMonthYearDateFormatted(appointmentDate, isArabic: projectViewModel.isArabic)}', + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5, ) - ]), + ], + ) + ]), ), ), ], @@ -542,9 +505,19 @@ class PatientProfileAppBar extends StatelessWidget ), ); } + @override - Size get preferredSize => - Size(double.maxFinite, height == 0 - ? isInpatient ? (isFromLabResult?200:190) : isAppointmentHeader ? 290 : SizeConfig.isHeightVeryShort?137:SizeConfig.isHeightShort?190: SizeConfig.heightMultiplier * (SizeConfig.isWidthLarge?25:20) + Size get preferredSize => Size( + double.maxFinite, + height == 0 + ? isInpatient + ? (isFromLabResult ? 200 : 190) + : isAppointmentHeader + ? 290 + : SizeConfig.isHeightVeryShort + ? 137 + : SizeConfig.isHeightShort + ? 190 + : SizeConfig.heightMultiplier * (SizeConfig.isWidthLarge ? 25 : 20) : height); } diff --git a/lib/widgets/shared/app_texts_widget.dart b/lib/widgets/shared/app_texts_widget.dart index 89c69736..56a503a8 100644 --- a/lib/widgets/shared/app_texts_widget.dart +++ b/lib/widgets/shared/app_texts_widget.dart @@ -62,7 +62,7 @@ class AppText extends StatefulWidget { this.textOverflow, this.textDecoration, this.letterSpacing, - this.isCopyable = true, + this.isCopyable = false, }); @override @@ -103,10 +103,7 @@ class _AppTextState extends State { margin: widget.margin != null ? EdgeInsets.all(widget.margin) : EdgeInsets.only( - top: widget.marginTop, - right: widget.marginRight, - bottom: widget.marginBottom, - left: widget.marginLeft), + top: widget.marginTop, right: widget.marginRight, bottom: widget.marginBottom, left: widget.marginLeft), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, @@ -121,21 +118,16 @@ class _AppTextState extends State { right: 0, child: Container( decoration: BoxDecoration( - gradient: LinearGradient( - colors: [ - Theme.of(context).backgroundColor, - Theme.of(context).backgroundColor.withOpacity(0), - ], - begin: Alignment.bottomCenter, - end: Alignment.topCenter)), + gradient: LinearGradient(colors: [ + Theme.of(context).backgroundColor, + Theme.of(context).backgroundColor.withOpacity(0), + ], begin: Alignment.bottomCenter, end: Alignment.topCenter)), height: 30, ), ) ], ), - if (widget.allowExpand && - widget.readMore && - text.length > widget.maxLength) + if (widget.allowExpand && widget.readMore && text.length > widget.maxLength) Padding( padding: EdgeInsets.only(top: 8.0, right: 8.0, bottom: 8.0), child: InkWell( @@ -172,13 +164,7 @@ class _AppTextState extends State { ), child: Container( child: SelectableText( - !hidden - ? text - : (text.substring( - 0, - text.length > widget.maxLength - ? widget.maxLength - : text.length)), + !hidden ? text : (text.substring(0, text.length > widget.maxLength ? widget.maxLength : text.length)), textAlign: widget.textAlign, // overflow: widget.maxLines != null // ? ((widget.maxLines > 1) @@ -196,8 +182,7 @@ class _AppTextState extends State { fontStyle: widget.italic ? FontStyle.italic : null, color: widget.color != null ? widget.color : Colors.black, fontSize: widget.fontSize ?? _getFontSize(), - letterSpacing: widget.letterSpacing ?? - (widget.variant == "overline" ? 1.5 : null), + letterSpacing: widget.letterSpacing ?? (widget.variant == "overline" ? 1.5 : null), fontWeight: widget.fontWeight ?? _getFontWeight(), fontFamily: widget.fontFamily ?? 'Poppins', decoration: widget.textDecoration, @@ -207,19 +192,9 @@ class _AppTextState extends State { ); } else { return Text( - !hidden - ? text - : (text.substring( - 0, - text.length > widget.maxLength - ? widget.maxLength - : text.length)), + !hidden ? text : (text.substring(0, text.length > widget.maxLength ? widget.maxLength : text.length)), textAlign: widget.textAlign, - overflow: widget.maxLines != null - ? ((widget.maxLines > 1) - ? TextOverflow.fade - : TextOverflow.ellipsis) - : null, + overflow: widget.maxLines != null ? ((widget.maxLines > 1) ? TextOverflow.fade : TextOverflow.ellipsis) : null, maxLines: widget.maxLines ?? null, style: widget.style != null ? _getFontStyle().copyWith( @@ -231,8 +206,7 @@ class _AppTextState extends State { fontStyle: widget.italic ? FontStyle.italic : null, color: widget.color != null ? widget.color : Colors.black, fontSize: widget.fontSize ?? _getFontSize(), - letterSpacing: widget.letterSpacing ?? - (widget.variant == "overline" ? 1.5 : null), + letterSpacing: widget.letterSpacing ?? (widget.variant == "overline" ? 1.5 : null), fontWeight: widget.fontWeight ?? _getFontWeight(), fontFamily: widget.fontFamily ?? 'Poppins', decoration: widget.textDecoration,