|
|
|
|
@ -49,7 +49,7 @@ class _AddMedicationState extends State<AddMedication> {
|
|
|
|
|
GetMedicationResponseModel _selectedMedication;
|
|
|
|
|
|
|
|
|
|
GlobalKey key =
|
|
|
|
|
new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
|
|
|
|
|
new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
|
|
|
|
|
bool isFormSubmitted = false;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
@ -57,387 +57,440 @@ class _AddMedicationState extends State<AddMedication> {
|
|
|
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
|
return FractionallySizedBox(
|
|
|
|
|
child: BaseView<SOAPViewModel>(
|
|
|
|
|
onModelReady: (model) async {
|
|
|
|
|
if (model.medicationStrengthList.length == 0) {
|
|
|
|
|
await model.getMasterLookup(
|
|
|
|
|
MasterKeysService.MedicationStrength,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
if (model.medicationFrequencyList.length == 0) {
|
|
|
|
|
await model.getMasterLookup(MasterKeysService.MedicationFrequency);
|
|
|
|
|
}
|
|
|
|
|
if (model.medicationDoseTimeList.length == 0) {
|
|
|
|
|
await model.getMasterLookup(MasterKeysService.MedicationDoseTime);
|
|
|
|
|
}
|
|
|
|
|
if (model.medicationRouteList.length == 0) {
|
|
|
|
|
await model.getMasterLookup(MasterKeysService.MedicationRoute);
|
|
|
|
|
}
|
|
|
|
|
if (model.allMedicationList.length == 0)
|
|
|
|
|
await model.getMedicationList();
|
|
|
|
|
},
|
|
|
|
|
builder: (_, model, w) => AppScaffold(
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
appBar: BottomSheetTitle(
|
|
|
|
|
title: TranslationBase.of(context).addMedication,
|
|
|
|
|
),
|
|
|
|
|
body: Center(
|
|
|
|
|
child: Container(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
onModelReady: (model) async {
|
|
|
|
|
if (model.medicationStrengthList.length == 0) {
|
|
|
|
|
await model.getMasterLookup(
|
|
|
|
|
MasterKeysService.MedicationStrength,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
if (model.medicationFrequencyList.length == 0) {
|
|
|
|
|
await model.getMasterLookup(
|
|
|
|
|
MasterKeysService.MedicationFrequency);
|
|
|
|
|
}
|
|
|
|
|
if (model.medicationDoseTimeList.length == 0) {
|
|
|
|
|
await model.getMasterLookup(MasterKeysService.MedicationDoseTime);
|
|
|
|
|
}
|
|
|
|
|
if (model.medicationRouteList.length == 0) {
|
|
|
|
|
await model.getMasterLookup(MasterKeysService.MedicationRoute);
|
|
|
|
|
}
|
|
|
|
|
if (model.allMedicationList.length == 0)
|
|
|
|
|
await model.getMedicationList();
|
|
|
|
|
},
|
|
|
|
|
builder: (_, model, w) =>
|
|
|
|
|
AppScaffold(
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
appBar: BottomSheetTitle(
|
|
|
|
|
title: TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.addMedication,
|
|
|
|
|
),
|
|
|
|
|
body: Center(
|
|
|
|
|
child: Container(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
|
widthFactor: 0.9,
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Column(
|
|
|
|
|
widthFactor: 0.9,
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ?2:SizeConfig.isHeightShort?2:2),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
// height: screenSize.height * 0.070,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: model.allMedicationList != null
|
|
|
|
|
? () {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedMedication = null;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
child: _selectedMedication == null
|
|
|
|
|
? CustomAutoCompleteTextField(
|
|
|
|
|
isShowError: isFormSubmitted &&
|
|
|
|
|
_selectedMedication == null,
|
|
|
|
|
child: AutoCompleteTextField<
|
|
|
|
|
GetMedicationResponseModel>(
|
|
|
|
|
decoration: TextFieldsUtils
|
|
|
|
|
.textFieldSelectorDecoration(
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.searchMedicineNameHere,
|
|
|
|
|
null,
|
|
|
|
|
true,
|
|
|
|
|
suffixIcon:
|
|
|
|
|
Icons.search),
|
|
|
|
|
itemSubmitted: (item) =>
|
|
|
|
|
setState(() =>
|
|
|
|
|
_selectedMedication =
|
|
|
|
|
item),
|
|
|
|
|
key: key,
|
|
|
|
|
suggestions:
|
|
|
|
|
model.allMedicationList,
|
|
|
|
|
itemBuilder: (context,
|
|
|
|
|
suggestion) =>
|
|
|
|
|
new Padding(
|
|
|
|
|
child: AppText(suggestion
|
|
|
|
|
.description +
|
|
|
|
|
'/' +
|
|
|
|
|
suggestion
|
|
|
|
|
.genericName),
|
|
|
|
|
padding:
|
|
|
|
|
EdgeInsets.all(
|
|
|
|
|
8.0)),
|
|
|
|
|
itemSorter: (a, b) => 1,
|
|
|
|
|
itemFilter: (suggestion,
|
|
|
|
|
input) =>
|
|
|
|
|
suggestion.genericName.toLowerCase().startsWith(input.toLowerCase()) ||
|
|
|
|
|
suggestion.description
|
|
|
|
|
.toLowerCase()
|
|
|
|
|
.startsWith(input
|
|
|
|
|
.toLowerCase()) ||
|
|
|
|
|
suggestion.keywords
|
|
|
|
|
.toLowerCase()
|
|
|
|
|
.startsWith(input
|
|
|
|
|
.toLowerCase()),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: AppTextFieldCustom(
|
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
|
hintText: _selectedMedication !=
|
|
|
|
|
null
|
|
|
|
|
? _selectedMedication
|
|
|
|
|
.description +
|
|
|
|
|
(' (${_selectedMedication.genericName} )')
|
|
|
|
|
: TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.searchMedicineNameHere,
|
|
|
|
|
minLines: 1,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
suffixIcon: IconButton(
|
|
|
|
|
icon: Icon(
|
|
|
|
|
Icons.search,
|
|
|
|
|
color: Colors.grey.shade600,
|
|
|
|
|
)),
|
|
|
|
|
enabled: false,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 5,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
|
enabled: false,
|
|
|
|
|
onClick: model.medicationDoseTimeList !=
|
|
|
|
|
null
|
|
|
|
|
? () {
|
|
|
|
|
MasterKeyDailog dialog =
|
|
|
|
|
MasterKeyDailog(
|
|
|
|
|
list: model
|
|
|
|
|
.medicationDoseTimeList,
|
|
|
|
|
okText:
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.ok,
|
|
|
|
|
selectedValue:
|
|
|
|
|
_selectedMedicationDose,
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedMedicationDose =
|
|
|
|
|
selectedValue;
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: SizeConfig.heightMultiplier * (
|
|
|
|
|
SizeConfig.isHeightVeryShort ?2:SizeConfig.isHeightShort?
|
|
|
|
|
2:2),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
// height: screenSize.height * 0.070,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: model.allMedicationList != null
|
|
|
|
|
? () {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedMedication = null;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
child: _selectedMedication == null
|
|
|
|
|
? CustomAutoCompleteTextField(
|
|
|
|
|
isShowError: isFormSubmitted &&
|
|
|
|
|
_selectedMedication == null,
|
|
|
|
|
child: AutoCompleteTextField<
|
|
|
|
|
GetMedicationResponseModel>(
|
|
|
|
|
decoration: TextFieldsUtils
|
|
|
|
|
.textFieldSelectorDecoration(
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(
|
|
|
|
|
context)
|
|
|
|
|
.searchMedicineNameHere,
|
|
|
|
|
null,
|
|
|
|
|
true,
|
|
|
|
|
suffixIcon:
|
|
|
|
|
Icons.search),
|
|
|
|
|
itemSubmitted: (item) =>
|
|
|
|
|
setState(() =>
|
|
|
|
|
_selectedMedication =
|
|
|
|
|
item),
|
|
|
|
|
key: key,
|
|
|
|
|
suggestions:
|
|
|
|
|
model.allMedicationList,
|
|
|
|
|
itemBuilder: (context,
|
|
|
|
|
suggestion) =>
|
|
|
|
|
new Padding(
|
|
|
|
|
child: AppText(suggestion
|
|
|
|
|
.description +
|
|
|
|
|
'/' +
|
|
|
|
|
suggestion
|
|
|
|
|
.genericName),
|
|
|
|
|
padding:
|
|
|
|
|
EdgeInsets.all(
|
|
|
|
|
8.0)),
|
|
|
|
|
itemSorter: (a, b) => 1,
|
|
|
|
|
itemFilter: (suggestion,
|
|
|
|
|
input) =>
|
|
|
|
|
suggestion.genericName.toLowerCase()
|
|
|
|
|
.startsWith(input.toLowerCase()) ||
|
|
|
|
|
suggestion.description
|
|
|
|
|
.toLowerCase()
|
|
|
|
|
.startsWith(input
|
|
|
|
|
.toLowerCase()) ||
|
|
|
|
|
suggestion.keywords
|
|
|
|
|
.toLowerCase()
|
|
|
|
|
.startsWith(input
|
|
|
|
|
.toLowerCase()),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: AppTextFieldCustom(
|
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
|
hintText: _selectedMedication !=
|
|
|
|
|
null
|
|
|
|
|
? _selectedMedication
|
|
|
|
|
.description +
|
|
|
|
|
(' (${_selectedMedication.genericName} )')
|
|
|
|
|
: TranslationBase
|
|
|
|
|
.of(
|
|
|
|
|
context)
|
|
|
|
|
.searchMedicineNameHere,
|
|
|
|
|
minLines: 1,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
suffixIcon: IconButton(
|
|
|
|
|
icon: Icon(
|
|
|
|
|
Icons.search,
|
|
|
|
|
color: Colors.grey.shade600,
|
|
|
|
|
)),
|
|
|
|
|
enabled: false,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
doseController
|
|
|
|
|
.text = projectViewModel
|
|
|
|
|
.isArabic
|
|
|
|
|
? _selectedMedicationDose
|
|
|
|
|
.nameAr
|
|
|
|
|
: _selectedMedicationDose
|
|
|
|
|
.nameEn;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder:
|
|
|
|
|
(BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase.of(context).doseTime,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
minLines: 1,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
controller: doseController,
|
|
|
|
|
validationError: isFormSubmitted &&
|
|
|
|
|
_selectedMedicationDose == null
|
|
|
|
|
? TranslationBase.of(context)
|
|
|
|
|
.emptyMessage
|
|
|
|
|
: null,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 5,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
|
enabled: false,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
onClick: model.medicationStrengthList !=
|
|
|
|
|
null
|
|
|
|
|
? () {
|
|
|
|
|
MasterKeyDailog dialog =
|
|
|
|
|
MasterKeyDailog(
|
|
|
|
|
list: model
|
|
|
|
|
.medicationStrengthList,
|
|
|
|
|
okText:
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.ok,
|
|
|
|
|
selectedValue:
|
|
|
|
|
_selectedMedicationStrength,
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedMedicationStrength =
|
|
|
|
|
selectedValue;
|
|
|
|
|
if(_selectedMedication != null)
|
|
|
|
|
Column(
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 3,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery
|
|
|
|
|
.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width * 0.7,
|
|
|
|
|
child: AppText(
|
|
|
|
|
_selectedMedication.description +
|
|
|
|
|
(' (${_selectedMedication.genericName} )'),
|
|
|
|
|
color: Color(0xFF575757),
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
letterSpacing: -0.4,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 5,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
|
enabled: false,
|
|
|
|
|
onClick: model.medicationDoseTimeList !=
|
|
|
|
|
null
|
|
|
|
|
? () {
|
|
|
|
|
MasterKeyDailog dialog =
|
|
|
|
|
MasterKeyDailog(
|
|
|
|
|
list: model
|
|
|
|
|
.medicationDoseTimeList,
|
|
|
|
|
okText:
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.ok,
|
|
|
|
|
selectedValue:
|
|
|
|
|
_selectedMedicationDose,
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedMedicationDose =
|
|
|
|
|
selectedValue;
|
|
|
|
|
|
|
|
|
|
strengthController
|
|
|
|
|
.text = projectViewModel
|
|
|
|
|
.isArabic
|
|
|
|
|
? _selectedMedicationStrength
|
|
|
|
|
.nameAr
|
|
|
|
|
: _selectedMedicationStrength
|
|
|
|
|
.nameEn;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder:
|
|
|
|
|
(BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase.of(context).strength,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
minLines: 1,
|
|
|
|
|
controller: strengthController,
|
|
|
|
|
validationError: isFormSubmitted &&
|
|
|
|
|
_selectedMedicationStrength ==
|
|
|
|
|
null
|
|
|
|
|
? TranslationBase.of(context)
|
|
|
|
|
.emptyMessage
|
|
|
|
|
: null,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 5,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 5,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
|
enabled: false,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
onClick: model.medicationRouteList != null
|
|
|
|
|
? () {
|
|
|
|
|
MasterKeyDailog dialog =
|
|
|
|
|
MasterKeyDailog(
|
|
|
|
|
list: model.medicationRouteList,
|
|
|
|
|
selectedValue:
|
|
|
|
|
_selectedMedicationRoute,
|
|
|
|
|
okText:
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.ok,
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedMedicationRoute =
|
|
|
|
|
selectedValue;
|
|
|
|
|
doseController
|
|
|
|
|
.text = projectViewModel
|
|
|
|
|
.isArabic
|
|
|
|
|
? _selectedMedicationDose
|
|
|
|
|
.nameAr
|
|
|
|
|
: _selectedMedicationDose
|
|
|
|
|
.nameEn;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder:
|
|
|
|
|
(BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.doseTime,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
minLines: 1,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
controller: doseController,
|
|
|
|
|
validationError: isFormSubmitted &&
|
|
|
|
|
_selectedMedicationDose == null
|
|
|
|
|
? TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.emptyMessage
|
|
|
|
|
: null,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 5,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
|
enabled: false,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
onClick: model.medicationStrengthList !=
|
|
|
|
|
null
|
|
|
|
|
? () {
|
|
|
|
|
MasterKeyDailog dialog =
|
|
|
|
|
MasterKeyDailog(
|
|
|
|
|
list: model
|
|
|
|
|
.medicationStrengthList,
|
|
|
|
|
okText:
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.ok,
|
|
|
|
|
selectedValue:
|
|
|
|
|
_selectedMedicationStrength,
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedMedicationStrength =
|
|
|
|
|
selectedValue;
|
|
|
|
|
|
|
|
|
|
routeController
|
|
|
|
|
.text = projectViewModel
|
|
|
|
|
.isArabic
|
|
|
|
|
? _selectedMedicationRoute
|
|
|
|
|
.nameAr
|
|
|
|
|
: _selectedMedicationRoute
|
|
|
|
|
.nameEn;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder:
|
|
|
|
|
(BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase.of(context).route,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
minLines: 1,
|
|
|
|
|
controller: routeController,
|
|
|
|
|
validationError: isFormSubmitted &&
|
|
|
|
|
_selectedMedicationRoute == null
|
|
|
|
|
? TranslationBase.of(context)
|
|
|
|
|
.emptyMessage
|
|
|
|
|
: null,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 5,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 5,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
|
onClick: model.medicationFrequencyList !=
|
|
|
|
|
null
|
|
|
|
|
? () {
|
|
|
|
|
MasterKeyDailog dialog =
|
|
|
|
|
MasterKeyDailog(
|
|
|
|
|
list: model
|
|
|
|
|
.medicationFrequencyList,
|
|
|
|
|
okText:
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.ok,
|
|
|
|
|
selectedValue:
|
|
|
|
|
_selectedMedicationFrequency,
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedMedicationFrequency =
|
|
|
|
|
selectedValue;
|
|
|
|
|
strengthController
|
|
|
|
|
.text = projectViewModel
|
|
|
|
|
.isArabic
|
|
|
|
|
? _selectedMedicationStrength
|
|
|
|
|
.nameAr
|
|
|
|
|
: _selectedMedicationStrength
|
|
|
|
|
.nameEn;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder:
|
|
|
|
|
(BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.strength,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
minLines: 1,
|
|
|
|
|
controller: strengthController,
|
|
|
|
|
validationError: isFormSubmitted &&
|
|
|
|
|
_selectedMedicationStrength ==
|
|
|
|
|
null
|
|
|
|
|
? TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.emptyMessage
|
|
|
|
|
: null,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 5,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 5,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
|
enabled: false,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
onClick: model.medicationRouteList != null
|
|
|
|
|
? () {
|
|
|
|
|
MasterKeyDailog dialog =
|
|
|
|
|
MasterKeyDailog(
|
|
|
|
|
list: model.medicationRouteList,
|
|
|
|
|
selectedValue:
|
|
|
|
|
_selectedMedicationRoute,
|
|
|
|
|
okText:
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.ok,
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedMedicationRoute =
|
|
|
|
|
selectedValue;
|
|
|
|
|
|
|
|
|
|
frequencyController
|
|
|
|
|
.text = projectViewModel
|
|
|
|
|
.isArabic
|
|
|
|
|
? _selectedMedicationFrequency
|
|
|
|
|
.nameAr
|
|
|
|
|
: _selectedMedicationFrequency
|
|
|
|
|
.nameEn;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder:
|
|
|
|
|
(BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase.of(context).frequency,
|
|
|
|
|
enabled: false,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
minLines: 1,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
controller: frequencyController,
|
|
|
|
|
validationError: isFormSubmitted &&
|
|
|
|
|
_selectedMedicationFrequency ==
|
|
|
|
|
null
|
|
|
|
|
? TranslationBase.of(context)
|
|
|
|
|
.emptyMessage
|
|
|
|
|
: null,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ?20:SizeConfig.isHeightShort?15:10),
|
|
|
|
|
),
|
|
|
|
|
routeController
|
|
|
|
|
.text = projectViewModel
|
|
|
|
|
.isArabic
|
|
|
|
|
? _selectedMedicationRoute
|
|
|
|
|
.nameAr
|
|
|
|
|
: _selectedMedicationRoute
|
|
|
|
|
.nameEn;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder:
|
|
|
|
|
(BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.route,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
minLines: 1,
|
|
|
|
|
controller: routeController,
|
|
|
|
|
validationError: isFormSubmitted &&
|
|
|
|
|
_selectedMedicationRoute == null
|
|
|
|
|
? TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.emptyMessage
|
|
|
|
|
: null,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 5,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 5,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: Helpers.getTextFieldHeight(),
|
|
|
|
|
onClick: model.medicationFrequencyList !=
|
|
|
|
|
null
|
|
|
|
|
? () {
|
|
|
|
|
MasterKeyDailog dialog =
|
|
|
|
|
MasterKeyDailog(
|
|
|
|
|
list: model
|
|
|
|
|
.medicationFrequencyList,
|
|
|
|
|
okText:
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.ok,
|
|
|
|
|
selectedValue:
|
|
|
|
|
_selectedMedicationFrequency,
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedMedicationFrequency =
|
|
|
|
|
selectedValue;
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
frequencyController
|
|
|
|
|
.text = projectViewModel
|
|
|
|
|
.isArabic
|
|
|
|
|
? _selectedMedicationFrequency
|
|
|
|
|
.nameAr
|
|
|
|
|
: _selectedMedicationFrequency
|
|
|
|
|
.nameEn;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder:
|
|
|
|
|
(BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.frequency,
|
|
|
|
|
enabled: false,
|
|
|
|
|
maxLines: 1,
|
|
|
|
|
minLines: 1,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
controller: frequencyController,
|
|
|
|
|
validationError: isFormSubmitted &&
|
|
|
|
|
_selectedMedicationFrequency ==
|
|
|
|
|
null
|
|
|
|
|
? TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.emptyMessage
|
|
|
|
|
: null,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: SizeConfig.heightMultiplier *
|
|
|
|
|
(SizeConfig.isHeightVeryShort ? 20 : SizeConfig
|
|
|
|
|
.isHeightShort ? 15 : 10),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: model.state != ViewState.Idle
|
|
|
|
|
? Container(
|
|
|
|
|
height: 0,
|
|
|
|
|
)
|
|
|
|
|
: BottomSheetDialogButton(
|
|
|
|
|
label:
|
|
|
|
|
TranslationBase.of(context).addMedication,
|
|
|
|
|
onTap: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
isFormSubmitted = true;
|
|
|
|
|
});
|
|
|
|
|
if (_selectedMedication != null &&
|
|
|
|
|
_selectedMedicationDose != null &&
|
|
|
|
|
_selectedMedicationStrength != null &&
|
|
|
|
|
_selectedMedicationRoute != null &&
|
|
|
|
|
_selectedMedicationFrequency != null) {
|
|
|
|
|
widget.medicationController.text = widget
|
|
|
|
|
.medicationController.text +
|
|
|
|
|
'${_selectedMedication.description} (${TranslationBase.of(context).doseTime} ) ${doseController.text} (${TranslationBase.of(context).strength}) ${strengthController.text} (${TranslationBase.of(context).route}) ${routeController.text} (${TranslationBase.of(context).frequency}) ${frequencyController.text} \n \n';
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: model.state != ViewState.Idle
|
|
|
|
|
? Container(
|
|
|
|
|
height: 0,
|
|
|
|
|
)
|
|
|
|
|
: BottomSheetDialogButton(
|
|
|
|
|
label:
|
|
|
|
|
TranslationBase.of(context).addMedication,
|
|
|
|
|
onTap: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
isFormSubmitted = true;
|
|
|
|
|
});
|
|
|
|
|
if (_selectedMedication != null &&
|
|
|
|
|
_selectedMedicationDose != null &&
|
|
|
|
|
_selectedMedicationStrength != null &&
|
|
|
|
|
_selectedMedicationRoute != null &&
|
|
|
|
|
_selectedMedicationFrequency != null) {
|
|
|
|
|
widget.medicationController.text = widget
|
|
|
|
|
.medicationController.text +
|
|
|
|
|
'${_selectedMedication.description} (${TranslationBase.of(context).doseTime} ) ${doseController.text} (${TranslationBase.of(context).strength}) ${strengthController.text} (${TranslationBase.of(context).route}) ${routeController.text} (${TranslationBase.of(context).frequency}) ${frequencyController.text} \n \n';
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
,
|
|
|
|
|
)
|
|
|
|
|
,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|