|
|
|
@ -42,7 +42,8 @@ class AddBloodPressurePage extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
|
|
|
|
|
TextEditingController _bloodSystolicValueController = TextEditingController();
|
|
|
|
|
TextEditingController _bloodDiastolicValueController = TextEditingController();
|
|
|
|
|
TextEditingController _bloodDiastolicValueController =
|
|
|
|
|
TextEditingController();
|
|
|
|
|
DateTime bloodSugarDate = DateTime.now();
|
|
|
|
|
DateTime timeSugarDate = DateTime.now();
|
|
|
|
|
int measuredArm = 1;
|
|
|
|
@ -80,7 +81,9 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
|
|
|
|
|
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
appBarTitle: widget.isUpdate ? TranslationBase.of(context).update : TranslationBase.of(context).add,
|
|
|
|
|
appBarTitle: widget.isUpdate
|
|
|
|
|
? TranslationBase.of(context).update
|
|
|
|
|
: TranslationBase.of(context).add,
|
|
|
|
|
appBarIcons: widget.isUpdate
|
|
|
|
|
? [
|
|
|
|
|
IconButton(
|
|
|
|
@ -96,10 +99,14 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
|
|
|
|
|
ConfirmDialog.closeAlertDialog(context);
|
|
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
widget.model.deactivateDiabeticStatus(lineItemNo: widget.lineItemNo).then((value) {
|
|
|
|
|
widget.model
|
|
|
|
|
.deactivateDiabeticStatus(
|
|
|
|
|
lineItemNo: widget.lineItemNo)
|
|
|
|
|
.then((value) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (widget.model.state == ViewState.ErrorLocal)
|
|
|
|
|
AppToast.showErrorToast(message: widget.model.error);
|
|
|
|
|
AppToast.showErrorToast(
|
|
|
|
|
message: widget.model.error);
|
|
|
|
|
else
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
}).catchError((e) {
|
|
|
|
@ -144,13 +151,17 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
|
|
|
|
|
),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
confirmSelectMeasureTimeDialog(projectViewModel.isArabic ? measureTimeArList : measureTimeEnList);
|
|
|
|
|
confirmSelectMeasureTimeDialog(projectViewModel.isArabic
|
|
|
|
|
? measureTimeArList
|
|
|
|
|
: measureTimeEnList);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.all(12),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 65,
|
|
|
|
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
|
color: Colors.white),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
@ -177,13 +188,17 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
|
|
|
|
|
bloodSugarDate = date;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}, currentTime: bloodSugarDate, locale: projectViewModel.localeType);
|
|
|
|
|
},
|
|
|
|
|
currentTime: bloodSugarDate,
|
|
|
|
|
locale: projectViewModel.localeType);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.all(12),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 65,
|
|
|
|
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
|
color: Colors.white),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
@ -198,22 +213,30 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
|
|
|
|
|
),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
DatePicker.showTimePicker(context, showTitleActions: true, onConfirm: (date) {
|
|
|
|
|
DatePicker.showTimePicker(context, showTitleActions: true,
|
|
|
|
|
onConfirm: (date) {
|
|
|
|
|
setState(
|
|
|
|
|
() {
|
|
|
|
|
timeSugarDate = date;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}, currentTime: timeSugarDate, locale: projectViewModel.localeType);
|
|
|
|
|
},
|
|
|
|
|
currentTime: timeSugarDate,
|
|
|
|
|
locale: projectViewModel.localeType);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.all(12),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 65,
|
|
|
|
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
|
color: Colors.white),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [Texts(TranslationBase.of(context).time), Texts(getTime())],
|
|
|
|
|
children: [
|
|
|
|
|
Texts(TranslationBase.of(context).time),
|
|
|
|
|
Texts(getTime())
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -229,38 +252,44 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
|
|
|
|
|
widthFactor: 0.9,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
SecondaryButton(
|
|
|
|
|
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);
|
|
|
|
|
Container(
|
|
|
|
|
height: 50,
|
|
|
|
|
child: SecondaryButton(
|
|
|
|
|
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(
|
|
|
|
|
isUpdate: widget.isUpdate,
|
|
|
|
|
bloodPressureDate:
|
|
|
|
|
'${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00',
|
|
|
|
|
diastolicPressure: _bloodDiastolicValueController.text.toString(),
|
|
|
|
|
systolicePressure: _bloodSystolicValueController.text.toString(),
|
|
|
|
|
measuredArm: measuredArm,
|
|
|
|
|
)
|
|
|
|
|
.then((value) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (widget.model.state == ViewState.BusyLocal)
|
|
|
|
|
widget.model
|
|
|
|
|
.addORUpdateDiabtecResult(
|
|
|
|
|
isUpdate: widget.isUpdate,
|
|
|
|
|
bloodPressureDate:
|
|
|
|
|
'${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00',
|
|
|
|
|
diastolicPressure:
|
|
|
|
|
_bloodDiastolicValueController.text.toString(),
|
|
|
|
|
systolicePressure:
|
|
|
|
|
_bloodSystolicValueController.text.toString(),
|
|
|
|
|
measuredArm: measuredArm,
|
|
|
|
|
)
|
|
|
|
|
.then((value) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (widget.model.state == ViewState.BusyLocal)
|
|
|
|
|
AppToast.showErrorToast(
|
|
|
|
|
message: widget.model.error);
|
|
|
|
|
else
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
;
|
|
|
|
|
}).catchError((e) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: widget.model.error);
|
|
|
|
|
else
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
;
|
|
|
|
|
}).catchError((e) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: widget.model.error);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -295,7 +324,8 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void validateForm() {
|
|
|
|
|
print("_bloodSystolicValueController " + _bloodSystolicValueController.text.length.toString());
|
|
|
|
|
print("_bloodSystolicValueController " +
|
|
|
|
|
_bloodSystolicValueController.text.length.toString());
|
|
|
|
|
if (measureTimeSelectedType != 'Left Arm' &&
|
|
|
|
|
_bloodSystolicValueController.text.length > 0 &&
|
|
|
|
|
_bloodDiastolicValueController.text.length > 0) {
|
|
|
|
|