From 6e96dda6cd4f9b56dda3bbb68f8e12629c5efcb8 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 7 Apr 2021 14:41:52 +0300 Subject: [PATCH] finish soap objective new design --- lib/config/localized_values.dart | 5 +- lib/util/translations_delegate_base.dart | 2 + .../objective/examination-item-card.dart | 93 +++ .../objective-add-examination-page.dart | 506 ++++++++++++ .../objective/update_objective_page.dart | 473 ++++++++++++ .../soap_update/update_objective_page.dart | 730 ------------------ .../soap_update/update_soap_index.dart | 2 +- lib/widgets/shared/app-textfield-custom.dart | 21 +- 8 files changed, 1097 insertions(+), 735 deletions(-) create mode 100644 lib/widgets/patients/profile/soap_update/objective/examination-item-card.dart create mode 100644 lib/widgets/patients/profile/soap_update/objective/objective-add-examination-page.dart create mode 100644 lib/widgets/patients/profile/soap_update/objective/update_objective_page.dart delete mode 100644 lib/widgets/patients/profile/soap_update/update_objective_page.dart diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 980a2e9b..b0e694a8 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -824,8 +824,11 @@ const Map> localizedValues = { "accepted": {"en": "Accepted", "ar": "وافقت"}, "cancelled": {"en": "Cancelled", "ar": "ألغيت"}, "unReplied": {"en": "UnReplied", "ar": "لم يتم الرد"}, - "replied": {"en": "Replied", "ar": " تم الرد"},"typeHereToReply": { + "searchHere": {"en": "Search here", "ar": "إبحث هنا"}, + "replied": {"en": "Replied", "ar": " تم الرد"}, + "typeHereToReply": { "en": "Type here to reply", "ar": "اكتب هنا للرد" }, + "remove": {"en": "Remove", "ar": " حذف"}, }; diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 243f742e..6eba28fc 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1205,6 +1205,8 @@ class TranslationBase { String get unReplied => localizedValues['unReplied'][locale.languageCode]; String get replied => localizedValues['replied'][locale.languageCode]; String get typeHereToReply => localizedValues['typeHereToReply'][locale.languageCode]; + String get searchHere => localizedValues['searchHere'][locale.languageCode]; + String get remove => localizedValues['remove'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/patients/profile/soap_update/objective/examination-item-card.dart b/lib/widgets/patients/profile/soap_update/objective/examination-item-card.dart new file mode 100644 index 00000000..ff5d0a6c --- /dev/null +++ b/lib/widgets/patients/profile/soap_update/objective/examination-item-card.dart @@ -0,0 +1,93 @@ +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/my_selected_examination.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'; +import 'package:provider/provider.dart'; + +class ExaminationIitemCard extends StatelessWidget { + final MySelectedExamination examination; + final Function removeExamination; + + ExaminationIitemCard(this.examination, this.removeExamination); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + return Container( + color: Colors.white, + padding: EdgeInsets.all(8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: Container( + child: AppText( + projectViewModel.isArabic + ? examination.selectedExamination.nameAr != null && + examination.selectedExamination.nameAr != "" + ? examination.selectedExamination.nameAr + : examination.selectedExamination.nameEn + : examination.selectedExamination.nameEn, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.8, + ), + )), + Row( + children: [ + AppText( + TranslationBase.of(context).remove, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + color: Colors.red.shade800, + fontSize: SizeConfig.textMultiplier * 1.8, + ), + InkWell( + onTap: removeExamination, + child: Icon( + Icons.clear, + size: 20, + color: Colors.red.shade800, + ), + ) + ], + ), + ], + ), + AppText( + !examination.isNormal + ? examination.isAbnormal + ? TranslationBase.of(context).abnormal + : TranslationBase.of(context).notExamined + : TranslationBase.of(context).normal, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + color: !examination.isNormal + ? examination.isAbnormal + ? Colors.red.shade800 + : Colors.grey.shade800 + : Colors.green.shade800, + fontSize: SizeConfig.textMultiplier * 1.8, + ), + SizedBox( + height: 4, + ), + Expanded( + child: AppText( + examination.remark, + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + color: Colors.grey.shade500, + fontSize: SizeConfig.textMultiplier * 1.8, + ), + ), + ], + ), + ); + } +} diff --git a/lib/widgets/patients/profile/soap_update/objective/objective-add-examination-page.dart b/lib/widgets/patients/profile/soap_update/objective/objective-add-examination-page.dart new file mode 100644 index 00000000..225b6f61 --- /dev/null +++ b/lib/widgets/patients/profile/soap_update/objective/objective-add-examination-page.dart @@ -0,0 +1,506 @@ +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_examination.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/app-textfield-custom.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/borderedButton.dart'; +import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; +import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; +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; + final Function(MasterKeyModel) removeExamination; + + AddExaminationPage( + {this.mySelectedExamination, + this.addSelectedExamination, + this.removeExamination}); + + @override + _AddExaminationPageState createState() => _AddExaminationPageState(); +} + +class _AddExaminationPageState extends State { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) async { + if (model.physicalExaminationList.length == 0) { + await model.getMasterLookup(MasterKeysService.PhysicalExamination); + } + }, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: false, + backgroundColor: Color.fromRGBO(248, 248, 248, 1), + body: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + padding: + EdgeInsets.only(left: 16, top: 70, right: 16, bottom: 16), + color: Colors.white, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).addExamination}", + fontSize: SizeConfig.textMultiplier * 3.3, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + InkWell( + onTap: () { + Navigator.of(context).pop(); + }, + child: Icon( + Icons.clear, + size: 40, + ), + ) + ], + ), + ), + Expanded( + child: SingleChildScrollView( + child: Column( + children: [ + Container( + margin: EdgeInsets.all(16.0), + padding: EdgeInsets.all(0.0), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.white, + borderRadius: BorderRadius.circular(12), + border: Border.fromBorderSide(BorderSide( + color: Colors.grey.shade400, + width: 0.4, + )), + ), + child: Column( + children: [ + ExaminationsListSearchWidget( + masterList: model.physicalExaminationList, + isServiceSelected: (master) => + isServiceSelected(master), + removeHistory: (history) { + setState(() { + widget.removeExamination(history); + }); + }, + addHistory: (selectedExamination) { + setState(() { + widget.mySelectedExamination + .add(selectedExamination); + }); + }, + ), + ], + ), + ), + ], + ), + ), + ), + Container( + padding: EdgeInsets.all(16), + color: Colors.white, + child: BorderedButton( + "${TranslationBase.of(context).addExamination}", + backgroundColor: HexColor("#359846"), + textColor: Colors.white, + vPadding: 12, + radius: 12, + fontWeight: FontWeight.w600, + fontSize: SizeConfig.textMultiplier * 2.5, + fontFamily: 'Poppins', + handler: () { + widget.addSelectedExamination(); + }, + ), + ) + ], + ), + ), + ); + } + + isServiceSelected(MasterKeyModel masterKey) { + Iterable exam = widget.mySelectedExamination.where( + (element) => + masterKey.id == element.selectedExamination.id && + masterKey.typeId == element.selectedExamination.typeId); + if (exam.length > 0) { + return true; + } + return false; + } +} + +class ExaminationsListSearchWidget extends StatefulWidget { + final Function(MasterKeyModel) removeHistory; + final Function(MySelectedExamination) addHistory; + final bool Function(MasterKeyModel) isServiceSelected; + final List masterList; + + ExaminationsListSearchWidget( + {this.removeHistory, + this.addHistory, + this.isServiceSelected, + this.masterList}); + + @override + _ExaminationsListSearchWidgetState createState() => + _ExaminationsListSearchWidgetState(); +} + +class _ExaminationsListSearchWidgetState + extends State { + int expandedIndex = -1; + List items = List(); + TextEditingController filteredSearchController = TextEditingController(); + + @override + void initState() { + items.addAll(widget.masterList); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Column( + children: [ + AppTextFieldCustom( + height: MediaQuery.of(context).size.height * 0.080, + hintText: TranslationBase.of(context).searchExamination, + isDropDown: true, + hasBorder: false, + controller: filteredSearchController, + onChanged: (value) { + filterSearchResults(value); + }, + suffixIcon: Icon( + Icons.search, + color: Colors.black, + ), + ), + DividerWithSpacesAround( + height: 2, + ), + ...items.mapIndexed((index, item) { + return AddExaminationWidget( + item: item, + addHistory: widget.addHistory, + removeHistory: widget.removeHistory, + isServiceSelected: widget.isServiceSelected, + isExpand: index == expandedIndex, + expandClick: () { + setState(() { + if (expandedIndex == index) { + expandedIndex = -1; + } else { + expandedIndex = index; + } + }); + }, + ); + }).toList(), + ], + ); + } + + void filterSearchResults(String query) { + List dummySearchList = List(); + dummySearchList.addAll(widget.masterList); + if (query.isNotEmpty) { + List dummyListData = List(); + dummySearchList.forEach((item) { + if (item.nameAr.toLowerCase().contains(query.toLowerCase()) || + item.nameEn.toLowerCase().contains(query.toLowerCase())) { + dummyListData.add(item); + } + }); + setState(() { + items.clear(); + items.addAll(dummyListData); + }); + return; + } else { + setState(() { + items.clear(); + items.addAll(widget.masterList); + }); + } + } +} + +class AddExaminationWidget extends StatefulWidget { + MasterKeyModel item; + final Function(MasterKeyModel) removeHistory; + final Function(MySelectedExamination) addHistory; + final bool Function(MasterKeyModel) isServiceSelected; + bool isExpand; + final Function expandClick; + + AddExaminationWidget({ + this.item, + this.removeHistory, + this.addHistory, + this.isServiceSelected, + this.isExpand, + this.expandClick, + }); + + @override + _AddExaminationWidgetState createState() => _AddExaminationWidgetState(); +} + +class _AddExaminationWidgetState extends State { + int status = 3; + TextEditingController remarksController = TextEditingController(); + MySelectedExamination examination = MySelectedExamination(); + + @override + void initState() { + + examination.selectedExamination = widget.item; + super.initState(); + } + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + return Container( + child: HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: CheckboxListTile( + title: AppText( + projectViewModel.isArabic + ? widget.item.nameAr != null && widget.item.nameAr != "" + ? widget.item.nameAr + : widget.item.nameEn + : widget.item.nameEn, + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 2.0, + ), + value: widget.isServiceSelected(widget.item), + activeColor: HexColor("#D02127"), + onChanged: (newValue) { + setState(() { + if (widget.isServiceSelected(widget.item)) { + widget.removeHistory(widget.item); + widget.expandClick(); + } else { + examination.isNormal = status == 1; + examination.isAbnormal = status == 2; + examination.notExamined = status == 3; + examination.remark = remarksController.text; + widget.addHistory(examination); + widget.expandClick(); + } + }); + }, + controlAffinity: ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 8), + child: InkWell( + onTap: widget.expandClick, + child: Icon(widget.isExpand + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down)), + ), + ], + ), + bodyWidget: Container( + padding: EdgeInsets.symmetric(horizontal: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(bottom: 8), + child: AppText( + TranslationBase.of(context).status, + fontWeight: FontWeight.bold, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.6, + ), + ), + Row( + children: [ + Expanded( + child: Row( + children: [ + InkWell( + onTap: () { + setState(() { + status = 1; + }); + examination.isNormal = true; + examination.isAbnormal = false; + examination.notExamined = false; + }, + child: Container( + padding: EdgeInsets.all(2.0), + margin: EdgeInsets.symmetric(horizontal: 6), + width: 20, + height: 20, + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + border: Border.all(color: Colors.grey, width: 1), + ), + child: Container( + decoration: BoxDecoration( + color: status == 1 + ? HexColor("#D02127") + : Colors.white, + shape: BoxShape.circle, + ), + ), + ), + ), + AppText( + TranslationBase.of(context).normal, + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.6, + ), + ], + )), + Expanded( + child: Row( + children: [ + InkWell( + onTap: () { + setState(() { + status = 2; + }); + examination.isNormal = false; + examination.isAbnormal = true; + examination.notExamined = false; + }, + child: Container( + padding: EdgeInsets.all(2.0), + margin: EdgeInsets.symmetric(horizontal: 6), + width: 20, + height: 20, + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + border: Border.all(color: Colors.grey, width: 1), + ), + child: Container( + decoration: BoxDecoration( + color: status == 2 + ? HexColor("#D02127") + : Colors.white, + shape: BoxShape.circle, + ), + ), + ), + ), + AppText( + TranslationBase.of(context).abnormal, + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.6, + ), + ], + )), + Expanded( + child: Row( + children: [ + InkWell( + onTap: () { + setState(() { + status = 3; + }); + examination.isNormal = false; + examination.isAbnormal = false; + examination.notExamined = true; + }, + child: Container( + padding: EdgeInsets.all(2.0), + margin: EdgeInsets.symmetric(horizontal: 6), + width: 20, + height: 20, + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + border: Border.all(color: Colors.grey, width: 1), + ), + child: Container( + decoration: BoxDecoration( + color: status == 3 + ? HexColor("#D02127") + : Colors.white, + shape: BoxShape.circle, + ), + ), + ), + ), + Expanded( + child: AppText( + TranslationBase.of(context).notExamined, + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.6, + ), + ), + ], + )), + ], + ), + Container( + margin: EdgeInsets.only(top: 8), + child: AppTextFieldCustom( + hintText: TranslationBase.of(context).remarks, + controller: remarksController, + minLines: 2, + maxLines: 4, + inputType: TextInputType.multiline, + onChanged: (value){ + examination.remark = value; + }, + ), + ), + ], + ), + ), + isExpand: widget.isExpand, + ), + ); + } +} + +extension FicListExtension on List { + /// Maps each element of the list. + /// The [map] function gets both the original [item] and its [index]. + Iterable mapIndexed(E Function(int index, T item) map) sync* { + for (var index = 0; index < length; index++) { + yield map(index, this[index]); + } + } +} diff --git a/lib/widgets/patients/profile/soap_update/objective/update_objective_page.dart b/lib/widgets/patients/profile/soap_update/objective/update_objective_page.dart new file mode 100644 index 00000000..ba9368bb --- /dev/null +++ b/lib/widgets/patients/profile/soap_update/objective/update_objective_page.dart @@ -0,0 +1,473 @@ +import 'package:doctor_app_flutter/config/config.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'; +import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; +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/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_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/expandable-widget-header-body.dart'; +import 'package:doctor_app_flutter/widgets/transitions/fade_page.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 'examination-item-card.dart'; +import 'objective-add-examination-page.dart'; + +class UpdateObjectivePage extends StatefulWidget { + final Function changePageViewIndex; + final Function changeLoadingState; + + final List mySelectedExamination; + final PatiantInformtion patientInfo; + + UpdateObjectivePage( + {Key key, + this.changePageViewIndex, + this.mySelectedExamination, + this.patientInfo, + this.changeLoadingState}); + + @override + _UpdateObjectivePageState createState() => _UpdateObjectivePageState(); +} + +class _UpdateObjectivePageState extends State { + bool isSysExaminationExpand = false; + + BoxDecoration containerBorderDecoration( + Color containerColor, Color borderColor) { + return BoxDecoration( + color: containerColor, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all(Radius.circular(6)), + border: Border.fromBorderSide(BorderSide( + color: borderColor, + width: 0.5, + )), + ); + } + + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + ProjectViewModel projectViewModel = Provider.of(context); + + return BaseView( + onModelReady: (model) async { + widget.mySelectedExamination.clear(); + GetPhysicalExamReqModel getPhysicalExamReqModel = + GetPhysicalExamReqModel( + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo.toString(), + appointmentNo: widget.patientInfo.appointmentNo); + + await model.getPatientPhysicalExam(getPhysicalExamReqModel); + if (model.patientPhysicalExamList.isNotEmpty) { + if (model.physicalExaminationList.length == 0) { + await model + .getMasterLookup(MasterKeysService.PhysicalExamination); + } + model.patientPhysicalExamList.forEach((element) { + MasterKeyModel examMaster = model.getOneMasterKey( + masterKeys: MasterKeysService.PhysicalExamination, + id: element.examId, + ); + MySelectedExamination tempEam = MySelectedExamination( + selectedExamination: examMaster, + remark: element.remarks, + isNormal: element.isNormal, + createdBy: element.createdBy, + notExamined: element.notExamined, + isNew: element.isNew, + isAbnormal: element.isAbnormal); + widget.mySelectedExamination.add(tempEam); + }); + } + + widget.changeLoadingState(false); + }, + builder: (_, model, w) => AppScaffold( + isShowAppBar: false, + // baseViewModel: model, + body: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: SingleChildScrollView( + physics: ScrollPhysics(), + child: Container( + color: Color.fromRGBO(248, 248, 248, 1), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.95, + child: Container( + margin: EdgeInsets.all(8.0), + padding: EdgeInsets.all(12.0), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: Colors.white, + borderRadius: BorderRadius.circular(12), + border: Border.fromBorderSide(BorderSide( + color: Colors.grey.shade400, + width: 0.4, + )), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).physicalSystemExamination}", + fontFamily: 'Poppins', + fontSize: + SizeConfig.textMultiplier * 2.0, + fontWeight: isSysExaminationExpand + ? FontWeight.w700 + : FontWeight.normal, + ), + Icon( + FontAwesomeIcons.asterisk, + color: AppGlobal.appPrimaryColor, + size: 12, + ) + ], + ), + InkWell( + onTap: () { + setState(() { + isSysExaminationExpand = + !isSysExaminationExpand; + }); + }, + child: Icon(isSysExaminationExpand + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down)) + ], + ), + bodyWidget: Column( + children: [ + InkWell( + onTap: () { + openExaminationList(context); + }, + child: Container( + padding: EdgeInsets.symmetric( + vertical: 8, horizontal: 8.0), + margin: + EdgeInsets.symmetric(vertical: 8), + decoration: BoxDecoration( + border: Border.all( + color: Colors.grey.shade400, + width: 0.5), + borderRadius: BorderRadius.all( + Radius.circular(8), + ), + color: Colors.white, + ), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + "${TranslationBase.of(context).addExamination}", + fontSize: SizeConfig + .textMultiplier * + 1.8, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + AppText( + "${TranslationBase.of(context).searchHere}", + fontSize: SizeConfig + .textMultiplier * + 1.8, + color: Colors.grey.shade700, + fontWeight: FontWeight.bold, + ), + ], + )), + Icon( + Icons.add_box_rounded, + size: 25, + ) + ], + ), + ), + ), + Column( + children: widget.mySelectedExamination + .map((examination) { + return ExaminationIitemCard( + examination, () { + removeExamination(examination + .selectedExamination); + }); + }).toList(), + ) + ], + ), + isExpand: isSysExaminationExpand, + ), + ], + ), + ), + ), + ), + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: Row( + children: [ + Expanded( + child: AppButton( + title: TranslationBase.of(context).previous, + color: HexColor("#EAEAEA"), + fontColor: Colors.black, + onPressed: () { + widget.changePageViewIndex(0); + }, + ), + ), + SizedBox( + width: 10, + ), + Expanded( + child: AppButton( + title: TranslationBase.of(context).next, + loading: model.state == ViewState.BusyLocal, + color: HexColor("#A5A5A5"), + fontColor: HexColor("#5A5A5A"), + fontWeight: FontWeight.bold, + onPressed: () async { + await submitUpdateObjectivePage(model); + }, + ), + ), + ], + ), + ), + ], + ))); + } + + submitUpdateObjectivePage(SOAPViewModel model) async { + if (widget.mySelectedExamination.isNotEmpty) { + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + PostPhysicalExamRequestModel postPhysicalExamRequestModel = + new PostPhysicalExamRequestModel(); + widget.mySelectedExamination.forEach((exam) { + if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == + null) + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = + []; + + postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM + .add(ListHisProgNotePhysicalExaminationVM( + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + remarks: exam.remark ?? '', + createdBy: exam.createdBy ?? doctorProfile.doctorID, + createdOn: DateTime.now().toIso8601String(), + editedBy: doctorProfile.doctorID, + editedOn: DateTime.now().toIso8601String(), + examId: exam.selectedExamination.id, + examType: exam.selectedExamination.typeId, + isAbnormal: exam.isAbnormal, + isNormal: exam.isNormal, + // masterDescription: exam.selectedExamination, + notExamined: exam.notExamined, + examinationType: exam.isNormal + ? 1 + : exam.isAbnormal + ? 2 + : 3, + examinationTypeName: exam.isNormal + ? "Normal" + : exam.isAbnormal + ? 'AbNormal' + : "Not Examined", + isNew: exam.isNew)); + }); + + if (model.patientPhysicalExamList.isEmpty) { + await model.postPhysicalExam(postPhysicalExamRequestModel); + } else { + await model.patchPhysicalExam(postPhysicalExamRequestModel); + } + + if (model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } else { + widget.changeLoadingState(true); + + widget.changePageViewIndex(2); + } + } else { + // widget.changeLoadingState(true); + // + // widget.changePageViewIndex(2); + + helpers.showErrorToast(TranslationBase.of(context).examinationErrorMsg); + } + } + + removeExamination(MasterKeyModel masterKey) { + Iterable history = widget.mySelectedExamination + .where((element) => + masterKey.id == element.selectedExamination.id && + masterKey.typeId == element.selectedExamination.typeId); + + if (history.length > 0) + setState(() { + widget.mySelectedExamination.remove(history.first); + }); + } + + openExaminationList(BuildContext context) { + Navigator.push( + context, + FadePage( + page: AddExaminationPage( + mySelectedExamination: widget.mySelectedExamination, + addSelectedExamination: () { + setState(() { + Navigator.of(context).pop(); + }); + }, + removeExamination: (masterKey) => removeExamination(masterKey)), + ), + ); + /*showModalBottomSheet( + backgroundColor: Colors.white, + isScrollControlled: true, + context: context, + builder: (context) { + return AddExaminationDailog( + mySelectedExamination: widget.mySelectedExamination, + addSelectedExamination: () { + setState(() { + Navigator.of(context).pop(); + }); + }, + removeExamination: (masterKey) => removeExamination(masterKey), + ); + });*/ + } +} + +class AddExaminationDailog extends StatefulWidget { + final List mySelectedExamination; + final Function addSelectedExamination; + final Function(MasterKeyModel) removeExamination; + + const AddExaminationDailog( + {Key key, + this.mySelectedExamination, + this.addSelectedExamination, + this.removeExamination}) + : super(key: key); + + @override + _AddExaminationDailogState createState() => _AddExaminationDailogState(); +} + +class _AddExaminationDailogState extends State { + @override + Widget build(BuildContext context) { + return FractionallySizedBox( + heightFactor: 0.7, + child: BaseView( + onModelReady: (model) async { + if (model.physicalExaminationList.length == 0) { + await model + .getMasterLookup(MasterKeysService.PhysicalExamination); + } + }, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: false, + body: Center( + child: Container( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).physicalSystemExamination, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + SizedBox( + height: 16, + ), + /*MasterKeyCheckboxSearchWidget( + model: model, + hintSearchText: + TranslationBase.of(context).searchExamination, + buttonName: + TranslationBase.of(context).addExamination, + masterList: model.physicalExaminationList, + removeHistory: (history) { + setState(() { + widget.removeExamination(history); + }); + }, + addHistory: (history) { + setState(() { + MySelectedExamination mySelectedExamination = + new MySelectedExamination( + selectedExamination: history); + widget.mySelectedExamination + .add(mySelectedExamination); + }); + }, + addSelectedHistories: () { + widget.addSelectedExamination(); + }, + isServiceSelected: (master) => + isServiceSelected(master), + ),*/ + ]), + ))), + )), + ); + } +} diff --git a/lib/widgets/patients/profile/soap_update/update_objective_page.dart b/lib/widgets/patients/profile/soap_update/update_objective_page.dart deleted file mode 100644 index 1ce5fbea..00000000 --- a/lib/widgets/patients/profile/soap_update/update_objective_page.dart +++ /dev/null @@ -1,730 +0,0 @@ -import 'package:doctor_app_flutter/config/config.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'; -import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart'; -import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; -import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; -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/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/expandable_SOAP_widget.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_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/divider_with_spaces_around.dart'; -import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.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'; - -class UpdateObjectivePage extends StatefulWidget { - final Function changePageViewIndex; - final Function changeLoadingState; - - final List mySelectedExamination; - final PatiantInformtion patientInfo; - - UpdateObjectivePage( - {Key key, - this.changePageViewIndex, - this.mySelectedExamination, - this.patientInfo, - this.changeLoadingState}); - - @override - _UpdateObjectivePageState createState() => _UpdateObjectivePageState(); -} - -class _UpdateObjectivePageState extends State { - bool isSysExaminationExpand = false; - - BoxDecoration containerBorderDecoration( - Color containerColor, Color borderColor) { - return BoxDecoration( - color: containerColor, - shape: BoxShape.rectangle, - borderRadius: BorderRadius.all(Radius.circular(6)), - border: Border.fromBorderSide(BorderSide( - color: borderColor, - width: 0.5, - )), - ); - } - - @override - Widget build(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - ProjectViewModel projectViewModel = Provider.of(context); - - return BaseView( - onModelReady: (model) async { - widget.mySelectedExamination.clear(); - GetPhysicalExamReqModel getPhysicalExamReqModel = - GetPhysicalExamReqModel( - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo.toString(), - appointmentNo: widget.patientInfo.appointmentNo); - - await model.getPatientPhysicalExam(getPhysicalExamReqModel); - if (model.patientPhysicalExamList.isNotEmpty) { - if (model.physicalExaminationList.length == 0) { - await model - .getMasterLookup(MasterKeysService.PhysicalExamination); - } - model.patientPhysicalExamList.forEach((element) { - MasterKeyModel examMaster = model.getOneMasterKey( - masterKeys: MasterKeysService.PhysicalExamination, - id: element.examId, - ); - MySelectedExamination tempEam = MySelectedExamination( - selectedExamination: examMaster, - remark: element.remarks, - isNormal: element.isNormal, - createdBy: element.createdBy, - notExamined: element.notExamined, - isNew: element.isNew, - isAbnormal: element.isAbnormal); - widget.mySelectedExamination.add(tempEam); - }); - } - - widget.changeLoadingState(false); - }, - builder: (_, model, w) => AppScaffold( - isShowAppBar: false, - // baseViewModel: model, - body: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: SingleChildScrollView( - physics: ScrollPhysics(), - child: Container( - color: Color.fromRGBO(248, 248, 248, 1), - child: Center( - child: FractionallySizedBox( - widthFactor: 0.95, - child: Container( - margin: EdgeInsets.all(8.0), - padding: EdgeInsets.all(12.0), - decoration: BoxDecoration( - shape: BoxShape.rectangle, - color: Colors.white, - borderRadius: BorderRadius.circular(12), - border: Border.fromBorderSide(BorderSide( - color: Colors.grey.shade400, - width: 0.4, - )), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - HeaderBodyExpandableNotifier( - headerWidget: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).physicalSystemExamination}", - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 2.0, - fontWeight: isSysExaminationExpand ? FontWeight.w700 : FontWeight.normal, - ), - /*Texts( - TranslationBase.of(context) - .physicalSystemExamination, - variant: isSysExaminationExpand - ? "bodyText" - : '', - bold: isSysExaminationExpand - ? true - : false, - color: Colors.black),*/ - Icon( - FontAwesomeIcons.asterisk, - color: AppGlobal.appPrimaryColor, - size: 12, - ) - ], - ), - InkWell( - onTap: () { - setState(() { - isSysExaminationExpand = - !isSysExaminationExpand; - }); - }, - child: Icon(isSysExaminationExpand - ? Icons.keyboard_arrow_up - : Icons.keyboard_arrow_down)) - ], - ), - bodyWidget: Column(children: [ - SizedBox( - height: 20, - ), - Column( - children: [ - Container( - margin: EdgeInsets.only( - left: 10, right: 10, top: 15), - child: TextFields( - hintText: TranslationBase.of(context) - .physicalSystemExamination, - fontSize: 13.5, - onTapTextFields: () { - openExaminationList(context); - }, - readOnly: true, - // hintColor: Colors.black, - suffixIcon: - EvaIcons.plusCircleOutline, - suffixIconColor: - AppGlobal.appPrimaryColor, - fontWeight: FontWeight.w600, - // controller: messageController, - validator: (value) { - if (value == null) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 20, - ), - Column( - children: widget.mySelectedExamination - .map((examination) { - TextEditingController - remarksController = - TextEditingController( - text: examination.remark); - - return Container( - margin: EdgeInsets.only( - left: 15, right: 15, top: 15), - child: Column(children: [ - Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: [ - Texts( - (examination - .selectedExamination - .nameEn) - .toUpperCase(), - variant: "bodyText", - bold: true, - color: Colors.black) - ], - ), - SizedBox( - height: 8, - ), - Row( - mainAxisAlignment: - MainAxisAlignment - .spaceBetween, - children: [ - Row( - children: [ - InkWell( - child: Center( - child: Container( - height: screenSize - .height * - 0.070, - decoration: containerBorderDecoration( - examination - .isNormal - ? Color( - 0xFF515A5D) - : Colors - .white, - Colors - .grey), - child: Center( - child: - Padding( - padding: - const EdgeInsets.all( - 8.0), - child: Text( - TranslationBase.of( - context) - .normal, - style: - TextStyle( - fontSize: - 12, - color: examination.isNormal - ? Colors.white - : Colors.black, - //Colors.black, - fontWeight: - FontWeight.bold, - ), - ), - ), - )), - ), - onTap: () { - setState(() { - examination - .isAbnormal = - false; - examination - .isNormal = - true; - examination - .notExamined = - false; - }); - }), - SizedBox( - width: 12, - ), - InkWell( - child: Center( - child: Container( - height: screenSize - .height * - 0.070, - decoration: containerBorderDecoration( - examination - .isAbnormal - ? Color( - 0xFF515A5D) - : Colors - .white, - Colors - .black), - child: Center( - child: - Padding( - padding: - const EdgeInsets.all( - 8.0), - child: Text( - TranslationBase.of( - context) - .abnormal, - style: - TextStyle( - fontSize: - 12, - color: examination.isAbnormal - ? Colors.white - : Colors.black, - //Colors.black, - fontWeight: - FontWeight.bold, - ), - ), - ), - )), - ), - onTap: () { - setState(() { - examination - .isNormal = - false; - examination - .isAbnormal = - true; - examination - .notExamined = - false; - }); - }), - SizedBox( - width: 12, - ), - InkWell( - child: Center( - child: Container( - height: screenSize - .height * - 0.070, - decoration: containerBorderDecoration( - examination - .notExamined - ? Color( - 0xFF515A5D) - : Colors - .white, - Colors - .black), - child: Center( - child: - Padding( - padding: - const EdgeInsets.all( - 8.0), - child: Text( - "Not Examined", - style: - TextStyle( - fontSize: - 12, - color: examination.notExamined - ? Colors.white - : Colors.black, - //Colors.black, - fontWeight: - FontWeight.bold, - ), - ), - ), - )), - ), - onTap: () { - setState(() { - examination - .isAbnormal = - false; - examination - .isNormal = - false; - examination - .notExamined = - true; - }); - }), - ], - ), - InkWell( - child: Icon( - FontAwesomeIcons.trash, - color: Colors.grey, - size: 20, - ), - onTap: () => removeExamination( - examination - .selectedExamination), - ) - ], - ), - SizedBox( - height: 20, - ), - Container( - margin: EdgeInsets.only( - left: 0, right: 0, top: 15), - child: TextFields( - hasLabelText: - remarksController - .text != - '' - ? true - : false, - showLabelText: true, - hintText: - TranslationBase.of( - context) - .remarks, - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 25, - minLines: 4, - controller: - remarksController, - onChanged: (val) { - examination.remark = val; - }, - validator: (value) { - if (value == null) - return TranslationBase - .of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 20, - ), - ])); - }).toList(), - ) - ], - ) - ]), - isExpand: isSysExaminationExpand, - ), - ], - ), - ), - ), - ), - ), - ), - ), - Container( - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: Row( - children: [ - Expanded( - child: AppButton( - title: TranslationBase.of(context).previous, - color: HexColor("#EAEAEA"), - fontColor: Colors.black, - onPressed: () { - widget.changePageViewIndex(0); - }, - ), - ), - SizedBox( - width: 10, - ), - Expanded( - child: AppButton( - title: TranslationBase.of(context).next, - loading: model.state == ViewState.BusyLocal, - color: HexColor("#A5A5A5"), - fontColor: HexColor("#5A5A5A"), - fontWeight: FontWeight.bold, - onPressed: () async { - await submitUpdateObjectivePage(model); - }, - ), - ), - ], - ), - ), - ], - ))); - } - - submitUpdateObjectivePage(SOAPViewModel model) async { - if (widget.mySelectedExamination.isNotEmpty) { - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - - DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - PostPhysicalExamRequestModel postPhysicalExamRequestModel = - new PostPhysicalExamRequestModel(); - widget.mySelectedExamination.forEach((exam) { - if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == - null) - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = - []; - - postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM - .add(ListHisProgNotePhysicalExaminationVM( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - remarks: exam.remark ?? '', - createdBy: exam.createdBy ?? doctorProfile.doctorID, - createdOn: DateTime.now().toIso8601String(), - editedBy: doctorProfile.doctorID, - editedOn: DateTime.now().toIso8601String(), - examId: exam.selectedExamination.id, - examType: exam.selectedExamination.typeId, - isAbnormal: exam.isAbnormal, - isNormal: exam.isNormal, - // masterDescription: exam.selectedExamination, - notExamined: exam.notExamined, - examinationType: exam.isNormal - ? 1 - : exam.isAbnormal - ? 2 - : 3, - examinationTypeName: exam.isNormal - ? "Normal" - : exam.isAbnormal - ? 'AbNormal' - : "Not Examined", - isNew: exam.isNew)); - }); - - if (model.patientPhysicalExamList.isEmpty) { - await model.postPhysicalExam(postPhysicalExamRequestModel); - } else { - await model.patchPhysicalExam(postPhysicalExamRequestModel); - } - - if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); - } else { - widget.changeLoadingState(true); - - widget.changePageViewIndex(2); - } - } else { - // widget.changeLoadingState(true); - // - // widget.changePageViewIndex(2); - - helpers.showErrorToast(TranslationBase.of(context).examinationErrorMsg); - } - } - - removeExamination(MasterKeyModel masterKey) { - Iterable history = widget.mySelectedExamination - .where((element) => - masterKey.id == element.selectedExamination.id && - masterKey.typeId == element.selectedExamination.typeId); - - if (history.length > 0) - setState(() { - widget.mySelectedExamination.remove(history.first); - }); - } - - openExaminationList(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown) { - return InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown ? Icon(Icons.arrow_drop_down) : null, - hintStyle: TextStyle( - fontSize: 14, - color: Colors.grey.shade600, - ), - ); - } - - showModalBottomSheet( - backgroundColor: Colors.white, - isScrollControlled: true, - context: context, - builder: (context) { - return AddExaminationDailog( - mySelectedExamination: widget.mySelectedExamination, - addSelectedExamination: () { - setState(() { - Navigator.of(context).pop(); - }); - }, - removeExamination: (masterKey) => removeExamination(masterKey), - ); - }); - } -} - -class AddExaminationDailog extends StatefulWidget { - final List mySelectedExamination; - final Function addSelectedExamination; - final Function(MasterKeyModel) removeExamination; - - const AddExaminationDailog( - {Key key, - this.mySelectedExamination, - this.addSelectedExamination, - this.removeExamination}) - : super(key: key); - - @override - _AddExaminationDailogState createState() => _AddExaminationDailogState(); -} - -class _AddExaminationDailogState extends State { - @override - Widget build(BuildContext context) { - return FractionallySizedBox( - heightFactor: 0.7, - child: BaseView( - onModelReady: (model) async { - if (model.physicalExaminationList.length == 0) { - await model - .getMasterLookup(MasterKeysService.PhysicalExamination); - } - }, - builder: (_, model, w) => AppScaffold( - baseViewModel: model, - isShowAppBar: false, - body: Center( - child: Container( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context).physicalSystemExamination, - fontWeight: FontWeight.bold, - fontSize: 16, - ), - SizedBox( - height: 16, - ), - MasterKeyCheckboxSearchWidget( - model: model, - hintSearchText: - TranslationBase.of(context).searchExamination, - buttonName: - TranslationBase.of(context).addExamination, - masterList: model.physicalExaminationList, - removeHistory: (history) { - setState(() { - widget.removeExamination(history); - }); - }, - addHistory: (history) { - setState(() { - MySelectedExamination mySelectedExamination = - new MySelectedExamination( - selectedExamination: history); - widget.mySelectedExamination - .add(mySelectedExamination); - }); - }, - addSelectedHistories: () { - widget.addSelectedExamination(); - }, - isServiceSelected: (master) => - isServiceSelected(master), - ), - ]), - ))), - )), - ); - } - - isServiceSelected(MasterKeyModel masterKey) { - Iterable exam = widget.mySelectedExamination.where( - (element) => - masterKey.id == element.selectedExamination.id && - masterKey.typeId == element.selectedExamination.typeId); - if (exam.length > 0) { - return true; - } - return false; - } -} diff --git a/lib/widgets/patients/profile/soap_update/update_soap_index.dart b/lib/widgets/patients/profile/soap_update/update_soap_index.dart index 95d03cec..d6f75ad5 100644 --- a/lib/widgets/patients/profile/soap_update/update_soap_index.dart +++ b/lib/widgets/patients/profile/soap_update/update_soap_index.dart @@ -9,7 +9,7 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/steps_widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/update_assessment_page.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/update_objective_page.dart'; +import 'file:///C:/Users/admin/AndroidStudioProjects/doctor_app_flutter/lib/widgets/patients/profile/soap_update/objective/update_objective_page.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/update_plan_page.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; diff --git a/lib/widgets/shared/app-textfield-custom.dart b/lib/widgets/shared/app-textfield-custom.dart index 5cc6c417..caeb7ea2 100644 --- a/lib/widgets/shared/app-textfield-custom.dart +++ b/lib/widgets/shared/app-textfield-custom.dart @@ -9,6 +9,7 @@ class AppTextFieldCustom extends StatefulWidget { final String hintText; final TextEditingController controller; final bool isDropDown; + final bool hasBorder; final String dropDownText; final Icon suffixIcon; final Color dropDownColor; @@ -17,12 +18,14 @@ class AppTextFieldCustom extends StatefulWidget { final int minLines; final int maxLines; final List inputFormatters; + final Function(String) onChanged; AppTextFieldCustom({ this.height = 0, this.onClick, this.hintText, this.controller, + this.hasBorder = true, this.isDropDown = false, this.dropDownText, this.suffixIcon, @@ -32,6 +35,7 @@ class AppTextFieldCustom extends StatefulWidget { this.minLines = 1, this.maxLines = 1, this.inputFormatters, + this.onChanged, }); @override @@ -43,8 +47,9 @@ class _AppTextFieldCustomState extends State { Widget build(BuildContext context) { return Container( height: widget.height != 0 ? widget.height : null, - decoration: - containerBorderDecoration(Color(0Xffffffff), Color(0xFFEFEFEF)), + decoration: widget.hasBorder + ? containerBorderDecoration(Color(0Xffffffff), Color(0xFFEFEFEF)) + : null, padding: EdgeInsets.only(top: 4.0, bottom: 4.0, left: 8.0, right: 8.0), child: InkWell( onTap: widget.onClick ?? null, @@ -80,7 +85,17 @@ class _AppTextFieldCustomState extends State { enabled: widget.enabled, minLines: widget.minLines, maxLines: widget.maxLines, - inputFormatters: widget.inputFormatters != null ? widget.inputFormatters : [], + inputFormatters: widget.inputFormatters != null + ? widget.inputFormatters + : [], + onChanged: (value) { + if (widget.onChanged != null){ + widget.onChanged(value); + setState(() { + + }); + } + }, ) : AppText( widget.dropDownText,