2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-28 05:26:47 +00:00

Improve functionality of showErrorDialog function

- Provide callback for when the dialog is dismissed
- Optionally set the error title bar
This commit is contained in:
Oliver Walters 2020-05-26 23:40:20 +10:00
parent baed2d98c6
commit 6102b39e9d

View File

@ -9,12 +9,12 @@ void showMessage(BuildContext context, String message) {
));
}
void showErrorDialog(BuildContext context, String title, String description) {
Future<void> showErrorDialog(BuildContext context, String title, String description, {String error = "Error", Function onDismissed}) async {
showDialog(
context: context,
child: SimpleDialog(
title: ListTile(
title: Text("Error"),
title: Text(error),
leading: FaIcon(FontAwesomeIcons.exclamationCircle),
),
children: <Widget>[
@ -24,7 +24,11 @@ void showErrorDialog(BuildContext context, String title, String description) {
)
]
)
);
).then((value) {
if (onDismissed != null) {
onDismissed();
}
});
}
void showProgressDialog(BuildContext context, String title, String description) {