From c17f9fb91da6c6dd7814fe0b0f5c8c6f5851c55c Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Tue, 24 Aug 2021 10:58:57 +0300 Subject: [PATCH] add copy to patient cart --- .../patients/patient_card/PatientCard.dart | 200 +++++++----------- .../profile/patient-profile-app-bar.dart | 118 +++-------- 2 files changed, 101 insertions(+), 217 deletions(-) diff --git a/lib/widgets/patients/patient_card/PatientCard.dart b/lib/widgets/patients/patient_card/PatientCard.dart index b90eecd3..22b35417 100644 --- a/lib/widgets/patients/patient_card/PatientCard.dart +++ b/lib/widgets/patients/patient_card/PatientCard.dart @@ -35,7 +35,6 @@ class PatientCard extends StatelessWidget { @override Widget build(BuildContext context) { - return Container( width: SizeConfig.screenWidth * 0.9, margin: EdgeInsets.all(6), @@ -260,9 +259,9 @@ class PatientCard extends StatelessWidget { patientInfo.fullName) : (Helpers.capitalize( patientInfo.firstName) + - " " + - Helpers.capitalize( - patientInfo.lastName)), + " " + + Helpers.capitalize( + patientInfo.lastName)), fontSize: 16, color: Color(0xff2e303a), fontWeight: FontWeight.w700, @@ -270,7 +269,6 @@ class PatientCard extends StatelessWidget { textOverflow: TextOverflow.ellipsis, ), ), - if (patientInfo.gender == 1) Icon( DoctorApp.male_2, @@ -281,9 +279,10 @@ class PatientCard extends StatelessWidget { DoctorApp.female_1, color: Colors.pink, ), - - if(isFromLiveCare) - ShowTimer(patientInfo: patientInfo,), + if (isFromLiveCare) + ShowTimer( + patientInfo: patientInfo, + ), ]), ), Row( @@ -351,129 +350,45 @@ class PatientCard extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - child: RichText( - text: new TextSpan( - style: new TextStyle( - fontSize: 2.0 * SizeConfig.textMultiplier, - color: Colors.black), - children: [ - new TextSpan( - text: TranslationBase.of(context) - .fileNumber, - style: TextStyle( - fontSize: 12, - fontFamily: 'Poppins')), - new TextSpan( - text: patientInfo.patientId.toString(), - style: TextStyle( - fontWeight: FontWeight.w700, - fontFamily: 'Poppins', - fontSize: 13)), - ], - ), - ), + CustomRow( + label: TranslationBase.of(context).fileNumber, + value: patientInfo.patientId.toString(), ), + //if (isInpatient) - Container( - child: RichText( - text: new TextSpan( - style: new TextStyle( - fontSize: 2.0 * SizeConfig.textMultiplier, - color: Colors.black, - fontFamily: 'Poppins', - ), - children: [ - new TextSpan( - text: TranslationBase.of(context).age + - " : ", - style: TextStyle(fontSize: 12)), - new TextSpan( - text: - "${AppDateUtils.getAgeByBirthday(patientInfo.dateofBirth, context, isServerFormat: !isFromLiveCare)}", - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 13)), - ], - ), - ), + + CustomRow( + label: TranslationBase.of(context).age + " : ", + value: + "${AppDateUtils.getAgeByBirthday(patientInfo.dateofBirth, context, isServerFormat: !isFromLiveCare)}", ), + if (isInpatient) - Container( - child: RichText( - text: new TextSpan( - style: new TextStyle( - fontSize: - 2.0 * SizeConfig.textMultiplier, - color: Colors.black, - fontFamily: 'Poppins', - ), - children: [ - new TextSpan( - text: patientInfo.admissionDate == null - ? "" - : TranslationBase.of(context) - .admissionDate + - " : ", - style: TextStyle(fontSize: 12)), - new TextSpan( - text: patientInfo.admissionDate == null - ? "" - : "${AppDateUtils.convertDateFromServerFormat(patientInfo.admissionDate.toString(), 'yyyy-MM-dd')}", - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 13)), - ]))), + CustomRow( + label: patientInfo.admissionDate == null + ? "" + : TranslationBase.of(context) + .admissionDate + + " : ", + value: patientInfo.admissionDate == null + ? "" + : "${AppDateUtils.convertDateFromServerFormat(patientInfo.admissionDate.toString(), 'yyyy-MM-dd')}", + ), if (patientInfo.admissionDate != null) - Container( - child: RichText( - text: new TextSpan( - style: new TextStyle( - fontSize: - 2.0 * SizeConfig.textMultiplier, - color: Colors.black, - fontFamily: 'Poppins', - ), - children: [ - new TextSpan( - text: TranslationBase.of(context) - .numOfDays + - " : ", - style: TextStyle(fontSize: 12)), - new TextSpan( - text: - "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}", - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 13)), - ]))), + CustomRow( + label: TranslationBase.of(context).numOfDays + + " : ", + value: + "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}", + ), if (isFromLiveCare) Column( children: [ - Container( - child: RichText( - text: new TextSpan( - style: new TextStyle( - fontSize: 2.0 * SizeConfig.textMultiplier, - color: Colors.black, - fontFamily: 'Poppins', - ), - children: [ - new TextSpan( - text: - TranslationBase.of(context).clinic + - " : ", - style: TextStyle(fontSize: 12)), - new TextSpan( - text: - patientInfo.clinicName, - style: TextStyle( - fontWeight: FontWeight.w700, - fontSize: 13)), - ], - ), - ), - ), + + CustomRow(label: TranslationBase.of(context) + .clinic + + " : ",value: patientInfo.clinicName,), + ], ), ])) @@ -522,14 +437,47 @@ class PatientCard extends StatelessWidget { height: 25, width: 35, )), - ]) - : SizedBox() + ]) + : SizedBox() ], ), onTap: onTap, )), )); } +} + +class CustomRow extends StatelessWidget { + const CustomRow({ + Key key, + this.label, + this.value, + }) : super(key: key); + final String label; + final String value; -} \ No newline at end of file + @override + Widget build(BuildContext context) { + return Row( + children: [ + AppText( + label, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 2.8, + color: Color(0xFF575757), + fontWeight: FontWeight.w600, + ), + SizedBox( + width: 1, + ), + AppText( + value, + fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, + color: Color(0xFF2E303A), + fontWeight: FontWeight.w700, + isCopyable: true, + ), + ], + ); + } +} diff --git a/lib/widgets/patients/profile/patient-profile-app-bar.dart b/lib/widgets/patients/profile/patient-profile-app-bar.dart index f9bab58c..8b2f7de4 100644 --- a/lib/widgets/patients/profile/patient-profile-app-bar.dart +++ b/lib/widgets/patients/profile/patient-profile-app-bar.dart @@ -103,6 +103,7 @@ class PatientProfileAppBar extends StatelessWidget with PreferredSizeWidget { fontWeight: FontWeight.bold, fontFamily: 'Poppins', color: Color(0xFF2B353E), + isCopyable: true, ), ), gender == 1 @@ -347,112 +348,46 @@ class PatientProfileAppBar extends StatelessWidget with PreferredSizeWidget { fontSize: SizeConfig .getTextMultiplierBasedOnWidth() * 3.5, + isCopyable: true, ), if (orderNo != null && !isPrescriptions) - Row( - children: [ - AppText( - 'Order No: ', - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 3, - fontWeight: FontWeight.w600, - color: Color(0xFF575757), - ), - AppText(orderNo ?? '', fontSize: 12) - ], + HeaderRow( + label: 'Order No: ', + value: orderNo ?? '', ), if (invoiceNO != null && !isPrescriptions) - Row( - children: [ - AppText( - 'Invoice: ', - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 3, - fontWeight: FontWeight.w600, - color: Color(0xFF575757), - ), - AppText(invoiceNO ?? "", fontSize: 12) - ], + HeaderRow( + label: 'Invoice: ', + value: invoiceNO ?? "", ), if (branch != null) - Row( - children: [ - AppText( - 'Branch: ', - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 3, - fontWeight: FontWeight.w600, - color: Color(0xFF575757), - ), - AppText(branch ?? '', fontSize: 12) - ], + HeaderRow( + label: 'Branch: ', + value: branch ?? '', ), if (clinic != null) - Row( - children: [ - AppText( - 'Clinic: ', - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 3, - fontWeight: FontWeight.w600, - color: Color(0xFF575757), - ), - AppText(clinic ?? '', fontSize: 12) - ], + HeaderRow( + label: 'Clinic: ', + value: clinic ?? '', ), if (isMedicalFile && episode != null) - Row( - children: [ - AppText( - 'Episode: ', - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 3, - fontWeight: FontWeight.w600, - color: Color(0xFF575757), - ), - AppText(episode ?? '', fontSize: 12) - ], + HeaderRow( + label: 'Episode: ', + value: episode ?? '', ), if (isMedicalFile && visitDate != null) - Row( - children: [ - AppText( - 'Visit Date: ', - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 3, - fontWeight: FontWeight.w600, - color: Color(0xFF575757), - ), - AppText(visitDate ?? '', fontSize: 12) - ], + HeaderRow( + label: 'Visit Date: ', + value: visitDate ?? '', ), if (!isMedicalFile) - Row( - children: [ - AppText( - !isPrescriptions - ? 'Result Date:' - : 'Prescriptions Date ', - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 3, - fontWeight: FontWeight.w600, - color: Color(0xFF575757), - ), - AppText( + HeaderRow( + label: !isPrescriptions + ? 'Result Date:' + : 'Prescriptions Date ', + value: '${AppDateUtils.getDayMonthYearDateFormatted(appointmentDate, isArabic: projectViewModel.isArabic)}', - fontSize: SizeConfig - .getTextMultiplierBasedOnWidth() * - 3.5, - ) - ], - ) + ), ]), ), ), @@ -497,6 +432,7 @@ class HeaderRow extends StatelessWidget { children: [ AppText( label, + isCopyable: true, fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, color: Color(0xFF575757), fontWeight: FontWeight.w600,