2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-13 10:45:29 +00:00

Add snackbar with icon

- stock adjust
- part edit
- location edit
This commit is contained in:
Oliver Walters
2021-02-10 23:51:38 +11:00
parent ce2a866384
commit c8c056f96d
7 changed files with 154 additions and 34 deletions

View File

@ -161,7 +161,39 @@ void hideProgressDialog(BuildContext context) {
Navigator.pop(context);
}
void showFormDialog(BuildContext context, String title, {GlobalKey<FormState> key, List<Widget> fields, List<Widget> actions}) {
void showFormDialog(BuildContext context, String title, {GlobalKey<FormState> key, List<Widget> fields, List<Widget> actions, Function callback}) {
// Undefined actions = OK + Cancel
if (actions == null) {
actions = <Widget>[
FlatButton(
child: Text(I18N.of(context).cancel),
onPressed: () {
// Close the form
Navigator.pop(context);
}
),
FlatButton(
child: Text(I18N.of(context).save),
onPressed: () {
if (key.currentState.validate()) {
key.currentState.save();
// Close the dialog
Navigator.pop(context);
// Callback
if (callback != null) {
callback();
}
}
}
)
];
}
showDialog(
context: context,
builder: (BuildContext context) {