|
|
|
@ -29,7 +29,7 @@ class AddBloodPressurePage extends StatefulWidget {
|
|
|
|
|
{Key key,
|
|
|
|
|
this.bloodSugarDate,
|
|
|
|
|
this.measureTimeSelectedType,
|
|
|
|
|
this.isUpdate=false,
|
|
|
|
|
this.isUpdate = false,
|
|
|
|
|
this.lineItemNo,
|
|
|
|
|
this.model,
|
|
|
|
|
this.bloodSystolicValue,
|
|
|
|
@ -47,6 +47,7 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
|
|
|
|
|
DateTime bloodSugarDate = DateTime.now();
|
|
|
|
|
DateTime timeSugarDate = DateTime.now();
|
|
|
|
|
int measuredArm = 1;
|
|
|
|
|
bool isButtonDisabled = false;
|
|
|
|
|
final List<String> measureTimeEnList = [
|
|
|
|
|
'Left',
|
|
|
|
|
'Right',
|
|
|
|
@ -70,6 +71,7 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
|
|
|
|
|
measuredArm = measureTimeArList.indexOf(widget.measureTimeSelectedType);
|
|
|
|
|
_bloodSystolicValueController.text = widget.bloodSystolicValue;
|
|
|
|
|
_bloodDiastolicValueController.text = widget.bloodDiastolicValue;
|
|
|
|
|
validateForm();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -82,38 +84,42 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
|
|
|
|
|
appBarTitle: widget.isUpdate
|
|
|
|
|
? TranslationBase.of(context).update
|
|
|
|
|
: TranslationBase.of(context).add,
|
|
|
|
|
appBarIcons: widget.isUpdate?[
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: Icon(Icons.delete),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
ConfirmDialog dialog = new ConfirmDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
confirmMessage: 'Remove this measure',
|
|
|
|
|
okText: TranslationBase.of(context).ok,
|
|
|
|
|
cancelText: TranslationBase.of(context).cancel,
|
|
|
|
|
okFunction: () async {
|
|
|
|
|
ConfirmDialog.closeAlertDialog(context);
|
|
|
|
|
appBarIcons: widget.isUpdate
|
|
|
|
|
? [
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: Icon(Icons.delete),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
ConfirmDialog dialog = new ConfirmDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
confirmMessage: 'Remove this measure',
|
|
|
|
|
okText: TranslationBase.of(context).ok,
|
|
|
|
|
cancelText: TranslationBase.of(context).cancel,
|
|
|
|
|
okFunction: () async {
|
|
|
|
|
ConfirmDialog.closeAlertDialog(context);
|
|
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
widget.model
|
|
|
|
|
.deactivateDiabeticStatus(lineItemNo: widget.lineItemNo)
|
|
|
|
|
.then((value) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (widget.model.state == ViewState.ErrorLocal)
|
|
|
|
|
AppToast.showErrorToast(message: widget.model.error);
|
|
|
|
|
else
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
}).catchError((e) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: widget.model.error);
|
|
|
|
|
});
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
widget.model
|
|
|
|
|
.deactivateDiabeticStatus(
|
|
|
|
|
lineItemNo: widget.lineItemNo)
|
|
|
|
|
.then((value) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (widget.model.state == ViewState.ErrorLocal)
|
|
|
|
|
AppToast.showErrorToast(
|
|
|
|
|
message: widget.model.error);
|
|
|
|
|
else
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
}).catchError((e) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: widget.model.error);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
cancelFunction: () => {});
|
|
|
|
|
dialog.showAlertDialog(context);
|
|
|
|
|
},
|
|
|
|
|
cancelFunction: () => {});
|
|
|
|
|
dialog.showAlertDialog(context);
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
]:null,
|
|
|
|
|
)
|
|
|
|
|
]
|
|
|
|
|
: null,
|
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
|
child: Container(
|
|
|
|
@ -127,6 +133,8 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
|
|
|
|
|
hintText: TranslationBase.of(context).systolicAdd,
|
|
|
|
|
controller: _bloodSystolicValueController,
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
maxLength: 3,
|
|
|
|
|
onChanged: (value) => validateForm(),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
@ -135,6 +143,8 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
|
|
|
|
|
hintText: TranslationBase.of(context).diastolicAdd,
|
|
|
|
|
controller: _bloodDiastolicValueController,
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
maxLength: 3,
|
|
|
|
|
onChanged: (value) => validateForm(),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
@ -244,12 +254,16 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
|
|
|
|
|
loading: widget.model.state == ViewState.BusyLocal,
|
|
|
|
|
label: TranslationBase.of(context).save.toUpperCase(),
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
color: isButtonDisabled
|
|
|
|
|
? Colors.grey[900]
|
|
|
|
|
: Colors.grey,
|
|
|
|
|
onTap: () async {
|
|
|
|
|
if (_bloodSystolicValueController.text.isNotEmpty &&
|
|
|
|
|
_bloodDiastolicValueController.text.isNotEmpty) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
|
|
|
|
|
widget.model.addORUpdateDiabtecResult(
|
|
|
|
|
widget.model
|
|
|
|
|
.addORUpdateDiabtecResult(
|
|
|
|
|
isUpdate: widget.isUpdate,
|
|
|
|
|
bloodPressureDate:
|
|
|
|
|
'${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00',
|
|
|
|
@ -258,14 +272,15 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
|
|
|
|
|
systolicePressure:
|
|
|
|
|
_bloodSystolicValueController.text.toString(),
|
|
|
|
|
measuredArm: measuredArm,
|
|
|
|
|
).then((value) {
|
|
|
|
|
)
|
|
|
|
|
.then((value) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if(widget.model.state == ViewState.BusyLocal)
|
|
|
|
|
AppToast.showErrorToast(message: widget.model.error);
|
|
|
|
|
if (widget.model.state == ViewState.BusyLocal)
|
|
|
|
|
AppToast.showErrorToast(message: widget.model.error);
|
|
|
|
|
else
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
;
|
|
|
|
|
}).catchError((e){
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
;
|
|
|
|
|
}).catchError((e) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: widget.model.error);
|
|
|
|
|
});
|
|
|
|
@ -295,9 +310,43 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
|
|
|
|
|
setState(() {
|
|
|
|
|
measureTimeSelectedType = value;
|
|
|
|
|
measuredArm = list.indexOf(value);
|
|
|
|
|
validateForm();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void validateForm() {
|
|
|
|
|
print("_bloodSystolicValueController "+_bloodSystolicValueController.text.length.toString());
|
|
|
|
|
if (measureTimeSelectedType != 'Left Arm' &&
|
|
|
|
|
_bloodSystolicValueController.text.length > 0 &&
|
|
|
|
|
_bloodDiastolicValueController.text.length > 0) {
|
|
|
|
|
setState(() {
|
|
|
|
|
isButtonDisabled = true;
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
setState(() {
|
|
|
|
|
isButtonDisabled = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// if(measureTimeSelectedType == 'Left Arm'){
|
|
|
|
|
// setState(() {
|
|
|
|
|
// isButtonDisabled = false;
|
|
|
|
|
// });
|
|
|
|
|
// }else if(_bloodSystolicValueController.text.length < 0){
|
|
|
|
|
// setState(() {
|
|
|
|
|
// isButtonDisabled = false;
|
|
|
|
|
// });
|
|
|
|
|
// }else if(_bloodDiastolicValueController.text.length < 0){
|
|
|
|
|
// setState(() {
|
|
|
|
|
// isButtonDisabled = false;
|
|
|
|
|
// });
|
|
|
|
|
// }else{
|
|
|
|
|
// setState(() {
|
|
|
|
|
// isButtonDisabled = true;
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|