From 8a6a68cdfe8f667d968b562f7ad8956161eba96f Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Tue, 28 Dec 2021 12:51:12 +0200 Subject: [PATCH] fix app bar --- .../patient_profile_app_bar_model.dart | 9 +- lib/screens/live_care/end_call_screen.dart | 17 +-- .../special_lab_result_details_page.dart | 11 +- .../MedicalReportDetailPage.dart | 7 +- .../patient-referral-item-widget.dart | 112 +++++++----------- .../profile/patient-profile-app-bar.dart | 66 +++++------ 6 files changed, 110 insertions(+), 112 deletions(-) diff --git a/lib/models/patient/profile/patient_profile_app_bar_model.dart b/lib/models/patient/profile/patient_profile_app_bar_model.dart index 97862aaa..9b157b0c 100644 --- a/lib/models/patient/profile/patient_profile_app_bar_model.dart +++ b/lib/models/patient/profile/patient_profile_app_bar_model.dart @@ -1,3 +1,6 @@ + +import 'dart:ui'; + import '../patiant_info_model.dart'; class PatientProfileAppBarModel { @@ -21,6 +24,8 @@ class PatientProfileAppBarModel { bool? isFromLabResult; Stream ?videoCallDurationStream; + VoidCallback? onPressed; + PatientProfileAppBarModel( {this.height = 0.0, @@ -40,7 +45,7 @@ class PatientProfileAppBarModel { this.visitDate, this.clinic, this.isAppointmentHeader = false, - this.isFromLabResult =false, this.videoCallDurationStream}); + this.isFromLabResult =false, this.videoCallDurationStream, this.onPressed}); PatientProfileAppBarModel.fromJson(Map json) { height = json['height']; @@ -62,6 +67,7 @@ class PatientProfileAppBarModel { isAppointmentHeader = json['isAppointmentHeader']; isFromLabResult = json['isFromLabResult']; videoCallDurationStream = json['videoCallDurationStream']; + onPressed = json['onPressed']; } @@ -86,6 +92,7 @@ class PatientProfileAppBarModel { data['isAppointmentHeader'] = this.isAppointmentHeader; data['isFromLabResult'] = this.isFromLabResult; data['videoCallDurationStream'] = this.videoCallDurationStream; + data['onPressed'] = this.onPressed; return data; } } diff --git a/lib/screens/live_care/end_call_screen.dart b/lib/screens/live_care/end_call_screen.dart index 56bf327c..251367c9 100644 --- a/lib/screens/live_care/end_call_screen.dart +++ b/lib/screens/live_care/end_call_screen.dart @@ -210,17 +210,20 @@ class _EndCallScreenState extends State { appBarTitle: TranslationBase.of(context).patientProfile!, backgroundColor: Theme.of(context).scaffoldBackgroundColor, isShowAppBar: true, - appBar: PatientProfileAppBar(patient, onPressed: () { - Navigator.pop(context); - }, + patientProfileAppBarModel: PatientProfileAppBarModel( + patient: patient, isInpatient: isInpatient, height: (patient!.patientStatusType != null && - patient!.patientStatusType == 43) + patient!.patientStatusType == 43) ? 210 : isDischargedPatient - ? 240 - : 0, - isDischargedPatient: isDischargedPatient), + ? 240 + : 0, + onPressed: () { + Navigator.pop(context); + } , + isDischargedPatient: isDischargedPatient + ), body: Container( height: !isSearchAndOut ? isDischargedPatient diff --git a/lib/screens/patients/profile/lab_result/special_lab_result_details_page.dart b/lib/screens/patients/profile/lab_result/special_lab_result_details_page.dart index e338635a..e5e37f97 100644 --- a/lib/screens/patients/profile/lab_result/special_lab_result_details_page.dart +++ b/lib/screens/patients/profile/lab_result/special_lab_result_details_page.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientMedicalReportViewModel.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/profile/patient_profile_app_bar_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -22,9 +23,15 @@ class SpecialLabResultDetailsPage extends StatelessWidget { baseViewModel: model, isShowAppBar: true, backgroundColor: Theme.of(context).scaffoldBackgroundColor, - appBar: PatientProfileAppBar( - patient, + // appBar: PatientProfileAppBar( + // patient, + // ), + patientProfileAppBarModel: PatientProfileAppBarModel( + patient: patient, ), + + + body: Container( child: SingleChildScrollView( child: Column( diff --git a/lib/screens/patients/profile/medical_report/MedicalReportDetailPage.dart b/lib/screens/patients/profile/medical_report/MedicalReportDetailPage.dart index c22511af..6e6a04eb 100644 --- a/lib/screens/patients/profile/medical_report/MedicalReportDetailPage.dart +++ b/lib/screens/patients/profile/medical_report/MedicalReportDetailPage.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/patient/MedicalReport/MeidcalReportModel.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/profile/patient_profile_app_bar_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/large_avatar.dart'; @@ -31,8 +32,10 @@ class MedicalReportDetailPage extends StatelessWidget { baseViewModel: model, isShowAppBar: true, backgroundColor: Theme.of(context).scaffoldBackgroundColor, - appBar: PatientProfileAppBar( - patient, + + + patientProfileAppBarModel: PatientProfileAppBarModel( + patient: patient, ), body: Container( child: SingleChildScrollView( diff --git a/lib/widgets/patients/patient-referral-item-widget.dart b/lib/widgets/patients/patient-referral-item-widget.dart index e3e784d5..8eca7a93 100644 --- a/lib/widgets/patients/patient-referral-item-widget.dart +++ b/lib/widgets/patients/patient-referral-item-widget.dart @@ -108,15 +108,13 @@ class PatientReferralItemWidget extends StatelessWidget { Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Expanded( - child: AppText( - patientName!, - fontSize: 16.0, - fontWeight: FontWeight.w600, - color: Color(0xff2E303A), - fontFamily: 'Poppins', - letterSpacing: -0.64, - ), + AppText( + patientName!, + fontSize: 16.0, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + fontFamily: 'Poppins', + letterSpacing: -0.64, ), SizedBox( width: 0, @@ -148,34 +146,23 @@ class PatientReferralItemWidget extends StatelessWidget { Expanded( child: Column( children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - CustomRow( - label: - TranslationBase.of(context).fileNumber!, - value: patientID!, - ), - ], + CustomRow( + label: + TranslationBase.of(context).fileNumber!, + value: patientID!, ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - CustomRow( - label: isSameBranch + CustomRow( + label: isSameBranch + ? TranslationBase.of(context) + .referredFrom! + : TranslationBase.of(context).refClinic!, + value: !isReferralClinic! + ? isSameBranch ? TranslationBase.of(context) - .referredFrom! - : TranslationBase.of(context).refClinic!, - value: !isReferralClinic! - ? isSameBranch - ? TranslationBase.of(context) - .sameBranch! - : TranslationBase.of(context) - .otherBranch! - : " " + referralClinic!, - ), - ], + .sameBranch! + : TranslationBase.of(context) + .otherBranch! + : " " + referralClinic!, ), ], ), @@ -205,15 +192,9 @@ class PatientReferralItemWidget extends StatelessWidget { ) ], ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - CustomRow( - label: TranslationBase.of(context).remarks! + " : ", - value: remark ?? "", - ), - ], + CustomRow( + label: TranslationBase.of(context).remarks! + " : ", + value: remark ?? "", ), Row( crossAxisAlignment: CrossAxisAlignment.start, @@ -256,33 +237,30 @@ class PatientReferralItemWidget extends StatelessWidget { ), ), ), - Expanded( - flex: 4, - child: Container( - margin: EdgeInsets.only( - left: 10, top: 25, right: 10, bottom: 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ + Container( + margin: EdgeInsets.only( + left: 10, top: 25, right: 10, bottom: 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + referralDoctorName ?? "", + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + fontSize: 14.0, + color: Color(0xff2E303A), + letterSpacing: -0.56, + ), + if (clinicDescription != null) AppText( - referralDoctorName ?? "", + clinicDescription??"", fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 14.0, - color: Color(0xff2E303A), - letterSpacing: -0.56, + fontSize: 10.0, + color: Color(0xff575757), + letterSpacing: -0.4, ), - if (clinicDescription != null) - AppText( - clinicDescription??"", - fontFamily: 'Poppins', - fontWeight: FontWeight.w600, - fontSize: 10.0, - color: Color(0xff575757), - letterSpacing: -0.4, - ), - ], - ), + ], ), ), ], diff --git a/lib/widgets/patients/profile/patient-profile-app-bar.dart b/lib/widgets/patients/profile/patient-profile-app-bar.dart index b7a0709f..d25b007f 100644 --- a/lib/widgets/patients/profile/patient-profile-app-bar.dart +++ b/lib/widgets/patients/profile/patient-profile-app-bar.dart @@ -34,12 +34,12 @@ class PatientProfileAppBar extends StatelessWidget with PreferredSizeWidget { final String? clinic; final bool? isAppointmentHeader; final bool? isFromLabResult; - final VoidCallback? onPressed; + // final VoidCallback? onPressed; PatientProfileAppBar(this.patient, { this.patientProfileAppBarModel, this.isFromLabResult = false, - this.onPressed, + // this.onPressed, this.height=0, this.isInpatient = false, this.isDischargedPatient = false, @@ -96,7 +96,7 @@ class PatientProfileAppBar extends StatelessWidget with PreferredSizeWidget { icon: Icon(Icons.arrow_back_ios), color: Color(0xFF2B353E), //Colors.black, onPressed: () { - if (onPressed != null) onPressed!(); + if (patientProfileAppBarModel!.onPressed != null) patientProfileAppBarModel!.onPressed!(); Navigator.pop(context); }, ), @@ -417,8 +417,8 @@ class PatientProfileAppBar extends StatelessWidget with PreferredSizeWidget { label: !isPrescriptions! ? 'Result Date:' : 'Prescriptions Date ', - value: - '${AppDateUtils.getDayMonthYearDateFormatted(appointmentDate!, isArabic: projectViewModel.isArabic)}', + value: AppDateUtils.getDayMonthYearDateFormatted( + patientProfileAppBarModel!.appointmentDate! ) ), ]), ), @@ -438,34 +438,34 @@ class PatientProfileAppBar extends StatelessWidget with PreferredSizeWidget { @override Size get preferredSize => Size( double.maxFinite, - height! == 0 - ? isInpatient - ? (isFromLabResult! ? 210 : 200) - : isAppointmentHeader! - ? 290 - : SizeConfig.isHeightVeryShort - ? 137 - : SizeConfig.isHeightShort - ? 190 - : SizeConfig.heightMultiplier * - (SizeConfig.isWidthLarge ? 25 : 20) - : height! - // TODO Elham*2 - // patientProfileAppBarModel!.height == 0 - // ? patientProfileAppBarModel!.isAppointmentHeader! - // ? 270 - // : ((localPatient!.appointmentDate!.isNotEmpty) - // ? patientProfileAppBarModel!.isFromLabResult! - // ? 190 - // : 170 - // : localPatient!.admissionDate != null - // ? patientProfileAppBarModel!.isFromLabResult! - // ? 190 - // : 170 - // : patientProfileAppBarModel!.isDischargedPatient! - // ? 240 - // : 130) - // : patientProfileAppBarModel!.height! + // height! == 0 + // ? isInpatient + // ? (isFromLabResult! ? 210 : 200) + // : isAppointmentHeader! + // ? 290 + // : SizeConfig.isHeightVeryShort + // ? 137 + // : SizeConfig.isHeightShort + // ? 190 + // : SizeConfig.heightMultiplier * + // (SizeConfig.isWidthLarge ? 25 : 20) + // : height! + // // TODO Elham*2 + patientProfileAppBarModel!.height == 0 + ? patientProfileAppBarModel!.isAppointmentHeader! + ? 270 + : ((patientProfileAppBarModel!.patient!.appointmentDate!.isNotEmpty) + ? patientProfileAppBarModel!.isFromLabResult! + ? 190 + : 200 + : patientProfileAppBarModel!.patient!.admissionDate != null + ? patientProfileAppBarModel!.isFromLabResult! + ? 190 + : 170 + : patientProfileAppBarModel!.isDischargedPatient! + ? 240 + : 130) + : patientProfileAppBarModel!.height! ); }