mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 03:26:24 +00:00
Fix dialog context poppin' issues for stock actions
This commit is contained in:
parent
de9226aab6
commit
d03e1db4c3
2 changed files with 21 additions and 34 deletions
|
|
@ -141,24 +141,30 @@ Future<void> showTimeoutError(BuildContext context) async {
|
|||
await showServerError(I18N.of(context).timeout, I18N.of(context).noResponse);
|
||||
}
|
||||
|
||||
void showFormDialog(String title, {GlobalKey<FormState> key, List<Widget> fields, List<Widget> actions, Function callback}) {
|
||||
void showFormDialog(String title, {String acceptText, String cancelText, GlobalKey<FormState> key, List<Widget> fields, List<Widget> actions, Function callback}) {
|
||||
|
||||
BuildContext dialogContext;
|
||||
|
||||
if (acceptText == null) {
|
||||
acceptText = I18N.of(OneContext().context).save;
|
||||
}
|
||||
|
||||
if (cancelText == null) {
|
||||
cancelText = I18N.of(OneContext().context).cancel;
|
||||
}
|
||||
|
||||
// Undefined actions = OK + Cancel
|
||||
if (actions == null) {
|
||||
actions = <Widget>[
|
||||
FlatButton(
|
||||
child: Text(I18N.of(OneContext().context).cancel),
|
||||
child: Text(cancelText),
|
||||
onPressed: () {
|
||||
|
||||
print("cancel and close the dialog");
|
||||
// Close the form
|
||||
Navigator.pop(dialogContext);
|
||||
}
|
||||
),
|
||||
FlatButton(
|
||||
child: Text(I18N.of(OneContext().context).save),
|
||||
child: Text(acceptText),
|
||||
onPressed: () {
|
||||
if (key.currentState.validate()) {
|
||||
key.currentState.save();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue