Design inhancment

merge-requests/319/head
hussam al-habibeh 5 years ago
parent 0f15732728
commit ae17998e0a

@ -360,12 +360,12 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
.width * .width *
0.550, 0.550,
child: TextFields( child: TextFields(
// inputFormatters: [ inputFormatters: [
// LengthLimitingTextInputFormatter( LengthLimitingTextInputFormatter(
// 4), 4),
// WhitelistingTextInputFormatter // WhitelistingTextInputFormatter
// .digitsOnly // .digitsOnly
// ], ],
hintText: hintText:
TranslationBase.of(context) TranslationBase.of(context)
.strength, .strength,

@ -115,7 +115,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
(BuildContext context, StateSetter setState /*You can rename this!*/) { (BuildContext context, StateSetter setState /*You can rename this!*/) {
return BaseView<MedicineViewModel>( return BaseView<MedicineViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
await model.getMedicationList(); //await model.getMedicationList();
await model.getMedicationStrength(); await model.getMedicationStrength();
await model.getMedicationDuration(); await model.getMedicationDuration();
await model.getMedicationRoute(); await model.getMedicationRoute();
@ -257,14 +257,17 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
inputFormatters: [ inputFormatters: [
LengthLimitingTextInputFormatter( LengthLimitingTextInputFormatter(
4), 4),
WhitelistingTextInputFormatter // WhitelistingTextInputFormatter
.digitsOnly // .digitsOnly
], ],
hintText: widget.doseStreangth, hintText: widget.doseStreangth,
fontSize: 15.0, fontSize: 15.0,
controller: strengthController, controller: strengthController,
keyboardType: keyboardType: TextInputType
TextInputType.number, .numberWithOptions(
decimal: true,
),
onChanged: (String value) { onChanged: (String value) {
setState(() { setState(() {
strengthChar = value.length; strengthChar = value.length;
@ -700,6 +703,27 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
title: 'update prescription' title: 'update prescription'
.toUpperCase(), .toUpperCase(),
onPressed: () { onPressed: () {
if (int.parse(
strengthController.text) >
1000) {
DrAppToastMsg.showErrorToast(
"1000 is the MAX for the strength");
return;
}
if (int.parse(strengthController
.text) ==
0) {
DrAppToastMsg.showErrorToast(
"Streangth can't be zero");
return;
}
if (strengthController
.text.length >
4) {
DrAppToastMsg.showErrorToast(
"Streangth can't be zero");
return;
}
updatePrescription( updatePrescription(
newStartDate: selectedDate, newStartDate: selectedDate,
newDoseStreangth: newDoseStreangth:

Loading…
Cancel
Save