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

Loading…
Cancel
Save