bug fixing

merge-requests/309/head
hussam al-habibeh 5 years ago
parent bd69219a86
commit 8bf578082b

@ -210,20 +210,21 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
NetworkBaseView(
baseViewModel: model,
child: GestureDetector(
onTap: (){
onTap: () {
FocusScope.of(context).requestFocus(new FocusNode());
},
child: DraggableScrollableSheet(
initialChildSize: 0.90,
maxChildSize: 0.90,
minChildSize: 0.9,
builder: (BuildContext context, ScrollController scrollController) {
builder:
(BuildContext context, ScrollController scrollController) {
return SingleChildScrollView(
child: Container(
height: 1010,
child: Padding(
padding:
EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0),
padding: EdgeInsets.symmetric(
horizontal: 12.0, vertical: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
//mainAxisAlignment: MainAxisAlignment.spaceEvenly,
@ -247,8 +248,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
child: InkWell(
onTap: model.allMedicationList != null
? () {
Helpers.hideKeyboard(context);
setState(() {
Helpers.hideKeyboard(context);
setState(() {
_selectedMedication = null;
});
}
@ -267,8 +268,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
true,
),
itemSubmitted: (item) => setState(
() =>
_selectedMedication = item),
() => _selectedMedication =
item),
key: key,
suggestions:
model.allMedicationList,
@ -278,19 +279,18 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
child: Texts(suggestion
.description +
'/' +
suggestion.genericName),
suggestion
.genericName),
padding:
EdgeInsets.all(8.0)),
itemSorter: (a, b) => 1,
itemFilter: (suggestion, input) =>
suggestion.genericName
.toLowerCase()
.startsWith(
input.toLowerCase()) ||
suggestion.genericName.toLowerCase().startsWith(
input.toLowerCase()) ||
suggestion.description
.toLowerCase()
.startsWith(
input.toLowerCase()) ||
.startsWith(input
.toLowerCase()) ||
suggestion.keywords
.toLowerCase()
.startsWith(
@ -338,17 +338,20 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
child: Row(
children: [
Container(
width:
MediaQuery.of(context).size.width *
0.550,
width: MediaQuery.of(context)
.size
.width *
0.550,
child: TextFields(
inputFormatters: [
LengthLimitingTextInputFormatter(4),
LengthLimitingTextInputFormatter(
4),
WhitelistingTextInputFormatter
.digitsOnly
],
hintText: TranslationBase.of(context)
.strength,
hintText:
TranslationBase.of(context)
.strength,
controller: strengthController,
keyboardType: TextInputType.number,
onChanged: (String value) {
@ -375,40 +378,49 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
width: 10.0,
),
Container(
width:
MediaQuery.of(context).size.width *
0.350,
width: MediaQuery.of(context)
.size
.width *
0.350,
child: InkWell(
onTap: model.medicationStrengthList !=
null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
ListSelectDialog(
list: model
.medicationStrengthList,
attributeName: 'nameEn',
attributeValueId: 'id',
okText: TranslationBase.of(
context)
.ok,
okFunction:
(selectedValue) {
setState(() {
units = selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
onTap:
model.medicationStrengthList !=
null
? () {
Helpers.hideKeyboard(
context);
ListSelectDialog
dialog =
ListSelectDialog(
list: model
.medicationStrengthList,
attributeName:
'nameEn',
attributeValueId:
'id',
okText:
TranslationBase.of(
context)
.ok,
okFunction:
(selectedValue) {
setState(() {
units =
selectedValue;
});
},
);
showDialog(
barrierDismissible:
false,
context: context,
builder: (BuildContext
context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration:
textFieldSelectorDecoration(
@ -430,8 +442,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
child: InkWell(
onTap: model.medicationRouteList != null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
ListSelectDialog(
list: model.medicationRouteList,
attributeName: 'nameEn',
@ -452,7 +464,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
builder:
(BuildContext context) {
return dialog;
},
);
@ -473,13 +486,14 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: model.medicationFrequencyList != null
onTap: model.medicationFrequencyList !=
null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
ListSelectDialog(
list:
model.medicationFrequencyList,
list: model
.medicationFrequencyList,
attributeName: 'nameEn',
attributeValueId: 'id',
okText:
@ -494,7 +508,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
builder:
(BuildContext context) {
return dialog;
},
);
@ -502,7 +517,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context).frequency,
TranslationBase.of(context)
.frequency,
frequency != null
? frequency['nameEn']
: null,
@ -515,13 +531,14 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: model.medicationDoseTimeList != null
onTap: model.medicationDoseTimeList !=
null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
ListSelectDialog(
list:
model.medicationDoseTimeList,
list: model
.medicationDoseTimeList,
attributeName: 'nameEn',
attributeValueId: 'id',
okText:
@ -536,7 +553,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
builder:
(BuildContext context) {
return dialog;
},
);
@ -544,7 +562,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context).doseTime,
TranslationBase.of(context)
.doseTime,
doseTime != null
? doseTime['nameEn']
: null,
@ -561,18 +580,19 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
child: InkWell(
onTap: indicationList != null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
ListSelectDialog(
list: indicationList,
attributeName: 'name',
attributeValueId: 'id',
okText:
TranslationBase.of(context)
.ok,
okText: TranslationBase.of(
context)
.ok,
okFunction: (selectedValue) {
setState(() {
indication = selectedValue;
indication =
selectedValue;
});
},
);
@ -587,14 +607,15 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
model.patientAssessmentList[0]
.icdCode10ID
.toString(),
indication != null
? indication['name']
: null,
true),
decoration:
textFieldSelectorDecoration(
model.patientAssessmentList[0]
.icdCode10ID
.toString(),
indication != null
? indication['name']
: null,
true),
enabled: true,
readOnly: true,
),
@ -660,7 +681,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
child: TextField(
decoration:
Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).date,
TranslationBase.of(context)
.date,
selectedDate != null
? "${DateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
: null,
@ -677,13 +699,14 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: model.medicationDurationList != null
onTap: model.medicationDurationList !=
null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
ListSelectDialog(
list:
model.medicationDurationList,
list: model
.medicationDurationList,
attributeName: 'nameEn',
attributeValueId: 'id',
okText:
@ -698,7 +721,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
builder:
(BuildContext context) {
return dialog;
},
);
@ -706,7 +730,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context).duration,
TranslationBase.of(context)
.duration,
duration != null
? duration['nameEn']
: null,
@ -726,8 +751,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
child: TextFields(
maxLines: 6,
minLines: 4,
hintText:
TranslationBase.of(context).instruction,
hintText: TranslationBase.of(context)
.instruction,
controller: instructionController,
//keyboardType: TextInputType.number,
validator: (value) {
@ -763,90 +788,93 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
"Please Fill All Fields");
return;
}
if (int.parse(
strengthController.text) >
1000) {
DrAppToastMsg.showErrorToast(
"1000 is the MAX for the strength");
return;
}
if (int.parse(
strengthController.text) >
1000) {
DrAppToastMsg.showErrorToast(
"1000 is the MAX for the strength");
return;
}
if (formKey.currentState.validate()) {
Navigator.pop(context);
{
// var x = model
// .patientAssessmentList
// .map((value) =>
// value.icdCode10ID)
// .toList()
// .join(',');
postProcedure(
icdCode: model
.patientAssessmentList[
0]
.icdCode10ID
.isEmpty
? "test"
: model
.patientAssessmentList[
0]
.icdCode10ID
.toString(),
// icdCode: model
if (formKey.currentState
.validate()) {
Navigator.pop(context);
{
// var x = model
// .patientAssessmentList
// .map((value) => value
// .icdCode10ID
// .trim())
// .map((value) =>
// value.icdCode10ID)
// .toList()
// .join(' '),
dose: strengthController.text,
doseUnit:
units['id'].toString(),
patient: widget.patient,
doseTimeIn:
doseTime['id'].toString(),
model: widget.model,
duration:
duration['id'].toString(),
frequency:
frequency['id'].toString(),
route: route['id'].toString(),
drugId: _selectedMedication
.itemId
.toString(),
strength:
strengthController.text,
indication:
indicationController.text,
instruction:
instructionController.text,
doseTime: selectedDate,
);
// .join(',');
postProcedure(
icdCode: model
.patientAssessmentList[
0]
.icdCode10ID
.isEmpty
? "test"
: model
.patientAssessmentList[
0]
.icdCode10ID
.toString(),
// icdCode: model
// .patientAssessmentList
// .map((value) => value
// .icdCode10ID
// .trim())
// .toList()
// .join(' '),
dose: strengthController.text,
doseUnit:
units['id'].toString(),
patient: widget.patient,
doseTimeIn:
doseTime['id'].toString(),
model: widget.model,
duration:
duration['id'].toString(),
frequency: frequency['id']
.toString(),
route: route['id'].toString(),
drugId: _selectedMedication
.itemId
.toString(),
strength:
strengthController.text,
indication:
indicationController.text,
instruction:
instructionController
.text,
doseTime: selectedDate,
);
}
}
}
{
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) =>
// NewPrescriptionScreen()),
// );
}
},
),
],
{
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) =>
// NewPrescriptionScreen()),
// );
}
},
),
],
),
),
),
],
],
),
),
),
),
],
],
),
),
),
),
);
}),
);
}),
),
),
);
}

Loading…
Cancel
Save