fix  allergy

merge-requests/290/head
Elham Rababah 5 years ago
parent 6a5e134527
commit 7505a6b6b0

@ -31,9 +31,6 @@ class UpdateAllergiesWidget extends StatefulWidget {
} }
class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidget> { class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidget> {
TextEditingController remarkController = TextEditingController();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
@ -237,6 +234,9 @@ class _AddAllergiesState extends State<AddAllergies> {
MasterKeyModel _selectedAllergySeverity; MasterKeyModel _selectedAllergySeverity;
MasterKeyModel _selectedAllergy; MasterKeyModel _selectedAllergy;
TextEditingController remarkController = TextEditingController(); TextEditingController remarkController = TextEditingController();
TextEditingController severityController = TextEditingController();
TextEditingController allergyController = TextEditingController();
GlobalKey key = new GlobalKey<AutoCompleteTextFieldState<MasterKeyModel>>(); GlobalKey key = new GlobalKey<AutoCompleteTextFieldState<MasterKeyModel>>();
bool isFormSubmitted = false; bool isFormSubmitted = false;
@ -244,23 +244,27 @@ class _AddAllergiesState extends State<AddAllergies> {
String hintText, String selectedText, bool isDropDown, String hintText, String selectedText, bool isDropDown,
{IconData icon}) { {IconData icon}) {
return InputDecoration( return InputDecoration(
contentPadding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), borderSide: BorderSide(color: Colors.grey, width: 1.0),
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), borderSide: BorderSide(color: Colors.grey, width: 1.0),
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
disabledBorder: OutlineInputBorder( disabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), borderSide: BorderSide(color: Colors.grey, width: 1.0),
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
hintText: selectedText != null ? selectedText : hintText, hintText: selectedText != null ? selectedText : hintText,
suffixIcon: isDropDown ? Icon(icon ?? Icons.arrow_drop_down) : null, suffixIcon: isDropDown ? Icon(icon ?? Icons.arrow_drop_down) : null,
hintStyle: TextStyle( hintStyle: TextStyle(
fontSize: 14, fontSize: 10,
color: Colors.grey.shade600, color: Theme
.of(context)
.hintColor,
fontWeight: FontWeight.w700
), ),
); );
} }
@ -314,6 +318,7 @@ class _AddAllergiesState extends State<AddAllergies> {
? () { ? () {
setState(() { setState(() {
_selectedAllergy = null; _selectedAllergy = null;
allergyController.text = null;
}); });
} }
: null, : null,
@ -326,7 +331,15 @@ class _AddAllergiesState extends State<AddAllergies> {
? _selectedAllergy.nameEn ? _selectedAllergy.nameEn
: null, true, icon: EvaIcons.search), : null, true, icon: EvaIcons.search),
itemSubmitted: (item) => itemSubmitted: (item) =>
setState(() => _selectedAllergy = item), setState(() {
_selectedAllergy = item;
allergyController.text =
projectViewModel.isArabic
? _selectedAllergy
.nameAr
: _selectedAllergy
.nameEn;
}),
key: key, key: key,
suggestions: model.allergiesList, suggestions: model.allergiesList,
itemBuilder: (context, suggestion) => itemBuilder: (context, suggestion) =>
@ -334,27 +347,44 @@ class _AddAllergiesState extends State<AddAllergies> {
child: Texts( child: Texts(
projectViewModel.isArabic ? suggestion projectViewModel.isArabic ? suggestion
.nameAr : suggestion.nameEn), .nameAr : suggestion.nameEn),
padding: EdgeInsets.all(8.0)), padding: EdgeInsets.all(2.0)),
itemSorter: (a, b) => 1, itemSorter: (a, b) => 1,
itemFilter: (suggestion, input) => itemFilter: (suggestion, input) =>
suggestion.nameAr.toLowerCase().startsWith( suggestion.nameAr.toLowerCase().startsWith(
input.toLowerCase()) || input.toLowerCase()) ||
suggestion.nameEn.toLowerCase() suggestion.nameEn.toLowerCase()
.startsWith(input.toLowerCase()), .startsWith(input.toLowerCase()),
) : TextField( ) :
decoration: textFieldSelectorDecoration( TextFields(
TranslationBase onTapTextFields: model.allergiesList != null
? () {
setState(() {
_selectedAllergy = null;
allergyController.text = null;
});
}
: null,
hasLabelText: allergyController.text !=
'' ? true : false,
showLabelText: true,
hintText: TranslationBase
.of(context) .of(context)
.selectAllergy, .selectAllergy,
_selectedAllergy != null fontSize: 13.5,
? projectViewModel.isArabic readOnly: true,
? _selectedAllergy.nameAr fontWeight: FontWeight.w600,
: _selectedAllergy.nameEn maxLines: 2,
: null, minLines: 1,
true, controller: allergyController,
icon: EvaIcons.search), suffixIcon: EvaIcons.search,
enabled: false, validator: (value) {
), if (value == null)
return TranslationBase
.of(context)
.emptyMessage;
else
return null;
})
), ),
), ),
if(isFormSubmitted && _selectedAllergy == null) if(isFormSubmitted && _selectedAllergy == null)
@ -362,10 +392,9 @@ class _AddAllergiesState extends State<AddAllergies> {
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Container( TextFields(
height: screenSize.height * 0.070, onTapTextFields: model
child: InkWell( .allergySeverityList != null
onTap: model.allergySeverityList != null
? () { ? () {
MasterKeyDailog dialog = MasterKeyDailog( MasterKeyDailog dialog = MasterKeyDailog(
list: model.allergySeverityList, list: model.allergySeverityList,
@ -376,6 +405,13 @@ class _AddAllergiesState extends State<AddAllergies> {
setState(() { setState(() {
_selectedAllergySeverity = _selectedAllergySeverity =
selectedValue; selectedValue;
severityController.text =
projectViewModel.isArabic
? _selectedAllergySeverity
.nameAr
: _selectedAllergySeverity
.nameEn;
}); });
}, },
); );
@ -388,21 +424,33 @@ class _AddAllergiesState extends State<AddAllergies> {
); );
} }
: null, : null,
child: TextField( hasLabelText: severityController.text !=
decoration: textFieldSelectorDecoration( '' ? true : false,
TranslationBase showLabelText: true,
hintText: TranslationBase
.of(context) .of(context)
.selectSeverity, .selectSeverity,
_selectedAllergySeverity != null fontSize: 13.5,
? projectViewModel.isArabic?_selectedAllergySeverity.nameAr:_selectedAllergySeverity.nameEn readOnly: true,
: null, // hintColor: Colors.black,
true), fontWeight: FontWeight.w600,
enabled: false, maxLines: 2,
), minLines: 1,
), controller: severityController,
validator: (value) {
if (value == null)
return TranslationBase
.of(context)
.emptyMessage;
else
return null;
}), SizedBox(
height: 5,
), ),
if(isFormSubmitted && _selectedAllergySeverity == null) if(isFormSubmitted &&
_selectedAllergySeverity == null)
CustomValidationError(), CustomValidationError(),
SizedBox( SizedBox(
height: 10, height: 10,
), ),

@ -37,7 +37,7 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
GetPatientProgressNoteResModel patientProgressNote = GetPatientProgressNoteResModel(); GetPatientProgressNoteResModel patientProgressNote = GetPatientProgressNoteResModel();
changePageViewIndex(pageIndex) { changePageViewIndex(pageIndex) {
changeLoadingState(true); if (pageIndex != _currentIndex) changeLoadingState(true);
_controller.jumpToPage(pageIndex); _controller.jumpToPage(pageIndex);
} }

Loading…
Cancel
Save