From aae1cba405c18ea087f7118e0be9ef3683676676 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 8 Sep 2021 15:11:37 +0300 Subject: [PATCH 1/2] re-design UCAF to pager --- lib/config/config.dart | 4 +- .../viewModel/patient-ucaf-viewmodel.dart | 12 +- lib/routes.dart | 7 +- lib/screens/patients/InPatientPage.dart | 56 +++-- .../profile/UCAF/UCAF-detail-screen.dart | 144 ++++-------- .../profile/UCAF/UCAF-input-screen.dart | 80 ++----- .../profile/UCAF/ucaf_pager_screen.dart | 214 ++++++++++++++++++ 7 files changed, 322 insertions(+), 195 deletions(-) create mode 100644 lib/screens/patients/profile/UCAF/ucaf_pager_screen.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index def2806c..7002bc3a 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/patient-ucaf-viewmodel.dart b/lib/core/viewModel/patient-ucaf-viewmodel.dart index b6887061..fab030d9 100644 --- a/lib/core/viewModel/patient-ucaf-viewmodel.dart +++ b/lib/core/viewModel/patient-ucaf-viewmodel.dart @@ -36,6 +36,8 @@ class UcafViewModel extends BaseViewModel { List get orderProcedures => _ucafService.orderProcedureList; + Function saveUCAFOnTap; + String selectedLanguage; String heightCm = "0"; String weightKg = "0"; @@ -56,7 +58,7 @@ class UcafViewModel extends BaseViewModel { } Future getUCAFData(PatiantInformtion patient) async { - setState(ViewState.Busy); + // setState(ViewState.Busy); String from; String to; @@ -112,7 +114,7 @@ class UcafViewModel extends BaseViewModel { Future getPatientAssessment(PatiantInformtion patient) async { if (patientAssessmentList.isEmpty) { - setState(ViewState.Busy); + // setState(ViewState.Busy); await _ucafService.getPatientAssessment(patient); if (_ucafService.hasError) { error = _ucafService.error; @@ -139,7 +141,7 @@ class UcafViewModel extends BaseViewModel { Future getOrderProcedures(PatiantInformtion patient) async { if (orderProcedures.isEmpty) { - setState(ViewState.Busy); + // setState(ViewState.Busy); await _ucafService.getOrderProcedures(patient); if (_ucafService.hasError) { error = _ucafService.error; @@ -152,7 +154,7 @@ class UcafViewModel extends BaseViewModel { Future getPrescription(PatiantInformtion patient) async { if (prescriptionList == null) { - setState(ViewState.Busy); + // setState(ViewState.Busy); await _ucafService.getPrescription(patient); if (_ucafService.hasError) { error = _ucafService.error; @@ -190,7 +192,7 @@ class UcafViewModel extends BaseViewModel { } Future postUCAF(PatiantInformtion patient) async { - setState(ViewState.Busy); + // setState(ViewState.Busy); await _ucafService.postUCAF(patient); if (_ucafService.hasError) { error = _ucafService.error; diff --git a/lib/routes.dart b/lib/routes.dart index 742ac118..712db98c 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -3,8 +3,6 @@ import 'package:doctor_app_flutter/screens/live_care/end_call_screen.dart'; import 'package:doctor_app_flutter/screens/medical-file/health_summary_page.dart'; import 'package:doctor_app_flutter/screens/patients/ECGPage.dart'; import 'package:doctor_app_flutter/screens/patients/insurance_approval_screen_patient.dart'; -import 'package:doctor_app_flutter/screens/patients/profile/UCAF/UCAF-detail-screen.dart'; -import 'package:doctor_app_flutter/screens/patients/profile/UCAF/UCAF-input-screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/lab_result/all_lab_special_result_page.dart'; import 'package:doctor_app_flutter/screens/patients/profile/lab_result/labs_home_page.dart'; import 'package:doctor_app_flutter/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart'; @@ -22,6 +20,7 @@ import 'package:doctor_app_flutter/screens/sick-leave/show-sickleave.dart'; import 'package:doctor_app_flutter/screens/auth/verification_methods_screen.dart'; import './screens/auth/login_screen.dart'; +import 'screens/patients/profile/UCAF/ucaf_pager_screen.dart'; import 'screens/patients/profile/profile_screen/patient_profile_screen.dart'; import './screens/patients/profile/vital_sign/vital_sign_details_screen.dart'; import 'landing_page.dart'; @@ -109,8 +108,8 @@ var routes = { ORDER_PRESCRIPTION_NEW: (_) => PrescriptionsPage(), ORDER_PROCEDURE: (_) => ProcedureScreen(), MY_REFERRAL_DETAIL: (_) => MyReferralDetailScreen(), - PATIENT_UCAF_REQUEST: (_) => UCAFInputScreen(), - PATIENT_UCAF_DETAIL: (_) => UcafDetailScreen(), + PATIENT_UCAF_REQUEST: (_) => UCAFPagerScreen(), + // PATIENT_UCAF_DETAIL: (_) => UcafDetailScreen(), PATIENT_ECG: (_) => ECGPage(), ALL_SPECIAL_LAB_RESULT: (_) => AllLabSpecialResult(), }; diff --git a/lib/screens/patients/InPatientPage.dart b/lib/screens/patients/InPatientPage.dart index 3b59e546..b5723c5e 100644 --- a/lib/screens/patients/InPatientPage.dart +++ b/lib/screens/patients/InPatientPage.dart @@ -100,6 +100,7 @@ class _InPatientPageState extends State { margin: EdgeInsets.symmetric(horizontal: 16.0), child: SingleChildScrollView( child: Column( + // mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ ListView.builder( @@ -118,15 +119,15 @@ class _InPatientPageState extends State { arrivalType: "1", isInpatient: true, isMyPatient: widget - .patientSearchViewModel - .filteredInPatientItems[ - index] - .doctorId == + .patientSearchViewModel + .filteredInPatientItems[ + index] + .doctorId == widget.patientSearchViewModel .doctorProfile.doctorID, onTap: () { FocusScopeNode currentFocus = - FocusScope.of(context); + FocusScope.of(context); if (!currentFocus .hasPrimaryFocus) { currentFocus.unfocus(); @@ -145,10 +146,10 @@ class _InPatientPageState extends State { "isInpatient": true, "arrivalType": "1", "isMyPatient": widget - .patientSearchViewModel - .filteredInPatientItems[ - index] - .doctorId == + .patientSearchViewModel + .filteredInPatientItems[ + index] + .doctorId == widget .patientSearchViewModel .doctorProfile @@ -157,12 +158,12 @@ class _InPatientPageState extends State { }, ); else if (widget - .patientSearchViewModel - .filteredInPatientItems[ - index] - .doctorId == - widget.patientSearchViewModel - .doctorProfile.doctorID && + .patientSearchViewModel + .filteredInPatientItems[ + index] + .doctorId == + widget.patientSearchViewModel + .doctorProfile.doctorID && widget.isMyInPatient) return PatientCard( patientInfo: widget @@ -172,15 +173,15 @@ class _InPatientPageState extends State { arrivalType: "1", isInpatient: true, isMyPatient: widget - .patientSearchViewModel - .filteredInPatientItems[ - index] - .doctorId == + .patientSearchViewModel + .filteredInPatientItems[ + index] + .doctorId == widget.patientSearchViewModel .doctorProfile.doctorID, onTap: () { FocusScopeNode currentFocus = - FocusScope.of(context); + FocusScope.of(context); if (!currentFocus .hasPrimaryFocus) { currentFocus.unfocus(); @@ -199,10 +200,10 @@ class _InPatientPageState extends State { "isInpatient": true, "arrivalType": "1", "isMyPatient": widget - .patientSearchViewModel - .filteredInPatientItems[ - index] - .doctorId == + .patientSearchViewModel + .filteredInPatientItems[ + index] + .doctorId == widget .patientSearchViewModel .doctorProfile @@ -222,12 +223,7 @@ class _InPatientPageState extends State { ), ) : NoData() - : Center( - child: Container( - height: 300, - width: 300, - ), - ), + : NoData(), ], ), ); diff --git a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart index be08aec2..26a34ed2 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart @@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/models/SOAP/order-procedure.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/UCAF/page-stepper-widget.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/UCAF/ucaf_pager_screen.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -22,33 +23,63 @@ import 'package:hexcolor/hexcolor.dart'; import '../../../../routes.dart'; class UcafDetailScreen extends StatefulWidget { + final PatiantInformtion patient; + final UcafViewModel model; + final Function changeLoadingState; + + UcafDetailScreen(this.patient, this.model, {this.changeLoadingState}); + @override - _UcafDetailScreenState createState() => _UcafDetailScreenState(); + _UcafDetailScreenState createState() => _UcafDetailScreenState(this.patient, this.model); } class _UcafDetailScreenState extends State { + + final PatiantInformtion patient; + final UcafViewModel model; + + UcafViewModel ucafModel; + int _activeTap = 0; + _UcafDetailScreenState(this.patient, this.model); + @override - Widget build(BuildContext context) { - final routeArgs = ModalRoute.of(context).settings.arguments as Map; - PatiantInformtion patient = routeArgs['patient']; - String patientType = routeArgs['patientType']; - String arrivalType = routeArgs['arrivalType']; + void initState() { + model.saveUCAFOnTap = () async{ + widget.changeLoadingState(true); + await ucafModel.postUCAF(patient); + widget.changeLoadingState(false); + if (ucafModel.state == ViewState.Idle) { + DrAppToastMsg.showSuccesToast( + TranslationBase.of(context) + .postUcafSuccessMsg); + Navigator.of(context).popUntil((route) { + return route.settings.name == + PATIENTS_PROFILE; + }); + } else { + DrAppToastMsg.showErrorToast(ucafModel.error); + } + }; + super.initState(); + } + @override + Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; return BaseView( onModelReady: (model) async { + ucafModel = model; model.resetDataInFirst(); await model.getLanguage(); await model.getPatientAssessment(patient); + widget.changeLoadingState(false); }, builder: (_, model, w) => AppScaffold( baseViewModel: model, - isShowAppBar: true, - appBar: PatientProfileAppBar(patient), - appBarTitle: TranslationBase.of(context).ucaf, + isShowAppBar: false, body: Column( children: [ Expanded( @@ -57,35 +88,6 @@ class _UcafDetailScreenState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - // PatientHeaderWidgetNoAvatar(patient), - Container( - margin: EdgeInsets.all(16.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - "${TranslationBase.of(context).patient}", - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.6, - fontWeight: FontWeight.w600, - ), - AppText( - "${TranslationBase.of(context).ucaf}", - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 3, - fontWeight: FontWeight.bold, - ) - ], - ), - ), - PageStepperWidget( - stepsCount: 2, - currentStepIndex: 2, - screenSize: screenSize, - ), - SizedBox( - height: 10, - ), Container( margin: EdgeInsets.symmetric( vertical: 16, horizontal: 16), @@ -106,64 +108,7 @@ class _UcafDetailScreenState extends State { ), ), ), - Container( - margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16), - child: Row( - children: [ - Expanded( - child: Container( - child: AppButton( - title: TranslationBase.of(context).cancel, - hasBorder: true, - vPadding: 8, - hPadding: 8, - borderColor: Colors.white, - color: Colors.white, - fontColor: HexColor("#B8382B"), - fontSize: 2.2, - onPressed: () { - Navigator.of(context).popUntil((route) { - return route.settings.name == - PATIENTS_PROFILE; - }); - }, - ), - ), - ), - SizedBox( - width: 8, - ), - Expanded( - child: Container( - child: AppButton( - title: TranslationBase.of(context).save, - hasBorder: true, - vPadding: 8, - hPadding: 8, - borderColor: HexColor("#B8382B"), - color: HexColor("#B8382B"), - fontColor: Colors.white, - fontSize: 2.0, - onPressed: () async { - await model.postUCAF(patient); - if (model.state == ViewState.Idle) { - DrAppToastMsg.showSuccesToast( - TranslationBase.of(context) - .postUcafSuccessMsg); - Navigator.of(context).popUntil((route) { - return route.settings.name == - PATIENTS_PROFILE; - }); - } else { - DrAppToastMsg.showErrorToast(model.error); - } - }, - ), - ), - ), - ], - ), - ), + ], ), )); @@ -209,12 +154,18 @@ class _UcafDetailScreenState extends State { onTap: () async { print(__treatmentSteps.indexOf(item)); if (__treatmentSteps.indexOf(item) == 0) { + widget.changeLoadingState(true); await model.getPatientAssessment(patient); + widget.changeLoadingState(false); } else if (__treatmentSteps.indexOf(item) == 1) { + widget.changeLoadingState(true); await model.getPrescription(patient); + widget.changeLoadingState(false); } if (__treatmentSteps.indexOf(item) == 2) { + widget.changeLoadingState(true); await model.getOrderProcedures(patient); + widget.changeLoadingState(false); } setState(() { _activeTap = __treatmentSteps.indexOf(item); @@ -288,6 +239,7 @@ class _UcafDetailScreenState extends State { ]; } } + } class DiagnosisWidget extends StatelessWidget { diff --git a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart index 3bbc6637..ab9a3c54 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart @@ -19,11 +19,20 @@ import 'package:hexcolor/hexcolor.dart'; import '../../../../routes.dart'; class UCAFInputScreen extends StatefulWidget { + final PatiantInformtion patient; + final Function changeLoadingState; + + UCAFInputScreen(this.patient, {this.changeLoadingState}); + @override - _UCAFInputScreenState createState() => _UCAFInputScreenState(); + _UCAFInputScreenState createState() => _UCAFInputScreenState(this.patient); } class _UCAFInputScreenState extends State { + final PatiantInformtion patient; + + _UCAFInputScreenState(this.patient); + bool _inPatient = false; bool _emergencyCase = false; final _durationOfIllnessController = TextEditingController(); @@ -53,21 +62,15 @@ class _UCAFInputScreenState extends State { @override Widget build(BuildContext context) { - final routeArgs = ModalRoute.of(context).settings.arguments as Map; - PatiantInformtion patient = routeArgs['patient']; - String patientType = routeArgs['patientType']; - String arrivalType = routeArgs['arrivalType']; - - final screenSize = MediaQuery.of(context).size; - return BaseView( - onModelReady: (model) => model.getUCAFData(patient), + onModelReady: (model) async { + // widget.changeLoadingState(true); + await model.getUCAFData(patient); + widget.changeLoadingState(false); + }, builder: (_, model, w) => AppScaffold( baseViewModel: model, - isShowAppBar: true, - appBar: PatientProfileAppBar( - patient), - appBarTitle: TranslationBase.of(context).ucaf, + isShowAppBar: false, body: model.patientVitalSignsHistory.length > 0 && model.patientChiefComplaintList != null && model.patientChiefComplaintList.length > 0 @@ -79,31 +82,6 @@ class _UCAFInputScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ // PatientHeaderWidgetNoAvatar(patient), - Container( - margin: EdgeInsets.all(16.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - "${TranslationBase.of(context).patient}", - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.6, - fontWeight: FontWeight.w600, - ), - AppText( - "${TranslationBase.of(context).ucaf}", - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 3, - fontWeight: FontWeight.bold, - ) - ], - ), - ), - PageStepperWidget( - stepsCount: 2, - currentStepIndex: 1, - screenSize: screenSize, - ), Container( margin: EdgeInsets.symmetric( vertical: 0, horizontal: 16), @@ -263,7 +241,7 @@ class _UCAFInputScreenState extends State { fontWeight: FontWeight.w700, color: Color(0xFF2E303A), ), - /* SizedBox( + /* SizedBox( height: 4, ), AppText( @@ -323,7 +301,7 @@ class _UCAFInputScreenState extends State { SizedBox( height: 8, ), - /* AppTextFieldCustom( + /* AppTextFieldCustom( hintText: TranslationBase.of(context).other, dropDownText: TranslationBase.of(context).none, enabled: false, @@ -400,21 +378,6 @@ class _UCAFInputScreenState extends State { ), ), ), - Container( - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: AppButton( - title: TranslationBase.of(context).next, - color: HexColor("#D02127"), - onPressed: () { - Navigator.of(context).pushNamed(PATIENT_UCAF_DETAIL, - arguments: { - 'patient': patient, - 'patientType': patientType, - 'arrivalType': arrivalType - }); - }, - ), - ), ], ) : Center( @@ -428,9 +391,10 @@ class _UCAFInputScreenState extends State { Padding( padding: const EdgeInsets.all(8.0), child: AppText( - model.patientVitalSignsHistory.length == 0 - ? TranslationBase.of(context).vitalSignEmptyMsg - : TranslationBase.of(context).chiefComplaintEmptyMsg, + model.patientVitalSignsHistory.length == 0 + ? TranslationBase.of(context).vitalSignEmptyMsg + : TranslationBase.of(context) + .chiefComplaintEmptyMsg, fontWeight: FontWeight.normal, textAlign: TextAlign.center, color: HexColor("#B8382B"), diff --git a/lib/screens/patients/profile/UCAF/ucaf_pager_screen.dart b/lib/screens/patients/profile/UCAF/ucaf_pager_screen.dart new file mode 100644 index 00000000..8c38ece7 --- /dev/null +++ b/lib/screens/patients/profile/UCAF/ucaf_pager_screen.dart @@ -0,0 +1,214 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/UCAF/page-stepper-widget.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.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'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; +import 'package:flutter/material.dart'; + +import '../../../../routes.dart'; +import 'UCAF-detail-screen.dart'; +import 'UCAF-input-screen.dart'; + +class UCAFPagerScreen extends StatefulWidget { + const UCAFPagerScreen({Key key}) : super(key: key); + + @override + _UCAFPagerScreenState createState() => _UCAFPagerScreenState(); +} + +class _UCAFPagerScreenState extends State + with TickerProviderStateMixin { + PageController _controller; + int _currentIndex = 0; + bool _isLoading = true; + + PatiantInformtion patient; + String patientType; + String arrivalType; + + changePageViewIndex(pageIndex, {isChangeState = true}) { + if (pageIndex != _currentIndex && isChangeState) changeLoadingState(true); + _controller.jumpToPage(pageIndex); + setState(() { + _currentIndex = pageIndex; + }); + } + + void changeLoadingState(bool isLoading) { + setState(() { + _isLoading = isLoading; + }); + } + + @override + void initState() { + _controller = new PageController(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + patient = routeArgs['patient']; + patientType = routeArgs['patientType']; + arrivalType = routeArgs['arrivalType']; + + final screenSize = MediaQuery.of(context).size; + + return BaseView( + builder: (_, model, w) => AppScaffold( + isShowAppBar: true, + isLoading: _isLoading, + appBar: PatientProfileAppBar(patient), + appBarTitle: TranslationBase.of(context).ucaf, + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // PatientHeaderWidgetNoAvatar(patient), + Container( + margin: EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + "${TranslationBase.of(context).patient}", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.6, + fontWeight: FontWeight.w600, + ), + AppText( + "${TranslationBase.of(context).ucaf}", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 3, + fontWeight: FontWeight.bold, + ) + ], + ), + ), + PageStepperWidget( + stepsCount: 2, + currentStepIndex: _currentIndex + 1, + screenSize: screenSize, + ), + SizedBox( + height: 10, + ), + Expanded( + child: Container( + color: Theme.of(context).scaffoldBackgroundColor, + child: PageView( + physics: NeverScrollableScrollPhysics(), + controller: _controller, + onPageChanged: (index) { + setState(() { + _currentIndex = index; + }); + }, + scrollDirection: Axis.horizontal, + children: [ + UCAFInputScreen( + patient, + changeLoadingState: changeLoadingState, + ), + UcafDetailScreen( + patient, + model, + changeLoadingState: changeLoadingState, + ), + ]), + ), + ), + ], + ), + ), + ), + _isLoading + ? Container( + height: 0, + ) + : ucafButtons(model), + ], + ), + )); + } + + Widget ucafButtons(UcafViewModel model) { + switch (_currentIndex) { + case 0: + return Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: AppButton( + title: TranslationBase.of(context).next, + color: Color(0xFFD02127), + onPressed: () { + changePageViewIndex(1); + // Navigator.of(context).pushNamed(PATIENT_UCAF_DETAIL, arguments: { + // 'patient': patient, + // 'patientType': patientType, + // 'arrivalType': arrivalType + // }); + }, + ), + ); + case 1: + return Container( + margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16), + child: Row( + children: [ + Expanded( + child: Container( + child: AppButton( + title: TranslationBase.of(context).cancel, + hasBorder: true, + vPadding: 8, + hPadding: 8, + borderColor: Colors.white, + color: Colors.white, + fontColor: Color(0xFFB8382B), + fontSize: 2.2, + onPressed: () { + Navigator.of(context).popUntil((route) { + return route.settings.name == PATIENTS_PROFILE; + }); + }, + ), + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: Container( + child: AppButton( + title: TranslationBase.of(context).save, + hasBorder: true, + vPadding: 8, + hPadding: 8, + borderColor: Color(0xFFB8382B), + color: Color(0xFFB8382B), + fontColor: Colors.white, + fontSize: 2.0, + onPressed: () { + model.saveUCAFOnTap(); + }, + ), + ), + ), + ], + ), + ); + default: + return Container(); + } + } +} From 96ad55b55240508b79e4b317c6f1e3e274795dd2 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 8 Sep 2021 15:31:30 +0300 Subject: [PATCH 2/2] re-design UCAF to pager --- lib/core/viewModel/patient-ucaf-viewmodel.dart | 6 +++++- lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart | 2 +- lib/screens/patients/profile/UCAF/UCAF-input-screen.dart | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/core/viewModel/patient-ucaf-viewmodel.dart b/lib/core/viewModel/patient-ucaf-viewmodel.dart index fab030d9..1dc34679 100644 --- a/lib/core/viewModel/patient-ucaf-viewmodel.dart +++ b/lib/core/viewModel/patient-ucaf-viewmodel.dart @@ -47,7 +47,11 @@ class UcafViewModel extends BaseViewModel { String respirationBeatPerMinute = "0"; String bloodPressure = "0 / 0"; - resetDataInFirst() { + resetDataInFirst({bool firstPage = true}) { + if(firstPage){ + _ucafService.patientVitalSignsHistory = []; + _ucafService.patientChiefComplaintList = []; + } _ucafService.patientAssessmentList = []; _ucafService.orderProcedureList = []; _ucafService.prescriptionList = null; diff --git a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart index 26a34ed2..ea4511e3 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart @@ -72,7 +72,7 @@ class _UcafDetailScreenState extends State { return BaseView( onModelReady: (model) async { ucafModel = model; - model.resetDataInFirst(); + model.resetDataInFirst(firstPage: false); await model.getLanguage(); await model.getPatientAssessment(patient); widget.changeLoadingState(false); diff --git a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart index ab9a3c54..9960a1b3 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart @@ -64,7 +64,7 @@ class _UCAFInputScreenState extends State { Widget build(BuildContext context) { return BaseView( onModelReady: (model) async { - // widget.changeLoadingState(true); + model.resetDataInFirst(); await model.getUCAFData(patient); widget.changeLoadingState(false); },