fix app bar

merge-requests/935/head
Elham Rababh 4 years ago
parent d2a48936c8
commit c35e24219c

@ -16,46 +16,10 @@ import 'large_avatar.dart';
class PatientProfileAppBar extends StatelessWidget with PreferredSizeWidget { class PatientProfileAppBar extends StatelessWidget with PreferredSizeWidget {
final PatiantInformtion? patient; final PatiantInformtion? patient;
final PatientProfileAppBarModel? patientProfileAppBarModel; final PatientProfileAppBarModel? patientProfileAppBarModel;
final double? height;
final bool isInpatient;
final bool isDischargedPatient;
final bool isFromLiveCare;
final String? doctorName;
final String? branch;
final DateTime? appointmentDate;
final String? profileUrl;
final String? invoiceNO;
final String? orderNo;
final bool? isPrescriptions;
final bool? isMedicalFile;
final String? episode;
final String? visitDate;
final String? clinic;
final bool? isAppointmentHeader;
final bool? isFromLabResult;
// final VoidCallback? onPressed;
PatientProfileAppBar(this.patient, PatientProfileAppBar(this.patient,
{ this.patientProfileAppBarModel, { this.patientProfileAppBarModel,
this.isFromLabResult = false, });
// this.onPressed,
this.height=0,
this.isInpatient = false,
this.isDischargedPatient = false,
this.isFromLiveCare = false,
this.doctorName,
this.branch,
this.appointmentDate,
this.profileUrl,
this.invoiceNO,
this.orderNo,
this.isPrescriptions=false,
this.isMedicalFile =false,
this.episode,
this.visitDate,
this.clinic,
this.isAppointmentHeader= false});
PatiantInformtion? localPatient; PatiantInformtion? localPatient;
@override @override
@ -284,11 +248,11 @@ class PatientProfileAppBar extends StatelessWidget with PreferredSizeWidget {
HeaderRow( HeaderRow(
label: TranslationBase.of(context).age! + " : ", label: TranslationBase.of(context).age! + " : ",
value: value:
"${AppDateUtils.getAgeByBirthday(localPatient!.patientDetails != null ? localPatient!.patientDetails!.dateofBirth ?? "" : localPatient!.dateofBirth ?? "", context, isServerFormat: !isFromLiveCare)}", "${AppDateUtils.getAgeByBirthday(localPatient!.patientDetails != null ? localPatient!.patientDetails!.dateofBirth ?? "" : localPatient!.dateofBirth ?? "", context, isServerFormat: !patientProfileAppBarModel!.isFromLiveCare!)}",
), ),
if (localPatient!.appointmentDate != null && if (localPatient!.appointmentDate != null &&
localPatient!.appointmentDate!.isNotEmpty && localPatient!.appointmentDate!.isNotEmpty &&
!isFromLabResult!) !patientProfileAppBarModel!.isFromLabResult!)
HeaderRow( HeaderRow(
label: TranslationBase.of(context).appointmentDate! + label: TranslationBase.of(context).appointmentDate! +
" : ", " : ",
@ -320,7 +284,7 @@ class PatientProfileAppBar extends StatelessWidget with PreferredSizeWidget {
if (localPatient!.admissionDate != null) if (localPatient!.admissionDate != null)
HeaderRow( HeaderRow(
label: "${TranslationBase.of(context).numOfDays}: ", label: "${TranslationBase.of(context).numOfDays}: ",
value: isDischargedPatient && value: patientProfileAppBarModel!.isDischargedPatient! &&
localPatient!.dischargeDate != null localPatient!.dischargeDate != null
? "${AppDateUtils.getDateTimeFromServerFormat(localPatient!.dischargeDate!).difference(AppDateUtils.getDateTimeFromServerFormat(localPatient!.admissionDate!)).inDays + 1}" ? "${AppDateUtils.getDateTimeFromServerFormat(localPatient!.dischargeDate!).difference(AppDateUtils.getDateTimeFromServerFormat(localPatient!.admissionDate!)).inDays + 1}"
: "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(localPatient!.admissionDate!)).inDays + 1}", : "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(localPatient!.admissionDate!)).inDays + 1}",
@ -374,7 +338,7 @@ class PatientProfileAppBar extends StatelessWidget with PreferredSizeWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
AppText( AppText(
'${TranslationBase.of(context).dr}$doctorName', '${TranslationBase.of(context).dr}${patientProfileAppBarModel!.doctorName}',
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: SizeConfig fontSize: SizeConfig
@ -382,39 +346,39 @@ class PatientProfileAppBar extends StatelessWidget with PreferredSizeWidget {
3.5, 3.5,
isCopyable: true, isCopyable: true,
), ),
if (orderNo != null && !isPrescriptions!) if (patientProfileAppBarModel!.orderNo != null && !(patientProfileAppBarModel!.isPrescriptions!))
HeaderRow( HeaderRow(
label: 'Order No: ', label: 'Order No: ',
value: orderNo ?? '', value: patientProfileAppBarModel!.orderNo ?? '',
), ),
if (invoiceNO != null && !isPrescriptions!) if (patientProfileAppBarModel!.invoiceNO != null && !(patientProfileAppBarModel!.isPrescriptions!))
HeaderRow( HeaderRow(
label: 'Invoice: ', label: 'Invoice: ',
value: invoiceNO ?? "", value: patientProfileAppBarModel!.invoiceNO ?? "",
), ),
if (branch != null) if (patientProfileAppBarModel!.branch != null)
HeaderRow( HeaderRow(
label: 'Branch: ', label: 'Branch: ',
value: branch ?? '', value: patientProfileAppBarModel!.branch ?? '',
), ),
if (clinic != null) if (patientProfileAppBarModel!.clinic != null)
HeaderRow( HeaderRow(
label: 'Clinic: ', label: 'Clinic: ',
value: clinic ?? '', value: patientProfileAppBarModel!.clinic ?? '',
), ),
if (isMedicalFile! && episode != null) if (patientProfileAppBarModel!.isMedicalFile! && patientProfileAppBarModel!.episode != null)
HeaderRow( HeaderRow(
label: 'Episode: ', label: 'Episode: ',
value: episode ?? '', value: patientProfileAppBarModel!.episode ?? '',
), ),
if (isMedicalFile! && visitDate != null) if (patientProfileAppBarModel!.isMedicalFile! && patientProfileAppBarModel!.visitDate != null)
HeaderRow( HeaderRow(
label: 'Visit Date: ', label: 'Visit Date: ',
value: visitDate ?? '', value: patientProfileAppBarModel!.visitDate ?? '',
), ),
if (!isMedicalFile!) if (!(patientProfileAppBarModel!.isMedicalFile!))
HeaderRow( HeaderRow(
label: !isPrescriptions! label: !(patientProfileAppBarModel!.isPrescriptions!)
? 'Result Date:' ? 'Result Date:'
: 'Prescriptions Date ', : 'Prescriptions Date ',
value: AppDateUtils.getDayMonthYearDateFormatted( value: AppDateUtils.getDayMonthYearDateFormatted(
@ -460,8 +424,8 @@ class PatientProfileAppBar extends StatelessWidget with PreferredSizeWidget {
: 200 : 200
: patientProfileAppBarModel!.patient!.admissionDate != null : patientProfileAppBarModel!.patient!.admissionDate != null
? patientProfileAppBarModel!.isFromLabResult! ? patientProfileAppBarModel!.isFromLabResult!
? 190 ? 210
: 170 : 200
: patientProfileAppBarModel!.isDischargedPatient! : patientProfileAppBarModel!.isDischargedPatient!
? 240 ? 240
: 130) : 130)

Loading…
Cancel
Save