add prompt confirmation and update carton
This commit is contained in:
@@ -107,9 +107,13 @@ class _DeliveryAddressEditorState extends State<DeliveryAddressEditor> {
|
||||
leading: new IconButton(
|
||||
icon: new Icon(CupertinoIcons.back, color: primaryColor),
|
||||
onPressed: () {
|
||||
showConfirmDialog(context, "back.button_confirm", () {
|
||||
if (isDataChanged()) {
|
||||
showConfirmDialog(context, "back.button_confirm", () {
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
} else {
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
backgroundColor: Colors.white,
|
||||
@@ -252,4 +256,18 @@ class _DeliveryAddressEditorState extends State<DeliveryAddressEditor> {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
isDataChanged() {
|
||||
if (_isNew) {
|
||||
return _nameController.text != "" ||
|
||||
_phoneController.text != "" ||
|
||||
_address1Controller.text != "" ||
|
||||
_address2Controller.text != "" ||
|
||||
_cityController.text != "Yangon" ||
|
||||
_stateController.text != "Yangon";
|
||||
} else {
|
||||
DeliveryAddress deliveryAddress = _getPayload();
|
||||
return widget.deliveryAddress.isChangedForEdit(deliveryAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user