add prompt confirmation and update carton
This commit is contained in:
@@ -94,9 +94,13 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
||||
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,
|
||||
@@ -271,4 +275,20 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
isDataChanged() {
|
||||
if (_isNew) {
|
||||
var mainModel = Provider.of<MainModel>(context, listen: false);
|
||||
return _shipmentNumberController.text != "" ||
|
||||
_cutoffDateController.text != "" ||
|
||||
_arrivalDateController.text != "" ||
|
||||
_consigneeController.text != "" ||
|
||||
_portController.text != "" ||
|
||||
_destinationController.text != "" ||
|
||||
_currentShipmentType != mainModel.setting.shipmentTypes[0];
|
||||
} else {
|
||||
FcsShipment fcsShipment = _getPayload();
|
||||
return widget.shipment.isChangedForEdit(fcsShipment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user