From 0e836c67c8997d6b4fd070b18ec0da15eec98b83 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Sat, 24 Apr 2021 14:53:41 +0300 Subject: [PATCH] medical file hot fix --- .../medical-file/medical_file_page.dart | 167 ++++++++++-------- lib/widgets/shared/doctor_card.dart | 13 +- 2 files changed, 103 insertions(+), 77 deletions(-) diff --git a/lib/screens/medical-file/medical_file_page.dart b/lib/screens/medical-file/medical_file_page.dart index 721a0bb8..1d354ac3 100644 --- a/lib/screens/medical-file/medical_file_page.dart +++ b/lib/screens/medical-file/medical_file_page.dart @@ -85,80 +85,103 @@ class _MedicalFilePageState extends State { itemBuilder: (BuildContext ctxt, int index) { return InkWell( onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => MedicalFileDetails( - age: patient.age is String - ? patient.age ?? "" - : "${patient.age}", - firstName: patient.firstName, - lastName: patient.lastName, - gender: patient.genderDescription, - encounterNumber: index, - pp: patient.patientId, - patient: patient, - doctorName: model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .timeLineEvents[0] - .consulations - .isNotEmpty - ? model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .doctorName - : "", - clinicName: model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .timeLineEvents[0] - .consulations - .isNotEmpty - ? model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .clinicName - : "", - doctorImage: model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .timeLineEvents[0] - .consulations - .isNotEmpty - ? model - .medicalFileList[0] - .entityList[0] - .timelines[index] - .doctorImage - : "", - episode: model.medicalFileList[0].entityList[0].timelines[index].timeLineEvents[0].consulations.isNotEmpty - ? model.medicalFileList[0].entityList[0].timelines[index].timeLineEvents[0].consulations[0].episodeID.toString() - : "", - vistDate: model.medicalFileList[0].entityList[0].timelines[index].date.toString())), - ); + if (model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .timeLineEvents[0] + .consulations + .length != + 0) + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => MedicalFileDetails( + age: patient.age is String + ? patient.age ?? "" + : "${patient.age}", + firstName: patient.firstName, + lastName: patient.lastName, + gender: patient.genderDescription, + encounterNumber: index, + pp: patient.patientId, + patient: patient, + doctorName: model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .timeLineEvents[0] + .consulations + .isNotEmpty + ? model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .doctorName + : "", + clinicName: model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .timeLineEvents[0] + .consulations + .isNotEmpty + ? model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .clinicName + : "", + doctorImage: model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .timeLineEvents[0] + .consulations + .isNotEmpty + ? model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .doctorImage + : "", + episode: model.medicalFileList[0].entityList[0].timelines[index].timeLineEvents[0].consulations.isNotEmpty + ? model.medicalFileList[0].entityList[0].timelines[index].timeLineEvents[0].consulations[0].episodeID.toString() + : "", + vistDate: model.medicalFileList[0].entityList[0].timelines[index].date.toString())), + ); }, child: DoctorCard( - doctorName: model.medicalFileList[0] - .entityList[0].timelines[index].doctorName, - clinic: model.medicalFileList[0].entityList[0] - .timelines[index].clinicName, - branch: model.medicalFileList[0].entityList[0] - .timelines[index].projectName, - profileUrl: model.medicalFileList[0] - .entityList[0].timelines[index].doctorImage, - appointmentDate: - DateUtils.getDateTimeFromServerFormat( - model.medicalFileList[0].entityList[0] - .timelines[index].date, - ), - isPrescriptions: true, - ), + doctorName: model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .doctorName, + clinic: model.medicalFileList[0].entityList[0] + .timelines[index].clinicName, + branch: model.medicalFileList[0].entityList[0] + .timelines[index].projectName, + profileUrl: model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .doctorImage, + appointmentDate: + DateUtils.getDateTimeFromServerFormat( + model.medicalFileList[0].entityList[0] + .timelines[index].date, + ), + isPrescriptions: true, + isShowEye: model + .medicalFileList[0] + .entityList[0] + .timelines[index] + .timeLineEvents[0] + .consulations + .length != + 0 + ? true + : false), ); }) : Center( diff --git a/lib/widgets/shared/doctor_card.dart b/lib/widgets/shared/doctor_card.dart index c86e0211..48782921 100644 --- a/lib/widgets/shared/doctor_card.dart +++ b/lib/widgets/shared/doctor_card.dart @@ -21,6 +21,7 @@ class DoctorCard extends StatelessWidget { final Function onTap; final bool isPrescriptions; final String clinic; + final bool isShowEye; DoctorCard( {this.doctorName, @@ -31,7 +32,8 @@ class DoctorCard extends StatelessWidget { this.appointmentDate, this.orderNo, this.isPrescriptions = false, - this.clinic}); + this.clinic, + this.isShowEye = true}); @override Widget build(BuildContext context) { @@ -50,7 +52,7 @@ class DoctorCard extends StatelessWidget { child: Padding( padding: const EdgeInsets.all(15.0), child: InkWell( - onTap: onTap, + onTap: (isShowEye) ? onTap : null, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -169,9 +171,10 @@ class DoctorCard extends StatelessWidget { ]), ), ), - Icon( - EvaIcons.eye, - ) + if (isShowEye) + Icon( + EvaIcons.eye, + ) ], ), ),