From 74a6ebebdc1625912464d2ed26619b3f8850699c Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Sun, 15 Aug 2021 12:16:34 +0300 Subject: [PATCH] remove unnecessary step for inpatient --- .../objective/update_objective_page.dart | 12 +- .../steper/steps_widget.dart | 512 +++++++++--------- .../soap_update/update_soap_index.dart | 7 +- 3 files changed, 284 insertions(+), 247 deletions(-) diff --git a/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart b/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart index c93a6c57..b780e952 100644 --- a/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart +++ b/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart @@ -266,8 +266,14 @@ class _UpdateObjectivePageState extends State widget.changeLoadingState(false); Helpers.showErrorToast(model.error); } else { - widget.changeLoadingState(true); - widget.changePageViewIndex(2); + if(widget.patientInfo.admissionNo != null && + widget.patientInfo.admissionNo.isNotEmpty) { + Navigator.of(context).pop(); + } else { + widget.changeLoadingState(true); + widget.changePageViewIndex(2); + } + } } else { Helpers.showErrorToast(TranslationBase.of(context).examinationErrorMsg); @@ -310,7 +316,7 @@ class _UpdateObjectivePageState extends State element.selectedExamination.id, orElse: () => null)) == null) { - mySelectedExamination.add(element); + mySelectedExamination.insert(0,element); } }); diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/steps_widget.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/steps_widget.dart index f18f61da..6320fc41 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/steps_widget.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steper/steps_widget.dart @@ -15,14 +15,28 @@ class StepsWidget extends StatelessWidget { final double height; final PatiantInformtion patientInfo; - StepsWidget({Key key, this.index, this.changeCurrentTab, this.height = 0.0, this.patientInfo}); + StepsWidget( + {Key key, + this.index, + this.changeCurrentTab, + this.height = 0.0, + this.patientInfo}); @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - double circleHeight = (SizeConfig.isHeightVeryShort ?30:SizeConfig.isHeightShort?38:38); - double circleTop = (SizeConfig.isHeightVeryShort ?12:SizeConfig.isHeightShort?10:10); - double containerHeight = SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort?16:15); + double circleHeight = (SizeConfig.isHeightVeryShort + ? 30 + : SizeConfig.isHeightShort + ? 38 + : 38); + double circleTop = (SizeConfig.isHeightVeryShort + ? 12 + : SizeConfig.isHeightShort + ? 10 + : 10); + double containerHeight = + SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 16 : 15); return !projectViewModel.isArabic ? Stack( @@ -33,21 +47,22 @@ class StepsWidget extends StatelessWidget { color: Colors.transparent, ), Positioned( - top: 30 - , + top: 30, child: Center( child: Container( - width: MediaQuery - .of(context) - .size - .width * 0.9, + width: MediaQuery.of(context).size.width * + (patientInfo.admissionNo == null && + patientInfo.admissionNo.isEmpty + ? 0.9 + : 0.85), child: Divider( color: Colors.grey, height: 0.75, thickness: 0.75, ), ), - ),), + ), + ), Positioned( top: circleTop, left: 0, @@ -57,8 +72,8 @@ class StepsWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - width:circleHeight, - height: circleHeight, + width: circleHeight, + height: circleHeight, decoration: BoxDecoration( border: index == 0 ? Border.all(color: Color(0xFFCC9B14), width: 2) @@ -84,7 +99,9 @@ class StepsWidget extends StatelessWidget { Column( mainAxisAlignment: MainAxisAlignment.start, children: [ - StepDetailsWidget(stepLabel: "Subjective",), + StepDetailsWidget( + stepLabel: "Subjective", + ), StatusLabel( selectedStepId: index, stepId: 0, @@ -97,10 +114,10 @@ class StepsWidget extends StatelessWidget { ), Positioned( top: circleTop, - left: MediaQuery - .of(context) - .size - .width * 0.25, + left: patientInfo.admissionNo == null && + patientInfo.admissionNo.isEmpty + ? MediaQuery.of(context).size.width * 0.25 + : MediaQuery.of(context).size.width * 0.71, child: InkWell( onTap: () => index >= 1 ? changeCurrentTab(1) : null, child: Column( @@ -108,7 +125,7 @@ class StepsWidget extends StatelessWidget { children: [ Container( width: circleHeight, - height: circleHeight, + height: circleHeight, decoration: BoxDecoration( border: index == 1 ? Border.all(color: Color(0xFFCC9B14), width: 2) @@ -136,7 +153,9 @@ class StepsWidget extends StatelessWidget { Column( mainAxisAlignment: MainAxisAlignment.start, children: [ - StepDetailsWidget(stepLabel: "Objective",), + StepDetailsWidget( + stepLabel: "Objective", + ), StatusLabel( selectedStepId: index, stepId: 1, @@ -147,109 +166,115 @@ class StepsWidget extends StatelessWidget { ), ), ), - Positioned( - top: circleTop, - left: MediaQuery - .of(context) - .size - .width * 0.47, - child: InkWell( - onTap: () { - if (index >= 3) changeCurrentTab(2); - }, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - width:circleHeight, - height: circleHeight, - decoration: BoxDecoration( - border: index == 2 - ? Border.all(color: Color(0xFFCC9B14), width: 2) - : index > 2 - ? null - : Border.all( - color: Color(0xFFCCCCCC), width: 0.75), - shape: BoxShape.circle, - color: index == 2 - ? Color(0xFFCC9B14) - : index > 2 - ? Color(0xFF359846) - : Color(0xFFCCCCCC), - ), - child: Center( - child: Icon( - FontAwesomeIcons.check, - size: 20, - color: Colors.white, - )), - ), - SizedBox( - height: 5, - ), - Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - StepDetailsWidget(stepLabel: "Assessment",), - StatusLabel( - selectedStepId: index, - stepId: 2, + if (patientInfo.admissionNo == null && + patientInfo.admissionNo.isEmpty) + Positioned( + top: circleTop, + left: MediaQuery.of(context).size.width * 0.47, + child: InkWell( + onTap: () { + if (index >= 3) changeCurrentTab(2); + }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: circleHeight, + height: circleHeight, + decoration: BoxDecoration( + border: index == 2 + ? Border.all(color: Color(0xFFCC9B14), width: 2) + : index > 2 + ? null + : Border.all( + color: Color(0xFFCCCCCC), width: 0.75), + shape: BoxShape.circle, + color: index == 2 + ? Color(0xFFCC9B14) + : index > 2 + ? Color(0xFF359846) + : Color(0xFFCCCCCC), ), - ], - ), - ], + child: Center( + child: Icon( + FontAwesomeIcons.check, + size: 20, + color: Colors.white, + )), + ), + SizedBox( + height: 5, + ), + Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + StepDetailsWidget( + stepLabel: "Assessment", + ), + StatusLabel( + selectedStepId: index, + stepId: 2, + ), + ], + ), + ], + ), ), ), - ), - Positioned( - top: circleTop, - right: 0, - child: InkWell( - onTap: () => index >= 3 ? changeCurrentTab(4) : null, - child: Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Container( - width:circleHeight, - height: circleHeight, - decoration: BoxDecoration( - border: index == 3 - ? Border.all(color: Color(0xFFCC9B14), width: 2) - : index > 3 - ? null - : Border.all( - color: Color(0xFFCCCCCC), width: 0.75), - shape: BoxShape.circle, - color: index == 3 - ? Color(0xFFCC9B14) - : index > 3 - ? Color(0xFF359846) - : Color(0xFFCCCCCC), - ), - child: Center( - child: Icon( - FontAwesomeIcons.check, - size: 20, - color: Colors.white, - )), - ), - SizedBox( - height: 5, - ), - Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - StepDetailsWidget(stepLabel: "Plan",marginLeft: 30,), - StatusLabel( - selectedStepId: index, - stepId: 3, + if (patientInfo.admissionNo == null && + patientInfo.admissionNo.isEmpty) + Positioned( + top: circleTop, + right: 0, + child: InkWell( + onTap: () => index >= 3 ? changeCurrentTab(4) : null, + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Container( + width: circleHeight, + height: circleHeight, + decoration: BoxDecoration( + border: index == 3 + ? Border.all(color: Color(0xFFCC9B14), width: 2) + : index > 3 + ? null + : Border.all( + color: Color(0xFFCCCCCC), width: 0.75), + shape: BoxShape.circle, + color: index == 3 + ? Color(0xFFCC9B14) + : index > 3 + ? Color(0xFF359846) + : Color(0xFFCCCCCC), ), - ], - ), - ], + child: Center( + child: Icon( + FontAwesomeIcons.check, + size: 20, + color: Colors.white, + )), + ), + SizedBox( + height: 5, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + StepDetailsWidget( + stepLabel: "Plan", + marginLeft: 30, + ), + StatusLabel( + selectedStepId: index, + stepId: 3, + ), + ], + ), + ], + ), ), ), - ), ], ) : Stack( @@ -260,21 +285,19 @@ class StepsWidget extends StatelessWidget { color: Colors.transparent, ), Positioned( - top: 30 - , + top: 30, child: Center( child: Container( - width: MediaQuery - .of(context) - .size - .width * 0.9, + width: MediaQuery.of(context).size.width * (patientInfo.admissionNo == null && + patientInfo.admissionNo.isEmpty?0.9:0.85), child: Divider( color: Colors.grey, height: 0.75, thickness: 0.75, ), ), - ),), + ), + ), Positioned( top: circleTop, right: 0, @@ -284,8 +307,8 @@ class StepsWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - width:circleHeight, - height: circleHeight, + width: circleHeight, + height: circleHeight, decoration: BoxDecoration( border: index == 0 ? Border.all(color: Color(0xFFCC9B14), width: 2) @@ -298,19 +321,21 @@ class StepsWidget extends StatelessWidget { ? Color(0xFFCC9B14) : index > 0 ? Color(0xFF359846) - : Color(0xFFCCCCCC), + : Color(0xFFCCCCCC), ), child: Center( child: Icon( - FontAwesomeIcons.check, - size: 20, - color: Colors.white, - )), + FontAwesomeIcons.check, + size: 20, + color: Colors.white, + )), ), SizedBox(height: 3), Column( children: [ - StepDetailsWidget(stepLabel: "شخصي",), + StepDetailsWidget( + stepLabel: "شخصي", + ), StatusLabel( selectedStepId: index, stepId: 0, @@ -323,18 +348,16 @@ class StepsWidget extends StatelessWidget { ), Positioned( top: circleTop, - right: MediaQuery - .of(context) - .size - .width * 0.25, + right: MediaQuery.of(context).size.width * (patientInfo.admissionNo == null && + patientInfo.admissionNo.isEmpty?0.25:0.71), child: InkWell( onTap: () => index >= 2 ? changeCurrentTab(1) : null, child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( - width:circleHeight, - height: circleHeight, + width: circleHeight, + height: circleHeight, decoration: BoxDecoration( border: index == 1 ? Border.all(color: Color(0xFFCC9B14), width: 2) @@ -347,19 +370,21 @@ class StepsWidget extends StatelessWidget { ? Color(0xFFCC9B14) : index > 1 ? Color(0xFF359846) - : Color(0xFFCCCCCC), + : Color(0xFFCCCCCC), ), child: Center( child: Icon( - FontAwesomeIcons.check, - size: 20, - color: Colors.white, - )), + FontAwesomeIcons.check, + size: 20, + color: Colors.white, + )), ), SizedBox(height: 5), Column( children: [ - StepDetailsWidget(stepLabel: "هدف",), + StepDetailsWidget( + stepLabel: "هدف", + ), StatusLabel( selectedStepId: index, stepId: 1, @@ -370,111 +395,116 @@ class StepsWidget extends StatelessWidget { ), ), ), - Positioned( - top: circleTop, - right: MediaQuery - .of(context) - .size - .width * 0.50, - child: InkWell( - onTap: () => index >= 3 ? changeCurrentTab(2) : null, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - width:circleHeight, - height: circleHeight, - decoration: BoxDecoration( - border: index == 2 - ? Border.all(color: Color(0xFFCC9B14), width: 2) - : index > 2 - ? null - : Border.all( - color: Color(0xFFCCCCCC), width: 0.75), - shape: BoxShape.circle, - color: index == 2 - ? Color(0xFFCC9B14) - : index > 2 - ? Color(0xFFCC9B14) - : Color(0xFFCCCCCC), + if (patientInfo.admissionNo == null && + patientInfo.admissionNo.isEmpty) + Positioned( + top: circleTop, + right: MediaQuery.of(context).size.width * 0.50, + child: InkWell( + onTap: () => index >= 3 ? changeCurrentTab(2) : null, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: circleHeight, + height: circleHeight, + decoration: BoxDecoration( + border: index == 2 + ? Border.all(color: Color(0xFFCC9B14), width: 2) + : index > 2 + ? null + : Border.all( + color: Color(0xFFCCCCCC), width: 0.75), + shape: BoxShape.circle, + color: index == 2 + ? Color(0xFFCC9B14) + : index > 2 + ? Color(0xFFCC9B14) + : Color(0xFFCCCCCC), + ), + child: Center( + child: Icon( + FontAwesomeIcons.check, + size: 20, + color: Colors.white, + )), ), - child: Center( - child: Icon( - FontAwesomeIcons.check, - size: 20, - color: Colors.white, - )), - ), - SizedBox( - height: 5, - ), - Padding( - padding: const EdgeInsets.only(right: 2), - child: Column( - children: [ - StepDetailsWidget(stepLabel: "تقدير",), - StatusLabel( - selectedStepId: index, - stepId: 2, - ), - ], + SizedBox( + height: 5, ), - ), - ], + Padding( + padding: const EdgeInsets.only(right: 2), + child: Column( + children: [ + StepDetailsWidget( + stepLabel: "تقدير", + ), + StatusLabel( + selectedStepId: index, + stepId: 2, + ), + ], + ), + ), + ], + ), ), ), - ), - Positioned( - top: circleTop, - left: 0, - child: InkWell( - onTap: () => index >= 3 ? changeCurrentTab(4) : null, - child: Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Container( - width:circleHeight, - height: circleHeight, - decoration: BoxDecoration( - border: index == 3 - ? Border.all(color: Color(0xFFCC9B14), width: 2) - : index > 3 - ? null - : Border.all( - color: Color(0xFFCCCCCC), width: 0.75), - shape: BoxShape.circle, - color: index == 3 - ? Color(0xFFCC9B14) - : index > 3 - ? Color(0xFFCC9B14) - : Color(0xFFCCCCCC), + if (patientInfo.admissionNo == null && + patientInfo.admissionNo.isEmpty) + Positioned( + top: circleTop, + left: 0, + child: InkWell( + onTap: () => index >= 3 ? changeCurrentTab(4) : null, + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Container( + width: circleHeight, + height: circleHeight, + decoration: BoxDecoration( + border: index == 3 + ? Border.all(color: Color(0xFFCC9B14), width: 2) + : index > 3 + ? null + : Border.all( + color: Color(0xFFCCCCCC), width: 0.75), + shape: BoxShape.circle, + color: index == 3 + ? Color(0xFFCC9B14) + : index > 3 + ? Color(0xFFCC9B14) + : Color(0xFFCCCCCC), + ), + child: Center( + child: Icon( + FontAwesomeIcons.check, + size: 20, + color: Colors.white, + )), ), - child: Center( - child: Icon( - FontAwesomeIcons.check, - size: 20, - color: Colors.white, - )), - ), - SizedBox( - height: 5, - ), - Container( - margin: EdgeInsets.only(right: index == 3 ? 15 : 0), - child: Column( - children: [ - StepDetailsWidget(stepLabel: "خطة",), - StatusLabel( - selectedStepId: index, - stepId: 3, - ), - ], + SizedBox( + height: 5, ), - ), - ], + Container( + margin: EdgeInsets.only(right: index == 3 ? 15 : 0), + child: Column( + children: [ + StepDetailsWidget( + stepLabel: "خطة", + ), + StatusLabel( + selectedStepId: index, + stepId: 3, + ), + ], + ), + ), + ], + ), ), ), - ), ], ); } diff --git a/lib/screens/patients/profile/soap_update/update_soap_index.dart b/lib/screens/patients/profile/soap_update/update_soap_index.dart index d4cc5ca9..bbe06c31 100644 --- a/lib/screens/patients/profile/soap_update/update_soap_index.dart +++ b/lib/screens/patients/profile/soap_update/update_soap_index.dart @@ -149,7 +149,7 @@ class _UpdateSoapIndexState extends State Container( child: FractionallySizedBox( widthFactor: .80, - child: getBottomSheet(model) + child: getBottomSheet(model, patient) ), ), SizedBox( @@ -163,7 +163,7 @@ class _UpdateSoapIndexState extends State ); } - Widget getBottomSheet(SOAPViewModel model) { + Widget getBottomSheet(SOAPViewModel model, PatiantInformtion patient) { switch (_currentIndex) { case 0: { @@ -206,7 +206,8 @@ class _UpdateSoapIndexState extends State ), Expanded( child: AppButton( - title: TranslationBase.of(context).next, + title: patient.admissionNo != null && + patient.admissionNo.isNotEmpty?TranslationBase.of(context).finish: TranslationBase.of(context).next, fontWeight: FontWeight.w600, color: Colors.red[700], height: SizeConfig.heightMultiplier *