fix  allergy

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

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

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

Loading…
Cancel
Save