add prompt confirmation and update carton
This commit is contained in:
@@ -99,11 +99,11 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
_isNew = true;
|
||||
_selectedCartonType = carton_from_packages;
|
||||
_loadFcsShipments();
|
||||
_cartons = [
|
||||
Carton(cartonNumber: "A100B-1#1"),
|
||||
Carton(cartonNumber: "A100B-1#2"),
|
||||
Carton(cartonNumber: "A100B-1#3")
|
||||
];
|
||||
// _cartons = [
|
||||
// Carton(cartonNumber: "A100B-1#1"),
|
||||
// Carton(cartonNumber: "A100B-1#2"),
|
||||
// Carton(cartonNumber: "A100B-1#3")
|
||||
// ];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -382,9 +382,13 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
leading: new IconButton(
|
||||
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,
|
||||
@@ -726,4 +730,12 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
isDataChanged() {
|
||||
if (_isNew) {
|
||||
return _fcsShipment != null || _user != null || _cartons.isNotEmpty;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user