diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index eaa91131..e9c59d90 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -27,6 +27,10 @@ import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/assessment/assessmentCallBack.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/objective/objectiveCallBack.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/plan/planCallBack.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/subjectiveCallBack.dart'; import 'package:flutter/material.dart'; import '../../locator.dart'; @@ -86,6 +90,9 @@ class SOAPViewModel extends BaseViewModel { _SOAPService.patientAssessmentList; int get episodeID => _SOAPService.episodeID; + bool isAddProgress = true; + String progressNoteText =""; + get medicationStrengthList => _SOAPService.medicationStrengthListWithModel; get medicationDoseTimeList => _SOAPService.medicationDoseTimeListWithModel; get medicationRouteList => _SOAPService.medicationRouteListWithModel; @@ -93,6 +100,43 @@ class SOAPViewModel extends BaseViewModel { List get allMedicationList => _prescriptionService.allMedicationList; + SubjectiveCallBack subjectiveCallBack; + setSubjectiveCallBack(SubjectiveCallBack callBack) + { + this.subjectiveCallBack = callBack; + } + nextOnSubjectPage(model){ + subjectiveCallBack.nextFunction(model); + } + + ObjectiveCallBack objectiveCallBack; + setObjectiveCallBack(ObjectiveCallBack callBack) + { + this.objectiveCallBack = callBack; + } + nextOnObjectivePage(model){ + objectiveCallBack.nextFunction(model); + } + + + AssessmentCallBack assessmentCallBack; + setAssessmentCallBack(AssessmentCallBack callBack) + { + this.assessmentCallBack = callBack; + } + nextOnAssessmentPage(model){ + assessmentCallBack.nextFunction(model); + } + + PlanCallBack planCallBack; + setPlanCallBack(PlanCallBack callBack) + { + this.planCallBack = callBack; + } + nextOnPlanPage(model){ + planCallBack.nextFunction(model); + } + Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { setState(ViewState.Busy); await _SOAPService.getAllergies(getAllergiesRequestModel); diff --git a/lib/locator.dart b/lib/locator.dart index aa259758..3ee2650c 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -109,7 +109,7 @@ void setupLocator() { locator.registerFactory(() => PatientViewModel()); locator.registerFactory(() => DashboardViewModel()); locator.registerFactory(() => SickLeaveViewModel()); - locator.registerFactory(() => SOAPViewModel()); + locator.registerLazySingleton(() => SOAPViewModel()); locator.registerFactory(() => PatientReferralViewModel()); locator.registerFactory(() => PrescriptionViewModel()); locator.registerFactory(() => ProcedureViewModel()); diff --git a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart index 2ac051b1..ed2a2d74 100644 --- a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart +++ b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart @@ -251,6 +251,32 @@ class _AddAssessmentDetailsState extends State { )), )), ), + + if(widget.mySelectedAssessment + .selectedICD != null) + Column( + children: [ + SizedBox( + height: 3, + ), + Container( + width: MediaQuery + .of(context) + .size + .width * 0.7, + child: AppText( + widget.mySelectedAssessment + .selectedICD.description + + (' (${widget.mySelectedAssessment + .selectedICD.code} )'), + color: Color(0xFF575757), + fontSize: 10, + fontWeight: FontWeight.w700, + letterSpacing: -0.4, + ), + ), + ], + ), SizedBox( height: 7, ), diff --git a/lib/screens/patients/profile/soap_update/assessment/assessmentCallBack.dart b/lib/screens/patients/profile/soap_update/assessment/assessmentCallBack.dart new file mode 100644 index 00000000..331b2d15 --- /dev/null +++ b/lib/screens/patients/profile/soap_update/assessment/assessmentCallBack.dart @@ -0,0 +1,3 @@ +abstract class AssessmentCallBack{ + nextFunction(model); +} \ No newline at end of file diff --git a/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart b/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart index c4ee046e..4941b0ed 100644 --- a/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart +++ b/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart @@ -25,6 +25,7 @@ import '../shared_soap_widgets/SOAP_open_items.dart'; import '../shared_soap_widgets/SOAP_step_header.dart'; import '../shared_soap_widgets/expandable_SOAP_widget.dart'; import 'add_assessment_details.dart'; +import 'assessmentCallBack.dart'; // ignore: must_be_immutable class UpdateAssessmentPage extends StatefulWidget { @@ -44,7 +45,7 @@ class UpdateAssessmentPage extends StatefulWidget { _UpdateAssessmentPageState createState() => _UpdateAssessmentPageState(); } -class _UpdateAssessmentPageState extends State { +class _UpdateAssessmentPageState extends State implements AssessmentCallBack{ bool isAssessmentExpand = false; List mySelectedAssessmentList = List(); @@ -54,6 +55,7 @@ class _UpdateAssessmentPageState extends State { return BaseView( onModelReady: (model) async { + model.setAssessmentCallBack(this); mySelectedAssessmentList.clear(); GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel( patientMRN: widget.patientInfo.patientMRN, @@ -525,16 +527,7 @@ class _UpdateAssessmentPageState extends State { disabled: model.state == ViewState.BusyLocal, onPressed: () async { - // TODO Elham* - widget.changePageViewIndex(3); - // if (mySelectedAssessmentList.isEmpty) { - // Helpers.showErrorToast( - // TranslationBase.of(context) - // .assessmentErrorMsg); - // } else { - // widget.changeLoadingState(true); - // widget.changePageViewIndex(3); - // } + }, ), ), @@ -577,4 +570,18 @@ class _UpdateAssessmentPageState extends State { }); }); } + + @override + nextFunction(model) { + // TODO Elham* + widget.changePageViewIndex(3); + // if (mySelectedAssessmentList.isEmpty) { + // Helpers.showErrorToast( + // TranslationBase.of(context) + // .assessmentErrorMsg); + // } else { + // widget.changeLoadingState(true); + // widget.changePageViewIndex(3); + // } + } } diff --git a/lib/screens/patients/profile/soap_update/objective/objectiveCallBack.dart b/lib/screens/patients/profile/soap_update/objective/objectiveCallBack.dart new file mode 100644 index 00000000..466f344e --- /dev/null +++ b/lib/screens/patients/profile/soap_update/objective/objectiveCallBack.dart @@ -0,0 +1,3 @@ +abstract class ObjectiveCallBack{ + nextFunction(model); +} \ No newline at end of file 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 32932d7d..db0484da 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 @@ -10,6 +10,7 @@ import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model. import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.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/soap_update/objective/objectiveCallBack.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/soap_utils.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -43,7 +44,7 @@ class UpdateObjectivePage extends StatefulWidget { _UpdateObjectivePageState createState() => _UpdateObjectivePageState(); } -class _UpdateObjectivePageState extends State { +class _UpdateObjectivePageState extends State implements ObjectiveCallBack { bool isSysExaminationExpand = false; List mySelectedExamination = List(); @@ -64,6 +65,7 @@ class _UpdateObjectivePageState extends State { Widget build(BuildContext context) { return BaseView( onModelReady: (model) async { + model.setObjectiveCallBack(this); mySelectedExamination.clear(); GetPhysicalExamReqModel getPhysicalExamReqModel = GetPhysicalExamReqModel( @@ -71,7 +73,6 @@ class _UpdateObjectivePageState extends State { episodeID: widget.patientInfo.episodeNo.toString(), appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString())); - await model.getPatientPhysicalExam(getPhysicalExamReqModel); if (model.patientPhysicalExamList.isNotEmpty) { if (model.physicalExaminationList.length == 0) { @@ -204,70 +205,7 @@ class _UpdateObjectivePageState extends State { ), ), ), - bottomSheet: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(0.0), - ), - border: Border.all(color: HexColor('#707070'), width: 0), - ), - height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 12 : 10), - width: double.infinity, - child: Column( - children: [ - SizedBox( - height: 10, - ), - Container( - child: FractionallySizedBox( - widthFactor: .80, - child: Center( - child: Row( - children: [ - Expanded( - child: AppButton( - title: TranslationBase.of(context).previous, - color: Colors.grey[300], - height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 8 : 6), - padding: 10, - fontColor: Colors.black, - fontWeight: FontWeight.w600, - onPressed: () { - widget.changePageViewIndex(0); - }, - ), - ), - SizedBox( - width: 5, - ), - Expanded( - child: AppButton( - title: TranslationBase.of(context).next, - fontWeight: FontWeight.w600, - color: Colors.red[700], - height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 8 : 6), - padding: 10, - disabled: model.state == ViewState.BusyLocal, - onPressed: () async { - await submitUpdateObjectivePage(model); - }, - ), - ), - ], - ), - ), - ), - ), - SizedBox( - height: 5, - ), - ], - ), - )), + ), ); } @@ -397,4 +335,9 @@ class _UpdateObjectivePageState extends State { ), ); } + + @override + nextFunction(model) async { + await submitUpdateObjectivePage(model); + } } diff --git a/lib/screens/patients/profile/soap_update/plan/planCallBack.dart b/lib/screens/patients/profile/soap_update/plan/planCallBack.dart new file mode 100644 index 00000000..14fef483 --- /dev/null +++ b/lib/screens/patients/profile/soap_update/plan/planCallBack.dart @@ -0,0 +1,3 @@ +abstract class PlanCallBack{ + nextFunction(model); +} \ No newline at end of file diff --git a/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart b/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart index a39b7472..b40b0a29 100644 --- a/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart +++ b/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart'; @@ -9,6 +10,7 @@ import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model. import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.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/soap_update/plan/planCallBack.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -40,7 +42,7 @@ class UpdatePlanPage extends StatefulWidget { _UpdatePlanPageState createState() => _UpdatePlanPageState(); } -class _UpdatePlanPageState extends State { +class _UpdatePlanPageState extends State implements PlanCallBack { bool isAddProgress = true; bool isProgressExpanded = true; GetPatientProgressNoteResModel patientProgressNote = @@ -73,7 +75,7 @@ class _UpdatePlanPageState extends State { } - getPatientProgressNote(model, {bool isAddProgress = false}) async { + getPatientProgressNote(SOAPViewModel model, {bool isAddProgress = false}) async { GetGetProgressNoteReqModel getGetProgressNoteReqModel = GetGetProgressNoteReqModel( appointmentNo: @@ -83,11 +85,12 @@ class _UpdatePlanPageState extends State { editedBy: '', doctorID: ''); await model.getPatientProgressNote(getGetProgressNoteReqModel); - + ///TODO set progressNote in model; if (model.patientProgressNoteList.isNotEmpty) { progressNoteController.text = Helpers.parseHtmlString( model.patientProgressNoteList[0].planNote); patientProgressNote.planNote = progressNoteController.text; + patientProgressNote.createdByName = model.patientProgressNoteList[0].createdByName; patientProgressNote.createdOn = @@ -100,6 +103,7 @@ class _UpdatePlanPageState extends State { model.patientProgressNoteList[0].appointmentNo; setState(() { isAddProgress = isAddProgress; + model.isAddProgress = isAddProgress; }); } } @@ -108,6 +112,7 @@ class _UpdatePlanPageState extends State { Widget build(BuildContext context) { return BaseView( onModelReady: (model) async { + model.setPlanCallBack(this); GetGetProgressNoteReqModel getGetProgressNoteReqModel = GetGetProgressNoteReqModel( appointmentNo: @@ -135,6 +140,7 @@ class _UpdatePlanPageState extends State { setState(() { isAddProgress = false; + model.isAddProgress = false; }); } widget.changeLoadingState(false); @@ -320,84 +326,7 @@ class _UpdatePlanPageState extends State { ), ), ), - ), - bottomSheet: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(0.0), - ), - border: Border.all(color: HexColor('#707070'), width: 0), - ), - height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 12 : 10), - width: double.infinity, - child: Column( - children: [ - SizedBox( - height: 10, - ), - Container( - child: FractionallySizedBox( - widthFactor: .80, - child: Center( - child: Row( - children: [ - Expanded( - child: AppButton( - height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 8 : 6), - padding: 10, - title: TranslationBase.of(context).previous, - color: Colors.grey[300], - fontColor: Colors.black, - fontWeight: FontWeight.w600, - disabled: model.state == ViewState.BusyLocal, - onPressed: () async { - widget.changePageViewIndex(2); - }, - ), - ), - SizedBox( - width: 5, - ), - Expanded( - child: AppButton( - height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 8 : 6), - padding: 10, - title: isAddProgress - ? TranslationBase.of(context).next - : TranslationBase.of(context).finish, - fontWeight: FontWeight.w600, - color: Colors.red[700], - disabled: progressNoteController.text.isEmpty, - onPressed: () async { - if (progressNoteController.text.isNotEmpty) { - if (isAddProgress) { - submitPlan(model); - } else { - Navigator.of(context).pop(); - } - } else { - Helpers.showErrorToast( - TranslationBase.of(context) - .progressNoteErrorMsg); - } - }, - ), - ), - ], - ), - ), - ), - ), - SizedBox( - height: 5, - ), - ], - ), - )), + ),) ); } @@ -452,6 +381,7 @@ class _UpdatePlanPageState extends State { setState(() { isAddProgress = false; + model.isAddProgress = false; }); } } @@ -460,4 +390,20 @@ class _UpdatePlanPageState extends State { Helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); } } + + @override + nextFunction(model) { + print("dfdfdf"); + if (progressNoteController.text.isNotEmpty) { + if (isAddProgress) { + submitPlan(model); + } else { + Navigator.of(context).pop(); + } + } else { + Helpers.showErrorToast( + TranslationBase.of(context) + .progressNoteErrorMsg); + } + } } diff --git a/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart b/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart index d5addf88..67c1df55 100644 --- a/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart +++ b/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart @@ -49,7 +49,7 @@ class _AddMedicationState extends State { GetMedicationResponseModel _selectedMedication; GlobalKey key = - new GlobalKey>(); + new GlobalKey>(); bool isFormSubmitted = false; @override @@ -57,387 +57,440 @@ class _AddMedicationState extends State { ProjectViewModel projectViewModel = Provider.of(context); return FractionallySizedBox( child: BaseView( - onModelReady: (model) async { - if (model.medicationStrengthList.length == 0) { - await model.getMasterLookup( - MasterKeysService.MedicationStrength, - ); - } - if (model.medicationFrequencyList.length == 0) { - await model.getMasterLookup(MasterKeysService.MedicationFrequency); - } - if (model.medicationDoseTimeList.length == 0) { - await model.getMasterLookup(MasterKeysService.MedicationDoseTime); - } - if (model.medicationRouteList.length == 0) { - await model.getMasterLookup(MasterKeysService.MedicationRoute); - } - if (model.allMedicationList.length == 0) - await model.getMedicationList(); - }, - builder: (_, model, w) => AppScaffold( - baseViewModel: model, - isShowAppBar: true, - appBar: BottomSheetTitle( - title: TranslationBase.of(context).addMedication, - ), - body: Center( - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( + onModelReady: (model) async { + if (model.medicationStrengthList.length == 0) { + await model.getMasterLookup( + MasterKeysService.MedicationStrength, + ); + } + if (model.medicationFrequencyList.length == 0) { + await model.getMasterLookup( + MasterKeysService.MedicationFrequency); + } + if (model.medicationDoseTimeList.length == 0) { + await model.getMasterLookup(MasterKeysService.MedicationDoseTime); + } + if (model.medicationRouteList.length == 0) { + await model.getMasterLookup(MasterKeysService.MedicationRoute); + } + if (model.allMedicationList.length == 0) + await model.getMedicationList(); + }, + builder: (_, model, w) => + AppScaffold( + baseViewModel: model, + isShowAppBar: true, + appBar: BottomSheetTitle( + title: TranslationBase + .of(context) + .addMedication, + ), + body: Center( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( height: 10, ), Expanded( child: FractionallySizedBox( - widthFactor: 0.9, - child: SingleChildScrollView( - child: Column( + widthFactor: 0.9, + child: SingleChildScrollView( + child: Column( children: [ - SizedBox( - height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ?2:SizeConfig.isHeightShort?2:2), - ), - Container( - // height: screenSize.height * 0.070, - child: InkWell( - onTap: model.allMedicationList != null - ? () { - setState(() { - _selectedMedication = null; - }); - } - : null, - child: _selectedMedication == null - ? CustomAutoCompleteTextField( - isShowError: isFormSubmitted && - _selectedMedication == null, - child: AutoCompleteTextField< - GetMedicationResponseModel>( - decoration: TextFieldsUtils - .textFieldSelectorDecoration( - TranslationBase.of( - context) - .searchMedicineNameHere, - null, - true, - suffixIcon: - Icons.search), - itemSubmitted: (item) => - setState(() => - _selectedMedication = - item), - key: key, - suggestions: - model.allMedicationList, - itemBuilder: (context, - suggestion) => - new Padding( - child: AppText(suggestion - .description + - '/' + - suggestion - .genericName), - padding: - EdgeInsets.all( - 8.0)), - itemSorter: (a, b) => 1, - itemFilter: (suggestion, - input) => - suggestion.genericName.toLowerCase().startsWith(input.toLowerCase()) || - suggestion.description - .toLowerCase() - .startsWith(input - .toLowerCase()) || - suggestion.keywords - .toLowerCase() - .startsWith(input - .toLowerCase()), - ), - ) - : AppTextFieldCustom( - height: Helpers.getTextFieldHeight(), - hintText: _selectedMedication != - null - ? _selectedMedication - .description + - (' (${_selectedMedication.genericName} )') - : TranslationBase.of( - context) - .searchMedicineNameHere, - minLines: 1, - maxLines: 1, - isTextFieldHasSuffix: true, - suffixIcon: IconButton( - icon: Icon( - Icons.search, - color: Colors.grey.shade600, - )), - enabled: false, - ), - ), - ), - SizedBox( - height: 5, - ), - AppTextFieldCustom( - height: Helpers.getTextFieldHeight(), - enabled: false, - onClick: model.medicationDoseTimeList != - null - ? () { - MasterKeyDailog dialog = - MasterKeyDailog( - list: model - .medicationDoseTimeList, - okText: - TranslationBase.of(context) - .ok, - selectedValue: - _selectedMedicationDose, - okFunction: (selectedValue) { - setState(() { - _selectedMedicationDose = - selectedValue; + SizedBox( + height: SizeConfig.heightMultiplier * ( + SizeConfig.isHeightVeryShort ?2:SizeConfig.isHeightShort? + 2:2), + ), + Container( + // height: screenSize.height * 0.070, + child: InkWell( + onTap: model.allMedicationList != null + ? () { + setState(() { + _selectedMedication = null; + }); + } + : null, + child: _selectedMedication == null + ? CustomAutoCompleteTextField( + isShowError: isFormSubmitted && + _selectedMedication == null, + child: AutoCompleteTextField< + GetMedicationResponseModel>( + decoration: TextFieldsUtils + .textFieldSelectorDecoration( + TranslationBase + .of( + context) + .searchMedicineNameHere, + null, + true, + suffixIcon: + Icons.search), + itemSubmitted: (item) => + setState(() => + _selectedMedication = + item), + key: key, + suggestions: + model.allMedicationList, + itemBuilder: (context, + suggestion) => + new Padding( + child: AppText(suggestion + .description + + '/' + + suggestion + .genericName), + padding: + EdgeInsets.all( + 8.0)), + itemSorter: (a, b) => 1, + itemFilter: (suggestion, + input) => + suggestion.genericName.toLowerCase() + .startsWith(input.toLowerCase()) || + suggestion.description + .toLowerCase() + .startsWith(input + .toLowerCase()) || + suggestion.keywords + .toLowerCase() + .startsWith(input + .toLowerCase()), + ), + ) + : AppTextFieldCustom( + height: Helpers.getTextFieldHeight(), + hintText: _selectedMedication != + null + ? _selectedMedication + .description + + (' (${_selectedMedication.genericName} )') + : TranslationBase + .of( + context) + .searchMedicineNameHere, + minLines: 1, + maxLines: 1, + isTextFieldHasSuffix: true, + suffixIcon: IconButton( + icon: Icon( + Icons.search, + color: Colors.grey.shade600, + )), + enabled: false, + ), + ), + ), - doseController - .text = projectViewModel - .isArabic - ? _selectedMedicationDose - .nameAr - : _selectedMedicationDose - .nameEn; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: - (BuildContext context) { - return dialog; - }, - ); - } - : null, - hintText: - TranslationBase.of(context).doseTime, - maxLines: 1, - minLines: 1, - isTextFieldHasSuffix: true, - controller: doseController, - validationError: isFormSubmitted && - _selectedMedicationDose == null - ? TranslationBase.of(context) - .emptyMessage - : null, - ), - SizedBox( - height: 5, - ), - AppTextFieldCustom( - height: Helpers.getTextFieldHeight(), - enabled: false, - isTextFieldHasSuffix: true, - onClick: model.medicationStrengthList != - null - ? () { - MasterKeyDailog dialog = - MasterKeyDailog( - list: model - .medicationStrengthList, - okText: - TranslationBase.of(context) - .ok, - selectedValue: - _selectedMedicationStrength, - okFunction: (selectedValue) { - setState(() { - _selectedMedicationStrength = - selectedValue; + if(_selectedMedication != null) + Column( + children: [ + SizedBox( + height: 3, + ), + Container( + width: MediaQuery + .of(context) + .size + .width * 0.7, + child: AppText( + _selectedMedication.description + + (' (${_selectedMedication.genericName} )'), + color: Color(0xFF575757), + fontSize: 10, + fontWeight: FontWeight.w700, + letterSpacing: -0.4, + ), + ), + ], + ), + SizedBox( + height: 5, + ), + AppTextFieldCustom( + height: Helpers.getTextFieldHeight(), + enabled: false, + onClick: model.medicationDoseTimeList != + null + ? () { + MasterKeyDailog dialog = + MasterKeyDailog( + list: model + .medicationDoseTimeList, + okText: + TranslationBase + .of(context) + .ok, + selectedValue: + _selectedMedicationDose, + okFunction: (selectedValue) { + setState(() { + _selectedMedicationDose = + selectedValue; - strengthController - .text = projectViewModel - .isArabic - ? _selectedMedicationStrength - .nameAr - : _selectedMedicationStrength - .nameEn; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: - (BuildContext context) { - return dialog; - }, - ); - } - : null, - hintText: - TranslationBase.of(context).strength, - maxLines: 1, - minLines: 1, - controller: strengthController, - validationError: isFormSubmitted && - _selectedMedicationStrength == - null - ? TranslationBase.of(context) - .emptyMessage - : null, - ), - SizedBox( - height: 5, - ), - SizedBox( - height: 5, - ), - AppTextFieldCustom( - height: Helpers.getTextFieldHeight(), - enabled: false, - isTextFieldHasSuffix: true, - onClick: model.medicationRouteList != null - ? () { - MasterKeyDailog dialog = - MasterKeyDailog( - list: model.medicationRouteList, - selectedValue: - _selectedMedicationRoute, - okText: - TranslationBase.of(context) - .ok, - okFunction: (selectedValue) { - setState(() { - _selectedMedicationRoute = - selectedValue; + doseController + .text = projectViewModel + .isArabic + ? _selectedMedicationDose + .nameAr + : _selectedMedicationDose + .nameEn; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + hintText: + TranslationBase + .of(context) + .doseTime, + maxLines: 1, + minLines: 1, + isTextFieldHasSuffix: true, + controller: doseController, + validationError: isFormSubmitted && + _selectedMedicationDose == null + ? TranslationBase + .of(context) + .emptyMessage + : null, + ), + SizedBox( + height: 5, + ), + AppTextFieldCustom( + height: Helpers.getTextFieldHeight(), + enabled: false, + isTextFieldHasSuffix: true, + onClick: model.medicationStrengthList != + null + ? () { + MasterKeyDailog dialog = + MasterKeyDailog( + list: model + .medicationStrengthList, + okText: + TranslationBase + .of(context) + .ok, + selectedValue: + _selectedMedicationStrength, + okFunction: (selectedValue) { + setState(() { + _selectedMedicationStrength = + selectedValue; - routeController - .text = projectViewModel - .isArabic - ? _selectedMedicationRoute - .nameAr - : _selectedMedicationRoute - .nameEn; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: - (BuildContext context) { - return dialog; - }, - ); - } - : null, - hintText: - TranslationBase.of(context).route, - maxLines: 1, - minLines: 1, - controller: routeController, - validationError: isFormSubmitted && - _selectedMedicationRoute == null - ? TranslationBase.of(context) - .emptyMessage - : null, - ), - SizedBox( - height: 5, - ), - SizedBox( - height: 5, - ), - AppTextFieldCustom( - height: Helpers.getTextFieldHeight(), - onClick: model.medicationFrequencyList != - null - ? () { - MasterKeyDailog dialog = - MasterKeyDailog( - list: model - .medicationFrequencyList, - okText: - TranslationBase.of(context) - .ok, - selectedValue: - _selectedMedicationFrequency, - okFunction: (selectedValue) { - setState(() { - _selectedMedicationFrequency = - selectedValue; + strengthController + .text = projectViewModel + .isArabic + ? _selectedMedicationStrength + .nameAr + : _selectedMedicationStrength + .nameEn; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + hintText: + TranslationBase + .of(context) + .strength, + maxLines: 1, + minLines: 1, + controller: strengthController, + validationError: isFormSubmitted && + _selectedMedicationStrength == + null + ? TranslationBase + .of(context) + .emptyMessage + : null, + ), + SizedBox( + height: 5, + ), + SizedBox( + height: 5, + ), + AppTextFieldCustom( + height: Helpers.getTextFieldHeight(), + enabled: false, + isTextFieldHasSuffix: true, + onClick: model.medicationRouteList != null + ? () { + MasterKeyDailog dialog = + MasterKeyDailog( + list: model.medicationRouteList, + selectedValue: + _selectedMedicationRoute, + okText: + TranslationBase + .of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + _selectedMedicationRoute = + selectedValue; - frequencyController - .text = projectViewModel - .isArabic - ? _selectedMedicationFrequency - .nameAr - : _selectedMedicationFrequency - .nameEn; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: - (BuildContext context) { - return dialog; - }, - ); - } - : null, - hintText: - TranslationBase.of(context).frequency, - enabled: false, - maxLines: 1, - minLines: 1, - isTextFieldHasSuffix: true, - controller: frequencyController, - validationError: isFormSubmitted && - _selectedMedicationFrequency == - null - ? TranslationBase.of(context) - .emptyMessage - : null, - ), - SizedBox( - height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ?20:SizeConfig.isHeightShort?15:10), - ), + routeController + .text = projectViewModel + .isArabic + ? _selectedMedicationRoute + .nameAr + : _selectedMedicationRoute + .nameEn; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + hintText: + TranslationBase + .of(context) + .route, + maxLines: 1, + minLines: 1, + controller: routeController, + validationError: isFormSubmitted && + _selectedMedicationRoute == null + ? TranslationBase + .of(context) + .emptyMessage + : null, + ), + SizedBox( + height: 5, + ), + SizedBox( + height: 5, + ), + AppTextFieldCustom( + height: Helpers.getTextFieldHeight(), + onClick: model.medicationFrequencyList != + null + ? () { + MasterKeyDailog dialog = + MasterKeyDailog( + list: model + .medicationFrequencyList, + okText: + TranslationBase + .of(context) + .ok, + selectedValue: + _selectedMedicationFrequency, + okFunction: (selectedValue) { + setState(() { + _selectedMedicationFrequency = + selectedValue; - ], - ), - )), + frequencyController + .text = projectViewModel + .isArabic + ? _selectedMedicationFrequency + .nameAr + : _selectedMedicationFrequency + .nameEn; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + hintText: + TranslationBase + .of(context) + .frequency, + enabled: false, + maxLines: 1, + minLines: 1, + isTextFieldHasSuffix: true, + controller: frequencyController, + validationError: isFormSubmitted && + _selectedMedicationFrequency == + null + ? TranslationBase + .of(context) + .emptyMessage + : null, + ), + SizedBox( + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 20 : SizeConfig + .isHeightShort ? 15 : 10), + ), + + ], ), - ]), + )), ), - ), - bottomSheet: model.state != ViewState.Idle - ? Container( - height: 0, - ) - : BottomSheetDialogButton( - label: - TranslationBase.of(context).addMedication, - onTap: () { - setState(() { - isFormSubmitted = true; - }); - if (_selectedMedication != null && - _selectedMedicationDose != null && - _selectedMedicationStrength != null && - _selectedMedicationRoute != null && - _selectedMedicationFrequency != null) { - widget.medicationController.text = widget - .medicationController.text + - '${_selectedMedication.description} (${TranslationBase.of(context).doseTime} ) ${doseController.text} (${TranslationBase.of(context).strength}) ${strengthController.text} (${TranslationBase.of(context).route}) ${routeController.text} (${TranslationBase.of(context).frequency}) ${frequencyController.text} \n \n'; - Navigator.of(context).pop(); - } - }, - )), - ), + ]), + ), + ), + bottomSheet: model.state != ViewState.Idle + ? Container( + height: 0, + ) + : BottomSheetDialogButton( + label: + TranslationBase.of(context).addMedication, + onTap: () { + setState(() { + isFormSubmitted = true; + }); + if (_selectedMedication != null && + _selectedMedicationDose != null && + _selectedMedicationStrength != null && + _selectedMedicationRoute != null && + _selectedMedicationFrequency != null) { + widget.medicationController.text = widget + .medicationController.text + + '${_selectedMedication.description} (${TranslationBase.of(context).doseTime} ) ${doseController.text} (${TranslationBase.of(context).strength}) ${strengthController.text} (${TranslationBase.of(context).route}) ${routeController.text} (${TranslationBase.of(context).frequency}) ${frequencyController.text} \n \n'; + Navigator.of(context).pop(); + } + }, + ) + ) + , + ) + , ); } } diff --git a/lib/screens/patients/profile/soap_update/subjective/subjectiveCallBack.dart b/lib/screens/patients/profile/soap_update/subjective/subjectiveCallBack.dart new file mode 100644 index 00000000..e8d0e11f --- /dev/null +++ b/lib/screens/patients/profile/soap_update/subjective/subjectiveCallBack.dart @@ -0,0 +1,3 @@ +abstract class SubjectiveCallBack{ + Function nextFunction(model); +} \ No newline at end of file diff --git a/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart b/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart index 73adb0a3..db3ab7c8 100644 --- a/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart +++ b/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart @@ -16,6 +16,7 @@ import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.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/soap_update/soap_utils.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/subjectiveCallBack.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -46,7 +47,8 @@ class UpdateSubjectivePage extends StatefulWidget { _UpdateSubjectivePageState createState() => _UpdateSubjectivePageState(); } -class _UpdateSubjectivePageState extends State { +class _UpdateSubjectivePageState extends State + implements SubjectiveCallBack { bool isChiefExpand = false; bool isHistoryExpand = false; bool isAllergiesExpand = false; @@ -208,7 +210,7 @@ class _UpdateSubjectivePageState extends State { onModelReady: (model) async { myAllergiesList.clear(); myHistoryList.clear(); - + model.setSubjectiveCallBack(this); GetChiefComplaintReqModel getChiefComplaintReqModel = GetChiefComplaintReqModel( patientMRN: widget.patientInfo.patientMRN, @@ -270,7 +272,7 @@ class _UpdateSubjectivePageState extends State { ), SizedBox( height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 4 : 2), + (SizeConfig.isHeightVeryShort ? 4 : 2), ), ExpandableSOAPWidget( headerTitle: TranslationBase.of(context).histories, @@ -312,57 +314,14 @@ class _UpdateSubjectivePageState extends State { isExpanded: isAllergiesExpand, ), SizedBox( - height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 20 : 10), + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 20 : 10), ), ], ), ), ), ), - bottomSheet: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(0.0), - ), - border: Border.all(color: HexColor('#707070'), width: 0), - ), - height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 12 : 10), - width: double.infinity, - child: Column( - children: [ - SizedBox( - height: 10, - ), - Container( - child: FractionallySizedBox( - widthFactor: .80, - child: Center( - child: AppButton( - title: TranslationBase.of(context).next, - fontWeight: FontWeight.w600, - height: SizeConfig.heightMultiplier * - (SizeConfig.isHeightVeryShort ? 8 : 6), - padding: 10, - color: Colors.red[700], - onPressed: () async { - addSubjectiveInfo( - model: model, - myAllergiesList: myAllergiesList, - myHistoryList: myHistoryList); - }, - ), - ), - ), - ), - SizedBox( - height: 5, - ), - ], - ), - ), ), ); } @@ -371,7 +330,6 @@ class _UpdateSubjectivePageState extends State { {SOAPViewModel model, List myAllergiesList, List myHistoryList}) async { - if (FocusScope.of(context).hasFocus) FocusScope.of(context).unfocus(); widget.changeLoadingState(true); formKey.currentState.save(); @@ -380,50 +338,54 @@ class _UpdateSubjectivePageState extends State { complaintsControllerError = ''; medicationControllerError = ''; illnessControllerError = ''; - if (complaintsController.text.isNotEmpty && - illnessController.text.isNotEmpty && - complaintsController.text.length > 25) { - await postChiefComplaint(model: model); - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - } - if (myHistoryList.length != 0) { - await postHistories(model: model, myHistoryList: myHistoryList); - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - } - } - if (myAllergiesList.length != 0) { - await postAllergy(myAllergiesList: myAllergiesList, model: model); - if (model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast(model.error); - } - } - widget.changeLoadingState(true); - - widget.changePageViewIndex(1); - } else { - setState(() { - if (complaintsController.text.isEmpty) { - complaintsControllerError = TranslationBase.of(context).emptyMessage; - } else if (complaintsController.text.length < 25) { - complaintsControllerError = - TranslationBase.of(context).chiefComplaintLength; - } - - if (illnessController.text.isEmpty) { - illnessControllerError = TranslationBase.of(context).emptyMessage; - } - if (medicationController.text.isEmpty) { - medicationControllerError = TranslationBase.of(context).emptyMessage; - } - }); - - widget.changeLoadingState(false); - Helpers.showErrorToast( - TranslationBase.of(context).chiefComplaintErrorMsg); - } + ///TODO Elham* + /// + widget.changePageViewIndex(1); + // if (complaintsController.text.isNotEmpty && + // illnessController.text.isNotEmpty && + // complaintsController.text.length > 25) { + // await postChiefComplaint(model: model); + // if (model.state == ViewState.ErrorLocal) { + // Helpers.showErrorToast(model.error); + // } + // if (myHistoryList.length != 0) { + // await postHistories(model: model, myHistoryList: myHistoryList); + // if (model.state == ViewState.ErrorLocal) { + // Helpers.showErrorToast(model.error); + // } + // } + // if (myAllergiesList.length != 0) { + // await postAllergy(myAllergiesList: myAllergiesList, model: model); + // if (model.state == ViewState.ErrorLocal) { + // Helpers.showErrorToast(model.error); + // } + // } + // widget.changeLoadingState(true); + // + // widget.changePageViewIndex(1); + // } else { + // setState(() { + // if (complaintsController.text.isEmpty) { + // complaintsControllerError = TranslationBase.of(context).emptyMessage; + // } else if (complaintsController.text.length < 25) { + // complaintsControllerError = + // TranslationBase.of(context).chiefComplaintLength; + // } + // + // if (illnessController.text.isEmpty) { + // illnessControllerError = TranslationBase.of(context).emptyMessage; + // } + // + // if (medicationController.text.isEmpty) { + // medicationControllerError = TranslationBase.of(context).emptyMessage; + // } + // }); + // + // widget.changeLoadingState(false); + // Helpers.showErrorToast( + // TranslationBase.of(context).chiefComplaintErrorMsg); + // } } postAllergy( @@ -528,4 +490,12 @@ class _UpdateSubjectivePageState extends State { } } } + + @override + Function nextFunction(model) { + addSubjectiveInfo( + model: model, + myAllergiesList: myAllergiesList, + myHistoryList: myHistoryList); + } } 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 792a3f20..7265e90e 100644 --- a/lib/screens/patients/profile/soap_update/update_soap_index.dart +++ b/lib/screens/patients/profile/soap_update/update_soap_index.dart @@ -1,3 +1,6 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart'; @@ -6,10 +9,13 @@ import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_histor 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/soap_update/subjective/update_subjective_page.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/buttons/app_buttons_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; import 'assessment/update_assessment_page.dart'; import 'objective/update_objective_page.dart'; @@ -31,10 +37,8 @@ class _UpdateSoapIndexState extends State List myAllergiesList = List(); List myHistoryList = List(); - - changePageViewIndex(pageIndex,{isChangeState = true}) { - if (pageIndex != _currentIndex && isChangeState) - changeLoadingState(true); + changePageViewIndex(pageIndex, {isChangeState = true}) { + if (pageIndex != _currentIndex && isChangeState) changeLoadingState(true); _controller.jumpToPage(pageIndex); setState(() { _currentIndex = pageIndex; @@ -60,65 +64,244 @@ class _UpdateSoapIndexState extends State Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; - return AppScaffold( - isLoading: _isLoading, - isShowAppBar: true, - appBar: PatientProfileAppBar(patient), - body: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - decoration: BoxDecoration( - boxShadow: [], - color: Theme.of(context).scaffoldBackgroundColor), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - - Container( - color: Theme.of(context).scaffoldBackgroundColor, - height: MediaQuery.of(context).size.height * 0.73, - child: PageView( - physics: NeverScrollableScrollPhysics(), - controller: _controller, - onPageChanged: (index) { - setState(() { - _currentIndex = index; - }); - }, - scrollDirection: Axis.horizontal, - children: [ - UpdateSubjectivePage( - changePageViewIndex: changePageViewIndex, - currentIndex: _currentIndex, - patientInfo: patient, - changeLoadingState: changeLoadingState), - UpdateObjectivePage( - changePageViewIndex: changePageViewIndex, - currentIndex: _currentIndex, - patientInfo: patient, - changeLoadingState: changeLoadingState), - UpdateAssessmentPage( - changePageViewIndex: changePageViewIndex, - currentIndex: _currentIndex, - patientInfo: patient, - changeLoadingState: changeLoadingState), - UpdatePlanPage( - changePageViewIndex: changePageViewIndex, - currentIndex: _currentIndex, - patientInfo: patient, - changeLoadingState: changeLoadingState) - ], - ), - ) - ], + return BaseView( + builder: (_,model,w)=>AppScaffold( + isLoading: _isLoading, + isShowAppBar: true, + appBar: PatientProfileAppBar(patient), + body: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + decoration: BoxDecoration( + boxShadow: [], + color: Theme.of(context).scaffoldBackgroundColor), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + color: Theme.of(context).scaffoldBackgroundColor, + height: MediaQuery.of(context).size.height * 0.73, + child: PageView( + physics: NeverScrollableScrollPhysics(), + controller: _controller, + onPageChanged: (index) { + setState(() { + _currentIndex = index; + }); + }, + scrollDirection: Axis.horizontal, + children: [ + UpdateSubjectivePage( + changePageViewIndex: changePageViewIndex, + currentIndex: _currentIndex, + patientInfo: patient, + changeLoadingState: changeLoadingState), + UpdateObjectivePage( + changePageViewIndex: changePageViewIndex, + currentIndex: _currentIndex, + patientInfo: patient, + changeLoadingState: changeLoadingState), + UpdateAssessmentPage( + changePageViewIndex: changePageViewIndex, + currentIndex: _currentIndex, + patientInfo: patient, + changeLoadingState: changeLoadingState), + UpdatePlanPage( + changePageViewIndex: changePageViewIndex, + currentIndex: _currentIndex, + patientInfo: patient, + changeLoadingState: changeLoadingState) + ], + ), + ) + ], + ), ), + ], + ), + ), + bottomSheet: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(0.0), ), - ], + border: Border.all(color: HexColor('#707070'), width: 0), + ), + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 12 : 10), + width: double.infinity, + child: Column( + children: [ + SizedBox( + height: 10, + ), + Container( + child: FractionallySizedBox( + widthFactor: .80, + child: getBottomSheet(model) + ), + ), + SizedBox( + height: 5, + ), + ], + ), ), + ), ); } + + Widget getBottomSheet(SOAPViewModel model) { + switch (_currentIndex) { + case 0: + { + return Center( + child: AppButton( + title: TranslationBase.of(context).next, + fontWeight: FontWeight.w600, + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 8 : 6), + padding: 10, + color: Colors.red[700], + onPressed: () async { + model.nextOnSubjectPage(model); + }, + ), + ); + } + break; + case 1: + { + return Center( + child: Row( + children: [ + Expanded( + child: AppButton( + title: TranslationBase.of(context).previous, + color: Colors.grey[300], + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 8 : 6), + padding: 10, + fontColor: Colors.black, + fontWeight: FontWeight.w600, + onPressed: () { + changePageViewIndex(0); + }, + ), + ), + SizedBox( + width: 5, + ), + Expanded( + child: AppButton( + title: TranslationBase.of(context).next, + fontWeight: FontWeight.w600, + color: Colors.red[700], + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 8 : 6), + padding: 10, + disabled: model.state == ViewState.BusyLocal, + onPressed: () async { + await model.nextOnObjectivePage(model); + }, + ), + ), + ], + ), + ); + } + break; + case 2: + { + return Center( + child: Row( + children: [ + Expanded( + child: AppButton( + title: TranslationBase.of(context).previous, + color: Colors.grey[300], + fontColor: Colors.black, + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 8 : 6), + padding: 10, + fontWeight: FontWeight.w600, + disabled: model.state == ViewState.BusyLocal, + onPressed: () async { + changePageViewIndex(1); + }, + ), + ), + SizedBox( + width: 5, + ), + Expanded( + child: AppButton( + title: TranslationBase.of(context).next, + fontWeight: FontWeight.w600, + color: Colors.red[700], + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 8 : 6), + padding: 10, + disabled: model.state == ViewState.BusyLocal, + onPressed: () async { + model.nextOnAssessmentPage(model); + }, + ), + ), + ], + ), + ); + } + break; + case 3: + { + return Center( + child: Row( + children: [ + Expanded( + child: AppButton( + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 8 : 6), + padding: 10, + title: TranslationBase.of(context).previous, + color: Colors.grey[300], + fontColor: Colors.black, + fontWeight: FontWeight.w600, + disabled: model.state == ViewState.BusyLocal, + onPressed: () async { + changePageViewIndex(2); + }, + ), + ), + SizedBox( + width: 5, + ), + Expanded( + child: AppButton( + height: SizeConfig.heightMultiplier * + (SizeConfig.isHeightVeryShort ? 8 : 6), + padding: 10, + title: model.isAddProgress + ? TranslationBase.of(context).next + : TranslationBase.of(context).finish, + fontWeight: FontWeight.w600, + color: Colors.red[700], + disabled: model.progressNoteText.isEmpty, + onPressed: () async { + model.nextOnPlanPage(model); + }, + ), + ), + ], + ), + ); + } + break; + } + } } diff --git a/lib/widgets/patients/profile/patient-profile-app-bar.dart b/lib/widgets/patients/profile/patient-profile-app-bar.dart index 1486edc5..9916ae3e 100644 --- a/lib/widgets/patients/profile/patient-profile-app-bar.dart +++ b/lib/widgets/patients/profile/patient-profile-app-bar.dart @@ -552,6 +552,6 @@ class PatientProfileAppBar extends StatelessWidget @override Size get preferredSize => Size(double.maxFinite, height == 0 - ? isInpatient ? (isFromLabResult?200:170) : isAppointmentHeader ? 290 : SizeConfig.isHeightVeryShort?137:SizeConfig.isHeightShort?180: SizeConfig.heightMultiplier * (SizeConfig.isWidthLarge?25:20) + ? isInpatient ? (isFromLabResult?200:190) : isAppointmentHeader ? 290 : SizeConfig.isHeightVeryShort?137:SizeConfig.isHeightShort?190: SizeConfig.heightMultiplier * (SizeConfig.isWidthLarge?25:20) : height); }