mirror of
https://github.com/inventree/inventree-app.git
synced 2026-07-21 03:33:23 +00:00
Fix multi dialog issues (#857)
This commit is contained in:
@@ -224,6 +224,11 @@ Widget _buildErrorContent(String description, APIResponse? response) {
|
||||
);
|
||||
}
|
||||
|
||||
// Track whether an error dialog is currently being displayed,
|
||||
// so that we do not stack multiple error dialogs on top of each other
|
||||
// (e.g. when several API requests fail in quick succession on startup)
|
||||
bool _errorDialogVisible = false;
|
||||
|
||||
/*
|
||||
* Construct an error dialog showing information to the user
|
||||
*
|
||||
@@ -243,6 +248,13 @@ Future<void> showErrorDialog(
|
||||
return;
|
||||
}
|
||||
|
||||
// Do not show a new error dialog if one is already visible
|
||||
if (_errorDialogVisible) {
|
||||
return;
|
||||
}
|
||||
|
||||
_errorDialogVisible = true;
|
||||
|
||||
final Color dialogColor = color ?? COLOR_DANGER;
|
||||
|
||||
OneContext()
|
||||
@@ -263,6 +275,7 @@ Future<void> showErrorDialog(
|
||||
),
|
||||
)
|
||||
.then((value) {
|
||||
_errorDialogVisible = false;
|
||||
if (onDismissed != null) {
|
||||
onDismissed();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user