From 4da72c81af433c7f130d284e501829086a865fc2 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 18 Apr 2021 13:28:50 +0300 Subject: [PATCH] first step form code refactor --- .../profile/soap_update/SOAP_open_items.dart | 1 - .../profile/soap_update/SOAP_step_header.dart | 1 - .../assessment/add_assessment_details.dart | 53 ------------------- .../assessment/update_assessment_page.dart | 3 +- .../soap_update/expandable_SOAP_widget.dart | 1 - ...ination-page.dart => add-examination.dart} | 2 - .../objective/examination-item-card.dart | 4 +- .../objective/update_objective_page.dart | 8 +-- .../subjective/allergies/add_allergies.dart | 2 - .../allergies/update_allergies_widget.dart | 12 +---- .../subjective/bottom_sheet_title.dart | 1 - .../history/add_history_dialog.dart | 2 +- .../{PriorityBar.dart => priority_bar.dart} | 0 .../history/update_history_widget.dart | 12 ----- .../subjective/medication/add_medication.dart | 1 + .../medication/update_medication_widget.dart | 23 -------- .../subjective/update_subjective_page.dart | 1 - .../soap_update/update_soap_index.dart | 3 -- 18 files changed, 10 insertions(+), 120 deletions(-) rename lib/screens/patients/profile/soap_update/objective/{objective-add-examination-page.dart => add-examination.dart} (99%) rename lib/screens/patients/profile/soap_update/subjective/history/{PriorityBar.dart => priority_bar.dart} (100%) diff --git a/lib/screens/patients/profile/soap_update/SOAP_open_items.dart b/lib/screens/patients/profile/soap_update/SOAP_open_items.dart index e3b0c483..31a501ce 100644 --- a/lib/screens/patients/profile/soap_update/SOAP_open_items.dart +++ b/lib/screens/patients/profile/soap_update/SOAP_open_items.dart @@ -1,4 +1,3 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; diff --git a/lib/screens/patients/profile/soap_update/SOAP_step_header.dart b/lib/screens/patients/profile/soap_update/SOAP_step_header.dart index 0efcc4fa..14385a9e 100644 --- a/lib/screens/patients/profile/soap_update/SOAP_step_header.dart +++ b/lib/screens/patients/profile/soap_update/SOAP_step_header.dart @@ -1,4 +1,3 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/steps_widget.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; 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 008172a6..a23fc9be 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 @@ -74,7 +74,6 @@ class _AddAssessmentDetailsState extends State { if (widget.mySelectedAssessment.selectedICD != null) icdNameController.text = widget.mySelectedAssessment.selectedICD.code; } - final screenSize = MediaQuery.of(context).size; InputDecoration textFieldSelectorDecoration( String hintText, String selectedText, bool isDropDown, {IconData icon}) { @@ -143,24 +142,9 @@ class _AddAssessmentDetailsState extends State { height: 55.0, hintText: TranslationBase.of(context).appointmentNumber, - //fontSize: 13.5, - // hintColor: Colors.black, - //hasLabelText: appointmentIdController.text != '' - // ? true - // : false, - //showLabelText: true, - //fontWeight: FontWeight.w600, - //readOnly: true, isDropDown: false, enabled: false, controller: appointmentIdController, - // validator: (value) { - // if (value == null) - // return TranslationBase.of(context) - // .emptyMessage; - // else - // return null; - // }, ), ), SizedBox( @@ -284,25 +268,10 @@ class _AddAssessmentDetailsState extends State { ); } : null, - //hasLabelText: - // conditionController.text != '' ? true : false, - //showLabelText: true, hintText: TranslationBase.of(context).condition, - //fontSize: 13.5, - //readOnly: true, - //suffixIcon: EvaIcons.arrowDown, - // hintColor: Colors.black, - //fontWeight: FontWeight.w600, maxLines: 2, minLines: 1, controller: conditionController, - // validator: (value) { - // if (value == null) - // return TranslationBase.of(context).emptyMessage; - // else - // return null; - // }, - isDropDown: true, enabled: false, ), @@ -324,8 +293,6 @@ class _AddAssessmentDetailsState extends State { okFunction: (MasterKeyModel selectedValue) { setState(() { - // _selectedDiagnosisType = - // selectedValue; widget.mySelectedAssessment .selectedDiagnosisType = selectedValue; @@ -345,28 +312,12 @@ class _AddAssessmentDetailsState extends State { ); } : null, - //hasLabelText: - // typeController.text != '' ? true : false, - //prefixIcon: Icon(Icons.add), - //showLabelText: true, hintText: TranslationBase.of(context).dType, - //fontSize: 13.5, - //readOnly: true, - // hintColor: Colors.black, - //suffixIcon: EvaIcons.arrowDown, - //fontWeight: FontWeight.w600, maxLines: 2, minLines: 1, enabled: false, isDropDown: true, - controller: typeController, - // validator: (value) { - // if (value == null) - // return TranslationBase.of(context).emptyMessage; - // else - // return null; - // }, ), if (isFormSubmitted && widget.mySelectedAssessment @@ -381,7 +332,6 @@ class _AddAssessmentDetailsState extends State { child: TextFields( hintText: TranslationBase.of(context).remarks, fontSize: 13.5, - // hintColor: Colors.black, fontWeight: FontWeight.w600, maxLines: 18, minLines: 5, @@ -518,12 +468,9 @@ class _AddAssessmentDetailsState extends State { mySelectedAssessment.doctorName = doctorProfile.doctorName; if (!isUpdate) { - // widget.mySelectedAssessmentList.add(mySelectedAssessment); widget.addSelectedAssessment(mySelectedAssessment, isUpdate); } Navigator.of(context).pop(); } - - // widget.changePageViewIndex(3); } } \ 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 bc0fad71..7508bf0a 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 @@ -20,8 +20,8 @@ import 'package:provider/provider.dart'; import '../SOAP_open_items.dart'; import '../SOAP_step_header.dart'; -import 'add_assessment_details.dart'; import '../expandable_SOAP_widget.dart'; +import 'add_assessment_details.dart'; class UpdateAssessmentPage extends StatefulWidget { final Function changePageViewIndex; @@ -107,7 +107,6 @@ class _UpdateAssessmentPageState extends State { backgroundColor: Theme .of(context) .scaffoldBackgroundColor, - // baseViewModel: model, body: SingleChildScrollView( physics: ScrollPhysics(), child: Container( diff --git a/lib/screens/patients/profile/soap_update/expandable_SOAP_widget.dart b/lib/screens/patients/profile/soap_update/expandable_SOAP_widget.dart index a55662ce..f83cceda 100644 --- a/lib/screens/patients/profile/soap_update/expandable_SOAP_widget.dart +++ b/lib/screens/patients/profile/soap_update/expandable_SOAP_widget.dart @@ -1,4 +1,3 @@ -import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; diff --git a/lib/screens/patients/profile/soap_update/objective/objective-add-examination-page.dart b/lib/screens/patients/profile/soap_update/objective/add-examination.dart similarity index 99% rename from lib/screens/patients/profile/soap_update/objective/objective-add-examination-page.dart rename to lib/screens/patients/profile/soap_update/objective/add-examination.dart index 225b6f61..3a9dcd24 100644 --- a/lib/screens/patients/profile/soap_update/objective/objective-add-examination-page.dart +++ b/lib/screens/patients/profile/soap_update/objective/add-examination.dart @@ -16,8 +16,6 @@ import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; -// Author Mosa Abuzaid - class AddExaminationPage extends StatefulWidget { final List mySelectedExamination; final Function addSelectedExamination; diff --git a/lib/screens/patients/profile/soap_update/objective/examination-item-card.dart b/lib/screens/patients/profile/soap_update/objective/examination-item-card.dart index 8d53bbd0..d40faea5 100644 --- a/lib/screens/patients/profile/soap_update/objective/examination-item-card.dart +++ b/lib/screens/patients/profile/soap_update/objective/examination-item-card.dart @@ -6,11 +6,11 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -class ExaminationIitemCard extends StatelessWidget { +class ExaminationItemCard extends StatelessWidget { final MySelectedExamination examination; final Function removeExamination; - ExaminationIitemCard(this.examination, this.removeExamination); + ExaminationItemCard(this.examination, this.removeExamination); @override Widget build(BuildContext context) { 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 457bfe5f..66882edb 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 @@ -1,5 +1,4 @@ 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/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; @@ -24,8 +23,8 @@ import 'package:provider/provider.dart'; import '../SOAP_open_items.dart'; import '../SOAP_step_header.dart'; import '../expandable_SOAP_widget.dart'; +import 'add-examination.dart'; import 'examination-item-card.dart'; -import 'objective-add-examination-page.dart'; class UpdateObjectivePage extends StatefulWidget { final Function changePageViewIndex; @@ -130,8 +129,9 @@ class _UpdateObjectivePageState extends State { Column( children: widget.mySelectedExamination.map((examination) { - return ExaminationIitemCard(examination, () { - removeExamination(examination.selectedExamination); + return ExaminationItemCard(examination, () { + removeExamination( + examination.selectedExamination); }); }).toList(), ) diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart index 59569e22..c2847e07 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart @@ -30,8 +30,6 @@ class AddAllergies extends StatefulWidget { class _AddAllergiesState extends State { List allergiesList; List allergySeverityList; - MasterKeyModel _selectedAllergySeverity; - MasterKeyModel _selectedAllergy; TextEditingController remarkController = TextEditingController(); TextEditingController severityController = TextEditingController(); TextEditingController allergyController = TextEditingController(); diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart index 442268e7..6b20cf47 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart @@ -1,20 +1,9 @@ -import 'package:autocomplete_textfield/autocomplete_textfield.dart'; -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; -import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; -import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; -import 'package:doctor_app_flutter/widgets/shared/TextFields.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/divider_with_spaces_around.dart'; -import 'package:doctor_app_flutter/widgets/shared/master_key_checkbox_search_allergies_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -23,6 +12,7 @@ import 'package:provider/provider.dart'; import '../../SOAP_open_items.dart'; import 'add_allergies.dart'; +// ignore: must_be_immutable class UpdateAllergiesWidget extends StatefulWidget { List myAllergiesList; diff --git a/lib/screens/patients/profile/soap_update/subjective/bottom_sheet_title.dart b/lib/screens/patients/profile/soap_update/subjective/bottom_sheet_title.dart index ba893520..8f5ecf93 100644 --- a/lib/screens/patients/profile/soap_update/subjective/bottom_sheet_title.dart +++ b/lib/screens/patients/profile/soap_update/subjective/bottom_sheet_title.dart @@ -1,6 +1,5 @@ import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class BottomSheetTitle extends StatelessWidget { const BottomSheetTitle({ diff --git a/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart b/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart index e39bd72a..d63e74c2 100644 --- a/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart +++ b/lib/screens/patients/profile/soap_update/subjective/history/add_history_dialog.dart @@ -12,7 +12,7 @@ import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import '../bottom_sheet_title.dart'; -import 'PriorityBar.dart'; +import 'priority_bar.dart'; class AddHistoryDialog extends StatefulWidget { final Function changePageViewIndex; diff --git a/lib/screens/patients/profile/soap_update/subjective/history/PriorityBar.dart b/lib/screens/patients/profile/soap_update/subjective/history/priority_bar.dart similarity index 100% rename from lib/screens/patients/profile/soap_update/subjective/history/PriorityBar.dart rename to lib/screens/patients/profile/soap_update/subjective/history/priority_bar.dart diff --git a/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart b/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart index f2adc388..12c02fa1 100644 --- a/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart +++ b/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart @@ -1,26 +1,14 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; -import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_history.dart'; -import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; -import 'package:doctor_app_flutter/widgets/shared/TextFields.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/master_key_checkbox_search_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; import '../../SOAP_open_items.dart'; -import 'PriorityBar.dart'; -import '../bottom_sheet_title.dart'; import 'add_history_dialog.dart'; class UpdateHistoryWidget extends StatefulWidget { 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 2c93040f..ba19ae57 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 @@ -20,6 +20,7 @@ import 'package:provider/provider.dart'; import '../../custom_validation_error.dart'; import '../bottom_sheet_title.dart'; +// ignore: must_be_immutable class AddMedication extends StatefulWidget { final Function addMedicationFun; TextEditingController medicationController; diff --git a/lib/screens/patients/profile/soap_update/subjective/medication/update_medication_widget.dart b/lib/screens/patients/profile/soap_update/subjective/medication/update_medication_widget.dart index 8bc01b35..66dc345b 100644 --- a/lib/screens/patients/profile/soap_update/subjective/medication/update_medication_widget.dart +++ b/lib/screens/patients/profile/soap_update/subjective/medication/update_medication_widget.dart @@ -1,29 +1,8 @@ -import 'package:autocomplete_textfield/autocomplete_textfield.dart'; -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; -import 'package:doctor_app_flutter/core/model/get_medication_response_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; -import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/Text.dart'; -import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; -import 'package:doctor_app_flutter/widgets/shared/app-textfield-custom.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.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/dialogs/master_key_dailog.dart'; -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:hexcolor/hexcolor.dart'; -import 'package:provider/provider.dart'; import '../../SOAP_open_items.dart'; -import '../../custom_validation_error.dart'; -import '../bottom_sheet_title.dart'; import 'add_medication.dart'; class UpdateMedicationWidget extends StatefulWidget { @@ -41,8 +20,6 @@ class UpdateMedicationWidget extends StatefulWidget { class _UpdateMedicationWidgetState extends State { @override Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - return Column( children: [ 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 819acfb2..70211931 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 @@ -1,6 +1,5 @@ import 'package:doctor_app_flutter/client/base_app_client.dart'; 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/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; 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 de62f754..acb855fe 100644 --- a/lib/screens/patients/profile/soap_update/update_soap_index.dart +++ b/lib/screens/patients/profile/soap_update/update_soap_index.dart @@ -1,4 +1,3 @@ -import 'package:doctor_app_flutter/config/size_config.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/my_selected_allergy.dart'; @@ -9,9 +8,7 @@ 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/widgets/patients/profile/patient-profile-header-new-design.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:flutter/cupertino.dart'; import 'package:flutter/material.dart';