From c9fe9ccb633bff170837970cbf97ce5045836b57 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Tue, 7 Sep 2021 12:29:23 +0300 Subject: [PATCH 1/2] changing lists from list.generator to list builder to make it faster in big size --- lib/config/config.dart | 4 +- .../viewModel/authentication_view_model.dart | 2 +- .../doctor/my_referral_patient_screen.dart | 75 ----- lib/screens/patients/InPatientPage.dart | 257 ++++++++++-------- .../profile/UCAF/UCAF-detail-screen.dart | 42 ++- .../my-referral-inpatient-screen.dart | 129 +++++---- .../referral/referred-patient-screen.dart | 137 +++++----- 7 files changed, 333 insertions(+), 313 deletions(-) delete mode 100644 lib/screens/doctor/my_referral_patient_screen.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 7002bc3a..def2806c 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; -// const BASE_URL = 'https://hmgwebservices.com/'; -const BASE_URL = 'https://uat.hmgwebservices.com/'; +const BASE_URL = 'https://hmgwebservices.com/'; +// const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; diff --git a/lib/core/viewModel/authentication_view_model.dart b/lib/core/viewModel/authentication_view_model.dart index d1d4a3e8..cad5fa87 100644 --- a/lib/core/viewModel/authentication_view_model.dart +++ b/lib/core/viewModel/authentication_view_model.dart @@ -253,7 +253,7 @@ class AuthenticationViewModel extends BaseViewModel { /// add  token to shared preferences in case of send activation code is success setDataAfterSendActivationSuccess(CheckActivationCodeForDoctorAppResponseModel sendActivationCodeForDoctorAppResponseModel)async { - // print("VerificationCode : " + sendActivationCodeForDoctorAppResponseModel.verificationCode); + // print("VerificationCode : " + sendActivationCodeForDoctorAppResponseModel.verificationCode); await sharedPref.setString(VIDA_AUTH_TOKEN_ID, sendActivationCodeForDoctorAppResponseModel.vidaAuthTokenID); await sharedPref.setString(VIDA_REFRESH_TOKEN_ID, diff --git a/lib/screens/doctor/my_referral_patient_screen.dart b/lib/screens/doctor/my_referral_patient_screen.dart deleted file mode 100644 index 960bbdd9..00000000 --- a/lib/screens/doctor/my_referral_patient_screen.dart +++ /dev/null @@ -1,75 +0,0 @@ -import 'package:doctor_app_flutter/core/viewModel/referral_view_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/doctor/my_referral_patient_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:flutter/material.dart'; - -import '../../widgets/shared/app_scaffold_widget.dart'; - -class MyReferralPatient extends StatefulWidget { - int expandedItemIndex = -1; - - @override - _MyReferralPatientState createState() => _MyReferralPatientState(); -} - -class _MyReferralPatientState extends State { - @override - Widget build(BuildContext context) { - return BaseView( - onModelReady: (model) => model.getMyReferralPatient(), - builder: (_, model, w) => AppScaffold( - baseViewModel: model, - appBarTitle: TranslationBase.of(context).myReferralPatient, - body: model.listMyReferralPatientModel.length == 0 - ? Center( - child: AppText( - TranslationBase.of(context).errorNoSchedule, - color: Theme.of(context).errorColor, - ), - ) - : Container( - padding: EdgeInsetsDirectional.fromSTEB(20, 0, 20, 0), - child: ListView( - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 10, - ), - Container( - child: Column( - children: [ - ...List.generate( - model.listMyReferralPatientModel.length, - (index) => MyReferralPatientWidget( - myReferralPatientModel: model - .listMyReferralPatientModel[index], - model: model, - expandClick: () { - setState(() { - if (widget.expandedItemIndex == - index) { - widget.expandedItemIndex = -1; - } else { - widget.expandedItemIndex = index; - } - }); - }, - isExpand: - widget.expandedItemIndex == index, - ), - ) - ], - ), - ), - ], - ), - ], - ), - ), - )); - } -} diff --git a/lib/screens/patients/InPatientPage.dart b/lib/screens/patients/InPatientPage.dart index 8314a653..3b59e546 100644 --- a/lib/screens/patients/InPatientPage.dart +++ b/lib/screens/patients/InPatientPage.dart @@ -16,7 +16,7 @@ import '../../routes.dart'; class InPatientPage extends StatefulWidget { final bool isMyInPatient; - final PatientSearchViewModel patientSearchViewModel; + final PatientSearchViewModel patientSearchViewModel; InPatientPage(this.isMyInPatient, this.patientSearchViewModel); @@ -25,7 +25,6 @@ class InPatientPage extends StatefulWidget { } class _InPatientPageState extends State { - TextEditingController _searchController = TextEditingController(); bool isSortDes = false; @@ -65,10 +64,9 @@ class _InPatientPageState extends State { onChanged: (value) { widget.patientSearchViewModel.filterSearchResults(value); }), - Positioned( right: 35, - top:5, + top: 5, child: IconButton( icon: Icon( isSortDes @@ -78,9 +76,10 @@ class _InPatientPageState extends State { ), iconSize: 20, // padding: EdgeInsets.only(bottom: 30), - onPressed: () { + onPressed: () { GifLoaderDialogUtils.showMyDialog(context); - widget.patientSearchViewModel.sortInPatient(isDes: isSortDes); + widget.patientSearchViewModel + .sortInPatient(isDes: isSortDes); isSortDes = !isSortDes; GifLoaderDialogUtils.hideDialog(context); }, @@ -89,105 +88,146 @@ class _InPatientPageState extends State { ], ), ), - widget.patientSearchViewModel.state == ViewState.Idle?widget.patientSearchViewModel.filteredInPatientItems.length > 0 - ? (widget.isMyInPatient && widget.patientSearchViewModel.myIinPatientList.length ==0 )?NoData():Expanded( - child: Container( - margin: EdgeInsets.symmetric(horizontal: 16.0), - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ...List.generate( - widget.patientSearchViewModel.filteredInPatientItems.length, (index) { - if (!widget.isMyInPatient) - return PatientCard( - patientInfo: - widget.patientSearchViewModel.filteredInPatientItems[index], - patientType: "1", - arrivalType: "1", - isInpatient: true, - isMyPatient: widget.patientSearchViewModel.filteredInPatientItems[index] - .doctorId == - widget.patientSearchViewModel.doctorProfile.doctorID, - onTap: () { - FocusScopeNode currentFocus = - FocusScope.of(context); - if (!currentFocus.hasPrimaryFocus) { - currentFocus.unfocus(); - } + widget.patientSearchViewModel.state == ViewState.Idle + ? widget.patientSearchViewModel.filteredInPatientItems.length > 0 + ? (widget.isMyInPatient && + widget.patientSearchViewModel.myIinPatientList + .length == + 0) + ? NoData() + : Expanded( + child: Container( + margin: EdgeInsets.symmetric(horizontal: 16.0), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ListView.builder( + itemCount: widget.patientSearchViewModel + .filteredInPatientItems.length, + scrollDirection: Axis.vertical, + physics: ScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + if (!widget.isMyInPatient) + return PatientCard( + patientInfo: widget + .patientSearchViewModel + .filteredInPatientItems[index], + patientType: "1", + arrivalType: "1", + isInpatient: true, + isMyPatient: widget + .patientSearchViewModel + .filteredInPatientItems[ + index] + .doctorId == + widget.patientSearchViewModel + .doctorProfile.doctorID, + onTap: () { + FocusScopeNode currentFocus = + FocusScope.of(context); + if (!currentFocus + .hasPrimaryFocus) { + currentFocus.unfocus(); + } - Navigator.of(context).pushNamed( - PATIENTS_PROFILE, - arguments: { - "patient": widget.patientSearchViewModel. - filteredInPatientItems[index], - "patientType": "1", - "from": "0", - "to": "0", - "isSearch": false, - "isInpatient": true, - "arrivalType": "1", - "isMyPatient":widget.patientSearchViewModel.filteredInPatientItems[index] - .doctorId == - widget.patientSearchViewModel.doctorProfile.doctorID, - }); - }, - ); - else if (widget.patientSearchViewModel.filteredInPatientItems[index] - .doctorId == - widget.patientSearchViewModel.doctorProfile.doctorID && - widget.isMyInPatient) - return PatientCard( - patientInfo: - widget.patientSearchViewModel.filteredInPatientItems[index], - patientType: "1", - arrivalType: "1", - isInpatient: true, - isMyPatient: widget.patientSearchViewModel - .filteredInPatientItems[index] - .doctorId == - widget.patientSearchViewModel.doctorProfile.doctorID, - onTap: () { - FocusScopeNode currentFocus = - FocusScope.of(context); - if (!currentFocus.hasPrimaryFocus) { - currentFocus.unfocus(); - } + Navigator.of(context).pushNamed( + PATIENTS_PROFILE, + arguments: { + "patient": widget + .patientSearchViewModel + .filteredInPatientItems[index], + "patientType": "1", + "from": "0", + "to": "0", + "isSearch": false, + "isInpatient": true, + "arrivalType": "1", + "isMyPatient": widget + .patientSearchViewModel + .filteredInPatientItems[ + index] + .doctorId == + widget + .patientSearchViewModel + .doctorProfile + .doctorID, + }); + }, + ); + else if (widget + .patientSearchViewModel + .filteredInPatientItems[ + index] + .doctorId == + widget.patientSearchViewModel + .doctorProfile.doctorID && + widget.isMyInPatient) + return PatientCard( + patientInfo: widget + .patientSearchViewModel + .filteredInPatientItems[index], + patientType: "1", + arrivalType: "1", + isInpatient: true, + isMyPatient: widget + .patientSearchViewModel + .filteredInPatientItems[ + index] + .doctorId == + widget.patientSearchViewModel + .doctorProfile.doctorID, + onTap: () { + FocusScopeNode currentFocus = + FocusScope.of(context); + if (!currentFocus + .hasPrimaryFocus) { + currentFocus.unfocus(); + } - Navigator.of(context).pushNamed( - PATIENTS_PROFILE, - arguments: { - "patient": widget.patientSearchViewModel.filteredInPatientItems[index], - "patientType": "1", - "from": "0", - "to": "0", - "isSearch": false, - "isInpatient": true, - "arrivalType": "1", - "isMyPatient":widget.patientSearchViewModel.filteredInPatientItems[index] - .doctorId == - widget.patientSearchViewModel.doctorProfile.doctorID, - }); - }, - ); - else - return SizedBox(); - }), - SizedBox( - height: 15, - ) - ], + Navigator.of(context).pushNamed( + PATIENTS_PROFILE, + arguments: { + "patient": widget + .patientSearchViewModel + .filteredInPatientItems[index], + "patientType": "1", + "from": "0", + "to": "0", + "isSearch": false, + "isInpatient": true, + "arrivalType": "1", + "isMyPatient": widget + .patientSearchViewModel + .filteredInPatientItems[ + index] + .doctorId == + widget + .patientSearchViewModel + .doctorProfile + .doctorID, + }); + }, + ); + else + return SizedBox(); + }), + SizedBox( + height: 15, + ) + ], + ), + ), + ), + ) + : NoData() + : Center( + child: Container( + height: 300, + width: 300, + ), ), - ), - ), - ) - : NoData(): Center( - child: Container( - height: 300, - width: 300, - - ), - ), ], ), ); @@ -202,12 +242,11 @@ class NoData extends StatelessWidget { @override Widget build(BuildContext context) { return Expanded( - child: SingleChildScrollView( - child: Container( - child: ErrorMessage( - error: - TranslationBase.of(context).noDataAvailable)), - ), - ); + child: SingleChildScrollView( + child: Container( + child: ErrorMessage( + error: TranslationBase.of(context).noDataAvailable)), + ), + ); } } diff --git a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart index 081f1a6e..be08aec2 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart @@ -47,8 +47,7 @@ class _UcafDetailScreenState extends State { builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, - appBar: PatientProfileAppBar( - patient), + appBar: PatientProfileAppBar(patient), appBarTitle: TranslationBase.of(context).ucaf, body: Column( children: [ @@ -234,10 +233,15 @@ class _UcafDetailScreenState extends State { case 0: if (model.patientAssessmentList != null) { return [ - ...List.generate( - model.patientAssessmentList.length, - (index) => DiagnosisWidget( - model, model.patientAssessmentList[index])).toList() + ListView.builder( + itemCount: model.patientAssessmentList.length, + scrollDirection: Axis.vertical, + physics: ScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return DiagnosisWidget( + model, model.patientAssessmentList[index]); + }) ]; } else { return [ @@ -247,22 +251,30 @@ class _UcafDetailScreenState extends State { break; case 1: return [ - ...List.generate( - model.prescriptionList != null + ListView.builder( + itemCount: model.prescriptionList != null ? model.prescriptionList.entityList.length : 0, - (index) => MedicationWidget( - model, model.prescriptionList.entityList[index])).toList() + scrollDirection: Axis.vertical, + physics: ScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return MedicationWidget( + model, model.prescriptionList.entityList[index]); + }) ]; break; case 2: if (model.orderProcedures != null) { return [ - ...List.generate( - model.orderProcedures.length, - (index) => - ProceduresWidget(model, model.orderProcedures[index])) - .toList() + ListView.builder( + itemCount: model.orderProcedures.length, + scrollDirection: Axis.vertical, + physics: ScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return ProceduresWidget(model, model.orderProcedures[index]); + }) ]; } else { return [ diff --git a/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart b/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart index cb6c1e5f..29697dc1 100644 --- a/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-inpatient-screen.dart @@ -18,7 +18,8 @@ import 'my-referral-patient-screen.dart'; class MyReferralInPatientScreen extends StatefulWidget { @override - _MyReferralInPatientScreenState createState() => _MyReferralInPatientScreenState(); + _MyReferralInPatientScreenState createState() => + _MyReferralInPatientScreenState(); } class _MyReferralInPatientScreenState extends State { @@ -76,51 +77,87 @@ class _MyReferralInPatientScreenState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - ...List.generate( - model.myReferralPatients.length, - (index) => InkWell( - onTap: () { - if(patientType == PatientType.OUT_PATIENT) { - Navigator.push( - context, - FadePage( - page: MyReferralDetailScreen(referralPatient: model.myReferralPatients[index]), - ), - ); - } else{ - Navigator.push( - context, - FadePage( - page: ReferralPatientDetailScreen(model.myReferralPatients[index], model), - ), - ); - } - - }, - child: PatientReferralItemWidget( - referralStatus: model.getReferralStatusNameByCode( - model.myReferralPatients[index].referralStatus, context), - referralStatusCode: model.myReferralPatients[index].referralStatus, - patientName: model.myReferralPatients[index].patientName, - patientGender: model.myReferralPatients[index].gender, - referredDate: AppDateUtils.getDayMonthYearDateFormatted( - model.myReferralPatients[index].referralDate), - referredTime: AppDateUtils.getTimeHHMMA(model.myReferralPatients[index].referralDate), - patientID: "${model.myReferralPatients[index].patientID}", - isSameBranch: false, - isReferral: true, - isReferralClinic: true, - referralClinic: "${model.myReferralPatients[index].referringClinicDescription}", - remark: model.myReferralPatients[index].referringDoctorRemarks, - nationality: model.myReferralPatients[index].nationalityName, - nationalityFlag: model.myReferralPatients[index].nationalityFlagURL, - doctorAvatar: model.myReferralPatients[index].doctorImageURL, - referralDoctorName: model.myReferralPatients[index].referringDoctorName, - clinicDescription: model.myReferralPatients[index].referringClinicDescription, - infoIcon: Icon(FontAwesomeIcons.arrowRight, size: 25, color: Colors.black), - ), - ), - ), + ListView.builder( + itemCount: model.myReferralPatients.length, + scrollDirection: Axis.vertical, + physics: ScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return InkWell( + onTap: () { + if (patientType == + PatientType.OUT_PATIENT) { + Navigator.push( + context, + FadePage( + page: MyReferralDetailScreen( + referralPatient: model + .myReferralPatients[index]), + ), + ); + } else { + Navigator.push( + context, + FadePage( + page: ReferralPatientDetailScreen( + model.myReferralPatients[index], + model), + ), + ); + } + }, + child: PatientReferralItemWidget( + referralStatus: + model.getReferralStatusNameByCode( + model.myReferralPatients[index] + .referralStatus, + context), + referralStatusCode: model + .myReferralPatients[index] + .referralStatus, + patientName: model + .myReferralPatients[index] + .patientName, + patientGender: model + .myReferralPatients[index].gender, + referredDate: AppDateUtils + .getDayMonthYearDateFormatted(model + .myReferralPatients[index] + .referralDate), + referredTime: AppDateUtils.getTimeHHMMA( + model.myReferralPatients[index] + .referralDate), + patientID: + "${model.myReferralPatients[index].patientID}", + isSameBranch: false, + isReferral: true, + isReferralClinic: true, + referralClinic: + "${model.myReferralPatients[index].referringClinicDescription}", + remark: model.myReferralPatients[index] + .referringDoctorRemarks, + nationality: model + .myReferralPatients[index] + .nationalityName, + nationalityFlag: model + .myReferralPatients[index] + .nationalityFlagURL, + doctorAvatar: model + .myReferralPatients[index] + .doctorImageURL, + referralDoctorName: model + .myReferralPatients[index] + .referringDoctorName, + clinicDescription: model + .myReferralPatients[index] + .referringClinicDescription, + infoIcon: Icon( + FontAwesomeIcons.arrowRight, + size: 25, + color: Colors.black), + ), + ); + }) ], ), ), diff --git a/lib/screens/patients/profile/referral/referred-patient-screen.dart b/lib/screens/patients/profile/referral/referred-patient-screen.dart index 8dce7d60..354ee04f 100644 --- a/lib/screens/patients/profile/referral/referred-patient-screen.dart +++ b/lib/screens/patients/profile/referral/referred-patient-screen.dart @@ -13,7 +13,6 @@ import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class ReferredPatientScreen extends StatefulWidget { - @override _ReferredPatientScreenState createState() => _ReferredPatientScreenState(); } @@ -69,79 +68,87 @@ class _ReferredPatientScreenState extends State { ), ) : Expanded( - child: SingleChildScrollView( + child: SingleChildScrollView( // DoctorApplication.svc/REST/GtMyReferredPatient child: Container( child: Column( children: [ - ...List.generate( - model.listMyReferredPatientModel.length, - (index) => InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: ReferredPatientDetailScreen( - model.getReferredPatientItem(index), this.patientType), - ), - ); - }, - child: PatientReferralItemWidget( - referralStatus: model - .getReferredPatientItem(index) - .referralStatusDesc, - referralStatusCode: model - .getReferredPatientItem(index) - .referralStatus, - patientName: - "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}", - patientGender: - model.getReferredPatientItem(index).gender, - referredDate: - AppDateUtils.convertDateFromServerFormat( - model - .getReferredPatientItem(index) - .referralDate, - "dd/MM/yyyy"), - referredTime: - AppDateUtils.convertDateFromServerFormat( - model - .getReferredPatientItem(index) - .referralDate, - "hh:mm a"), - patientID: - "${model.getReferredPatientItem(index).patientID}", - isSameBranch: model - .getReferredPatientItem(index) - .isReferralDoctorSameBranch, - isReferral: false, - remark: model - .getReferredPatientItem(index) - .referringDoctorRemarks, - nationality: model - .getReferredPatientItem(index) - .nationalityName, - nationalityFlag: model - .getReferredPatientItem(index) - .nationalityFlagURL, - doctorAvatar: model - .getReferredPatientItem(index) - .doctorImageURL, - referralDoctorName: - "${TranslationBase.of(context).dr} ${model.getReferredPatientItem(index).referralDoctorName}", - clinicDescription: model - .getReferredPatientItem(index) - .referralClinicDescription, - infoIcon: Icon(FontAwesomeIcons.arrowRight, - size: 25, color: Colors.black), - ), - ), + ListView.builder( + itemCount: + model.listMyReferredPatientModel.length, + scrollDirection: Axis.vertical, + physics: ScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return InkWell( + onTap: () { + Navigator.push( + context, + FadePage( + page: ReferredPatientDetailScreen( + model.getReferredPatientItem(index), + this.patientType), + ), + ); + }, + child: PatientReferralItemWidget( + referralStatus: model + .getReferredPatientItem(index) + .referralStatusDesc, + referralStatusCode: model + .getReferredPatientItem(index) + .referralStatus, + patientName: + "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}", + patientGender: model + .getReferredPatientItem(index) + .gender, + referredDate: AppDateUtils + .convertDateFromServerFormat( + model + .getReferredPatientItem(index) + .referralDate, + "dd/MM/yyyy"), + referredTime: AppDateUtils + .convertDateFromServerFormat( + model + .getReferredPatientItem(index) + .referralDate, + "hh:mm a"), + patientID: + "${model.getReferredPatientItem(index).patientID}", + isSameBranch: model + .getReferredPatientItem(index) + .isReferralDoctorSameBranch, + isReferral: false, + remark: model + .getReferredPatientItem(index) + .referringDoctorRemarks, + nationality: model + .getReferredPatientItem(index) + .nationalityName, + nationalityFlag: model + .getReferredPatientItem(index) + .nationalityFlagURL, + doctorAvatar: model + .getReferredPatientItem(index) + .doctorImageURL, + referralDoctorName: + "${TranslationBase.of(context).dr} ${model.getReferredPatientItem(index).referralDoctorName}", + clinicDescription: model + .getReferredPatientItem(index) + .referralClinicDescription, + infoIcon: Icon(FontAwesomeIcons.arrowRight, + size: 25, color: Colors.black), + ), + ); + }, ), ], ), ), ), - ), + ), ], ), ), From c608b5601dd45cdf68f5c6dce9a1d5495aea4348 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 8 Sep 2021 09:48:34 +0300 Subject: [PATCH 2/2] add arrow to patient card --- .../patients/patient_card/PatientCard.dart | 102 +++++++++--------- 1 file changed, 53 insertions(+), 49 deletions(-) diff --git a/lib/widgets/patients/patient_card/PatientCard.dart b/lib/widgets/patients/patient_card/PatientCard.dart index b86256fd..efc85f18 100644 --- a/lib/widgets/patients/patient_card/PatientCard.dart +++ b/lib/widgets/patients/patient_card/PatientCard.dart @@ -348,58 +348,62 @@ class PatientCard extends StatelessWidget { width: 10, ), Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - CustomRow( - label: TranslationBase.of(context).fileNumber, - value: patientInfo.patientId.toString(), - ), - - //if (isInpatient) - - CustomRow( - label: TranslationBase.of(context).age + " : ", - value: - "${AppDateUtils.getAgeByBirthday(patientInfo.dateofBirth, context, isServerFormat: !isFromLiveCare)}", - ), - - if (isInpatient) - 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) - CustomRow( - label: TranslationBase.of(context).numOfDays + - " : ", - value: - "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}", - ), - if (patientInfo.admissionDate != null) - CustomRow( - label: - TranslationBase.of(context).roomNo + " : ", - value: "${patientInfo.roomId}", - ), - - if (isFromLiveCare) - Column( - children: [ + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ CustomRow( - label: TranslationBase.of(context).clinic + - " : ", - value: patientInfo.clinicName, + label: TranslationBase.of(context).fileNumber, + value: patientInfo.patientId.toString(), ), - ], + CustomRow( + label: TranslationBase.of(context).age + " : ", + value: + "${AppDateUtils.getAgeByBirthday(patientInfo.dateofBirth, context, isServerFormat: !isFromLiveCare)}", + ), + + if (isInpatient) + 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) + CustomRow( + label: TranslationBase.of(context).numOfDays + + " : ", + value: + "${DateTime.now().difference(AppDateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}", + ), + if (patientInfo.admissionDate != null) + CustomRow( + label: + TranslationBase.of(context).roomNo + " : ", + value: "${patientInfo.roomId}", + ), + + if (isFromLiveCare) + Column( + children: [ + CustomRow( + label: TranslationBase.of(context).clinic + + " : ", + value: patientInfo.clinicName, + ), + ], + ), + ]), ), - ])) + Icon(Icons.arrow_forward, size: 24,), + ], + )) ]), isFromLiveCare ? Row(