From d9878598656793107f3190a8cc6a57856597723c Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Thu, 8 Apr 2021 11:39:51 +0300 Subject: [PATCH] make allergies as expandable widget --- lib/icons_app/config.json | 3 +- .../subjective/update_subjective_page.dart | 3 +- lib/widgets/shared/app_drawer_widget.dart | 21 +- ..._key_checkbox_search_allergies_widget.dart | 206 +++++++++++++++++- 4 files changed, 219 insertions(+), 14 deletions(-) diff --git a/lib/icons_app/config.json b/lib/icons_app/config.json index dfd00326..d215cdc1 100644 --- a/lib/icons_app/config.json +++ b/lib/icons_app/config.json @@ -2301,5 +2301,4 @@ ] } ] - } -} \ No newline at end of file + } \ No newline at end of file diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart b/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart index a5f8bfad..2d475624 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart @@ -205,10 +205,11 @@ class _UpdateSubjectivePageState extends State { doctorID: ''); await model.getPatientChiefComplaint(getChiefComplaintReqModel); if (model.patientChiefComplaintList.isNotEmpty) { + isChiefExpand = true; complaintsController.text = helpers.parseHtmlString( model.patientChiefComplaintList[0].chiefComplaint); illnessController.text = model.patientChiefComplaintList[0].hopi; - medicationController.text = model.patientChiefComplaintList[0].currentMedication + '\n \n'; + medicationController.text =!(model.patientChiefComplaintList[0].currentMedication).isNotEmpty ? model.patientChiefComplaintList[0].currentMedication + '\n \n':model.patientChiefComplaintList[0].currentMedication; } await getHistory(model); diff --git a/lib/widgets/shared/app_drawer_widget.dart b/lib/widgets/shared/app_drawer_widget.dart index 43106db1..41d58931 100644 --- a/lib/widgets/shared/app_drawer_widget.dart +++ b/lib/widgets/shared/app_drawer_widget.dart @@ -98,7 +98,7 @@ class _AppDrawerState extends State { // " or " + // TranslationBase.of(context).leaves, - DoctorApp.leaves, + DoctorApp.reschedule__1, // subTitle: , ), onTap: () { @@ -121,15 +121,6 @@ class _AppDrawerState extends State { margin: EdgeInsets.symmetric(horizontal: 20), child: Column( children: [ - InkWell( - child: DrawerItem( - TranslationBase.of(context).logout, Icons.settings), - onTap: () async { - Navigator.pop(context); - await helpers.logout(); - projectsProvider.isLogin = false; - }, - ), InkWell( child: DrawerItem( projectsProvider.isArabic @@ -143,6 +134,16 @@ class _AppDrawerState extends State { projectsProvider.changeLanguage('ar'); }, ), + InkWell( + child: DrawerItem( + TranslationBase.of(context).logout, DoctorApp.logout_1), + onTap: () async { + Navigator.pop(context); + await helpers.logout(); + projectsProvider.isLogin = false; + }, + ), + ], ), ), diff --git a/lib/widgets/shared/master_key_checkbox_search_allergies_widget.dart b/lib/widgets/shared/master_key_checkbox_search_allergies_widget.dart index e7e15076..497f35c2 100644 --- a/lib/widgets/shared/master_key_checkbox_search_allergies_widget.dart +++ b/lib/widgets/shared/master_key_checkbox_search_allergies_widget.dart @@ -14,6 +14,7 @@ import 'package:provider/provider.dart'; import 'app_texts_widget.dart'; import 'dialogs/master_key_dailog.dart'; +import 'expandable-widget-header-body.dart'; class MasterKeyCheckboxSearchAllergiesWidget extends StatefulWidget { final SOAPViewModel model; @@ -118,7 +119,210 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState .selectedAllergySeverity .nameEn : null : null); - return Column( + return HeaderBodyExpandableNotifier( + headerWidget: InkWell( + onTap: () { + setState(() { + if (widget.isServiceSelected( + items[index])) { + widget + .removeAllergy( + items[index]); + } else { + // TODO add Allergy + + MySelectedAllergy + mySelectedAllergy = + new MySelectedAllergy( + selectedAllergy: + items[index], + selectedAllergySeverity: + _selectedAllergySeverity, + remark: null, + isChecked: true); + widget.addAllergy( + mySelectedAllergy); + } + }); + }, + child: Row( + children: [ + Checkbox( + value: widget + .isServiceSelected( + items[index]), + activeColor: + Colors.red[800], + onChanged: (bool newValue) { + // setState(() { + // if (widget + // .isServiceSelected(items[index])) { + // widget.removeHistory(items[index]); + // } else { + // widget.addHistory(items[index]); + // } + // }); + }), + Expanded( + child: Padding( + padding: const EdgeInsets + .symmetric( + horizontal: 10, + vertical: 0), + child: AppText( + projectViewModel.isArabic + ? items[index] + .nameAr != + "" + ? items[index] + .nameAr + : items[index] + .nameEn + : items[index].nameEn, + color: Color(0xFF575757), + fontSize: 16, + fontWeight: + FontWeight.w600, + ), + ), + ), + InkWell( + // onTap: onTap, + child: Icon( + isSelected ? EvaIcons.arrowIosUpwardOutline: EvaIcons.arrowIosDownwardOutline)) + ], + ), + ), + bodyWidget: isSelected?Column(children: [ + TextFields( + onTapTextFields: widget.model + .allergySeverityList != + null + ? () { + MasterKeyDailog dialog = + MasterKeyDailog( + list: widget.model + .allergySeverityList, + okText: + TranslationBase.of( + context) + .ok, + okFunction: + (selectedValue) { + setState(() { + mySelectedAllergy + .selectedAllergySeverity = + selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: + false, + context: context, + builder: (BuildContext + context) { + return dialog; + }, + ); + } + : null, + hasLabelText: + mySelectedAllergy + .selectedAllergySeverity != + null + ? true + : false, + showLabelText: true, + hintText: + TranslationBase + .of(context) + .selectSeverity, + fontSize: 13.5, + readOnly: true, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 2, + minLines: 1, + controller: severityController, + validator: (value) { + if (value == null) + return TranslationBase + .of( + context) + .emptyMessage; + else + return null; + }), + SizedBox( + height: 5, + ), + if(isSubmitted && + mySelectedAllergy + .selectedAllergySeverity == null) + Row( + + children: [ + CustomValidationError(), + ], + mainAxisAlignment: MainAxisAlignment.start, + ), + + SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.only( + left: 0, right: 0, top: 15), + child: TextFields( + hasLabelText: + remarkController.text != + '' + ? true + : false, + showLabelText: true, + hintText: TranslationBase + .of( + context) + .remarks, + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 25, + minLines: 10, + initialValue: isSelected + ? mySelectedAllergy + .remark : '', + // controller: remarkControlle + + onChanged: (value) { + if (isSelected) { + mySelectedAllergy + .remark = value; + }; + }, + + validator: (value) { + if (value == null) + return TranslationBase + .of( + context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 10, + ), + ],):Column(), + isExpand: isSelected, + ); + + + + + Column( children: [ InkWell( onTap: () {