|
|
|
@ -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: () {
|
|
|
|
|