add prompt confirmation and update carton
This commit is contained in:
@@ -150,9 +150,13 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
|
||||
icon:
|
||||
new Icon(CupertinoIcons.back, color: primaryColor, size: 30),
|
||||
onPressed: () {
|
||||
showConfirmDialog(context, "back.button_confirm", () {
|
||||
if (isDataChanged()) {
|
||||
showConfirmDialog(context, "back.button_confirm", () {
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
} else {
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
shadowColor: Colors.transparent,
|
||||
@@ -253,4 +257,22 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
isDataChanged() {
|
||||
if (_isNew) {
|
||||
return _trackingIDCtl.text != "" ||
|
||||
_remarkCtl.text != "" ||
|
||||
user != null ||
|
||||
_multiImgController.getAddedFile.isNotEmpty;
|
||||
} else {
|
||||
var _package = Package(
|
||||
trackingID: _trackingIDCtl.text,
|
||||
remark: _remarkCtl.text,
|
||||
fcsID: user.fcsID,
|
||||
photoUrls: widget.package.photoUrls);
|
||||
return widget.package.isChangedForEdit(_package) ||
|
||||
_multiImgController.getAddedFile.isNotEmpty ||
|
||||
_multiImgController.getDeletedUrl.isNotEmpty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user