fix carton

This commit is contained in:
2021-01-10 15:56:27 +06:30
parent 83cea10328
commit 4839109280
21 changed files with 201 additions and 162 deletions

View File

@@ -62,11 +62,11 @@ class _ProcesingEditorState extends State<ProcesingEditor> {
)),
IconButton(
icon: Icon(Icons.search, color: primaryColor),
onPressed: () => searchUser(context, callbackUserSelect: (u) {
onPressed: () => searchUser(context, onUserSelect: (u) {
setState(() {
this.consignee = u;
});
})),
}, popPage: true)),
],
);
@@ -104,11 +104,11 @@ class _ProcesingEditorState extends State<ProcesingEditor> {
)),
IconButton(
icon: Icon(Icons.search, color: primaryColor),
onPressed: () => searchUser(context, callbackUserSelect: (u) {
onPressed: () => searchUser(context, onUserSelect: (u) {
setState(() {
this.sender = u;
});
})),
}, popPage: true)),
],
);
@@ -148,7 +148,8 @@ class _ProcesingEditorState extends State<ProcesingEditor> {
),
onPressed: () async {
if (this.consignee == null) {
showMsgDialog(context, "Warning", "Please select 'Consignee'");
showMsgDialog(
context, "Warning", "Please select 'Consignee'");
return;
}
Package _package = await Navigator.push<Package>(
@@ -181,13 +182,7 @@ class _ProcesingEditorState extends State<ProcesingEditor> {
icon:
new Icon(CupertinoIcons.back, color: primaryColor, size: 30),
onPressed: () {
if (isDataChanged()) {
showConfirmDialog(context, "back.button_confirm", () {
Navigator.of(context).pop();
});
} else {
Navigator.of(context).pop();
}
Navigator.of(context).pop();
},
),
shadowColor: Colors.transparent,
@@ -290,16 +285,4 @@ class _ProcesingEditorState extends State<ProcesingEditor> {
});
}
}
isDataChanged() {
if (_isNew) {
return this.packages.isNotEmpty || consignee != null || sender != null;
} else {
Processing _processing = Processing(
userID: consignee.fcsID,
fcsID: sender.fcsID,
packages: this.packages);
return widget.processing.isChangedForEdit(_processing);
}
}
}