From 3b1a493d7632b4855638bd9c886f689d28a29e9b Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Thu, 15 Jul 2021 12:53:16 +0300 Subject: [PATCH] fix design issues on create episode and prevent exam from keep it state --- .../assessment/add_assessment_details.dart | 6 +- .../assessment/update_assessment_page.dart | 69 +++++++++--------- .../objective/add_examination_page.dart | 64 +++++++---------- .../objective/examination_item_card.dart | 9 +-- .../objective/update_objective_page.dart | 71 ++++++++++++++----- .../shared_soap_widgets/remark_text.dart | 24 +++++++ .../shared_soap_widgets/steps_widget.dart | 2 +- .../subjective/allergies/add_allergies.dart | 26 ------- .../allergies/update_allergies_widget.dart | 13 +--- 9 files changed, 148 insertions(+), 136 deletions(-) create mode 100644 lib/screens/patients/profile/soap_update/shared_soap_widgets/remark_text.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 4549ae3d..691cc5b6 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 @@ -376,9 +376,9 @@ class _AddAssessmentDetailsState extends State { bottomSheet: model.state == ViewState.Busy?Container(height: 0,): BottomSheetDialogButton( - label: TranslationBase.of(context) - .addMedication - .toUpperCase(), + label: (widget.isUpdate + ? 'Update Assessment Details' + : 'Add Assessment Details'), onTap: () async { setState(() { isFormSubmitted = true; 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 95d3cda5..8caf61fe 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 @@ -8,6 +8,7 @@ import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_assement.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/shared_soap_widgets/remark_text.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/soap_utils.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; @@ -152,7 +153,7 @@ class _UpdateAssessmentPageState extends State { mySelectedAssessmentList.map((assessment) { return Container( margin: EdgeInsets.only( - left: 5, right: 5, top: 15), + left: 5, right: 5, top: 15, bottom: 15), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -166,11 +167,11 @@ class _UpdateAssessmentPageState extends State { RichText( text: new TextSpan( style: new TextStyle( - fontSize: 12, + fontSize: 10, color: Color(0xFF2E303A), fontFamily: 'Poppins', - fontWeight: - FontWeight.w600), + fontWeight: FontWeight.w600, + letterSpacing: -0.4), children: [ new TextSpan( text: @@ -194,11 +195,12 @@ class _UpdateAssessmentPageState extends State { child: RichText( text: new TextSpan( style: new TextStyle( - fontSize: 16, - color: Color(0xFF2E303A), - fontFamily: 'Poppins', - fontWeight: - FontWeight.w600), + fontSize: 16, + color: Color(0xFF2E303A), + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), children: [ new TextSpan( text: assessment @@ -213,17 +215,19 @@ class _UpdateAssessmentPageState extends State { RichText( text: new TextSpan( style: new TextStyle( - fontSize: 12, - color: Color(0xFF2E303A), - fontFamily: 'Poppins', - fontWeight: - FontWeight.w600), + fontSize: 12, + color: Color(0xFF2E303A), + fontFamily: 'Poppins', + fontWeight: FontWeight.w600, + ), children: [ new TextSpan( text: TranslationBase.of( context) .appointmentNo, style: new TextStyle( + fontSize: 10, + letterSpacing: -0.4, color: Color(0xFF575757), ), ), @@ -234,6 +238,7 @@ class _UpdateAssessmentPageState extends State { "", style: new TextStyle( fontSize: 14, + letterSpacing: -0.48, color: Color(0xFF2B353E), ), ), @@ -255,6 +260,7 @@ class _UpdateAssessmentPageState extends State { .condition + " : ", style: new TextStyle( + letterSpacing: -0.4, color: Color(0xFF575757), ), ), @@ -268,7 +274,8 @@ class _UpdateAssessmentPageState extends State { .selectedDiagnosisCondition .nameEn, style: new TextStyle( - fontSize: 14, + fontSize: 12, + letterSpacing: -0.48, color: Color(0xFF2B353E), ), ), @@ -278,7 +285,7 @@ class _UpdateAssessmentPageState extends State { RichText( text: new TextSpan( style: new TextStyle( - fontSize: 12, + fontSize: 10, color: Color(0xFF2E303A), fontFamily: 'Poppins', fontWeight: @@ -290,6 +297,7 @@ class _UpdateAssessmentPageState extends State { .dType + ' : ', style: new TextStyle( + letterSpacing: -0.4, color: Color(0xFF575757), ), ), @@ -303,7 +311,8 @@ class _UpdateAssessmentPageState extends State { .selectedDiagnosisType .nameEn, style: new TextStyle( - fontSize: 14, + fontSize: 12, + letterSpacing: -0.48, color: Color(0xFF2B353E), ), ), @@ -323,9 +332,10 @@ class _UpdateAssessmentPageState extends State { new TextSpan( text: TranslationBase.of( context) - .doc + + .doctor + ' : ', style: new TextStyle( + fontSize: 10,letterSpacing: -0.4, color: Color(0xFF575757), ), @@ -335,7 +345,7 @@ class _UpdateAssessmentPageState extends State { .doctorName ?? '', style: new TextStyle( - fontSize: 14, + fontSize: 12,letterSpacing: -0.48, color: Color(0xFF2B353E), ), @@ -370,17 +380,9 @@ class _UpdateAssessmentPageState extends State { fontFamily: 'Poppins', fontWeight: FontWeight.w600), - Container( - width: MediaQuery.of(context) - .size - .width * - 0.38, - child: AppText( - assessment.remark ?? "", - fontSize: 11, - color: Color(0xFF2B353E), - fontWeight: FontWeight.w700, - ), + RemarkText( + remark: + assessment.remark ?? "", ), ], ), @@ -393,6 +395,8 @@ class _UpdateAssessmentPageState extends State { Row( children: [ Column( + crossAxisAlignment: + CrossAxisAlignment.end, children: [ AppText( assessment.createdOn != @@ -408,7 +412,7 @@ class _UpdateAssessmentPageState extends State { .now()), fontWeight: FontWeight.w600, - fontSize: 14, + fontSize: 12, ), AppText( assessment.createdOn != @@ -422,7 +426,8 @@ class _UpdateAssessmentPageState extends State { .now()), fontWeight: FontWeight.w600, - fontSize: 14, + color: Color(0xFF575757), + fontSize: 12, ), ], ), diff --git a/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart b/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart index 935ac247..07343bb7 100644 --- a/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart +++ b/lib/screens/patients/profile/soap_update/objective/add_examination_page.dart @@ -1,9 +1,11 @@ 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'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -16,7 +18,7 @@ import 'examinations_list_search_widget.dart'; class AddExaminationPage extends StatefulWidget { final List mySelectedExamination; - final Function addSelectedExamination; + final Function (List)addSelectedExamination; final Function(MasterKeyModel) removeExamination; AddExaminationPage( @@ -29,6 +31,14 @@ class AddExaminationPage extends StatefulWidget { } class _AddExaminationPageState extends State { + List mySelectedExaminationLocal; + + @override + initState() { + super.initState(); + mySelectedExaminationLocal = [...widget.mySelectedExamination]; + } + @override Widget build(BuildContext context) { return BaseView( @@ -77,8 +87,9 @@ class _AddExaminationPageState extends State { }); }, addExamination: (selectedExamination) { - widget.mySelectedExamination - .insert(0,selectedExamination); + + mySelectedExaminationLocal + .insert(0, selectedExamination); // setState(() {}); }, ), @@ -91,48 +102,21 @@ class _AddExaminationPageState 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: MediaQuery.of(context).size.height * 0.1, - width: double.infinity, - child: Column( - children: [ - SizedBox( - height: 10, + bottomSheet: model.state == ViewState.Busy + ? Container( + height: 0, + ) + : BottomSheetDialogButton( + label: "${TranslationBase.of(context).addExamination}", + onTap: () { + widget.addSelectedExamination(mySelectedExaminationLocal); + }, ), - Container( - child: FractionallySizedBox( - widthFactor: .80, - child: Center( - child: AppButton( - title: - "${TranslationBase.of(context).addExamination}", - padding: 10, - color: Color(0xFF359846), - onPressed: () { - widget.addSelectedExamination(); - }, - ), - ), - ), - ), - SizedBox( - height: 5, - ), - ], - ), - ), )); } isServiceSelected(MasterKeyModel masterKey) { - Iterable exam = widget.mySelectedExamination.where( + Iterable exam = mySelectedExaminationLocal.where( (element) => masterKey.id == element.selectedExamination.id && masterKey.typeId == element.selectedExamination.typeId); 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 c52f1d4a..384aff90 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 @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_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/shared_soap_widgets/remark_text.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/remove_button.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -76,13 +77,7 @@ class ExaminationItemCard extends StatelessWidget { height: 4, ), if (examination.remark.isNotEmpty) - AppText( - examination.remark, - fontWeight: FontWeight.normal, - fontFamily: 'Poppins', - color: Color(0xFF575757), - fontSize: SizeConfig.textMultiplier * 1.8, - ), + RemarkText(remark: examination.remark), ], ), ); 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 eb9a6002..317fa4af 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 @@ -137,7 +137,7 @@ class _UpdateObjectivePageState extends State { "New", fontWeight: FontWeight.w600, fontFamily: 'Poppins', - color: Colors.blue, + color: Color(0xFFCC9B14), ), ], ), @@ -146,7 +146,11 @@ class _UpdateObjectivePageState extends State { .sublist( 0, model.getFirstIndexForOldExamination( - mySelectedExamination)) + mySelectedExamination) == + -1 + ? 0 + : model.getFirstIndexForOldExamination( + mySelectedExamination)) .map((examination) { return ExaminationItemCard(examination, () { removeExamination( @@ -154,24 +158,28 @@ class _UpdateObjectivePageState extends State { }); }).toList(), ), - if (mySelectedExamination.isNotEmpty && model.getFirstIndexForOldExamination( - mySelectedExamination)>-1) - Row( - children: [ - AppText( - "old", - fontWeight: FontWeight.w600, - fontFamily: 'Poppins', - color: Colors.green, - ), - ], - ), + mySelectedExamination) > + -1) + Row( + children: [ + AppText( + "Verified", + fontWeight: FontWeight.w600, + fontFamily: 'Poppins', + color: Colors.green, + ), + ], + ), Column( children: mySelectedExamination .sublist(model.getFirstIndexForOldExamination( - mySelectedExamination)) + mySelectedExamination) == + -1 + ? 0 + : model.getFirstIndexForOldExamination( + mySelectedExamination)) .map((examination) { return ExaminationItemCard(examination, () { removeExamination( @@ -336,9 +344,38 @@ class _UpdateObjectivePageState extends State { FadePage( page: AddExaminationPage( mySelectedExamination: mySelectedExamination, - addSelectedExamination: () { + addSelectedExamination: (List mySelectedExaminationLocal ) { setState(() { - Navigator.of(context).pop(); + { + mySelectedExaminationLocal.forEach((element) { + if ((mySelectedExamination.singleWhere( + (it) => + it.selectedExamination.id == + element.selectedExamination.id, + orElse: () => null)) == + null) { + mySelectedExamination.add(element); + } + }); + + /// remove items. + List removedList = []; + mySelectedExamination.forEach((element) { + if ((mySelectedExaminationLocal.singleWhere( + (it) => + it.selectedExamination.id == + element.selectedExamination.id, + orElse: () => null)) == + null) { + removedList.add(element); + } + }); + + removedList.forEach((element) { + removeExamination(element.selectedExamination); + }); + Navigator.of(context).pop(); + } }); }, removeExamination: (masterKey) => removeExamination(masterKey)), diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/remark_text.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/remark_text.dart new file mode 100644 index 00000000..91ef6954 --- /dev/null +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/remark_text.dart @@ -0,0 +1,24 @@ + +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +class RemarkText extends StatelessWidget { + final String remark; + const RemarkText({ + Key key, this.remark, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Container( + width: MediaQuery.of(context).size.width * 0.55, + child: AppText( + remark ?? '', + color: Color(0xFF575757), + fontSize: 10, + fontWeight: FontWeight.w700, + letterSpacing: -0.4, + ), + ); + } +} \ No newline at end of file diff --git a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steps_widget.dart b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steps_widget.dart index e79c24a7..31524295 100644 --- a/lib/screens/patients/profile/soap_update/shared_soap_widgets/steps_widget.dart +++ b/lib/screens/patients/profile/soap_update/shared_soap_widgets/steps_widget.dart @@ -248,7 +248,7 @@ class StepsWidget extends StatelessWidget { fontWeight: FontWeight.bold, fontSize: 12, textAlign: TextAlign.end, - marginLeft: 25, + marginLeft: 30, ), StatusLabel( selectedStepId: index, 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 44eae2b8..7f1abb64 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 @@ -45,32 +45,6 @@ class _AddAllergiesState extends State { GlobalKey key = new GlobalKey>(); bool isFormSubmitted = false; - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown, - {IconData icon}) { - return InputDecoration( - contentPadding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.grey, width: 1.0), - borderRadius: BorderRadius.circular(8), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.grey, width: 1.0), - borderRadius: BorderRadius.circular(8), - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.grey, width: 1.0), - borderRadius: BorderRadius.circular(8), - ), - hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown ? Icon(icon ?? Icons.arrow_drop_down) : null, - hintStyle: TextStyle( - fontSize: 10, - color: Theme.of(context).hintColor, - fontWeight: FontWeight.w700), - ); - } - @override Widget build(BuildContext context) { return FractionallySizedBox( 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 1984e3f9..48136cb4 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,5 +1,6 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/remark_text.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/remove_button.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -103,16 +104,7 @@ class _UpdateAllergiesWidgetState extends State { padding: const EdgeInsets.symmetric(vertical: 8), child: Row( children: [ - Container( - width: MediaQuery.of(context).size.width * 0.55, - child: AppText( - selectedAllergy.remark ?? '', - color: Color(0xFF575757), - fontSize: 10, - fontWeight: FontWeight.w700, - letterSpacing: -0.4, - ), - ), + RemarkText(remark: selectedAllergy.remark,), ], ), ), @@ -210,3 +202,4 @@ class _UpdateAllergiesWidgetState extends State { } } +