mirror of
https://github.com/inventree/inventree-app.git
synced 2026-07-21 11:43:31 +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
|
* Construct an error dialog showing information to the user
|
||||||
*
|
*
|
||||||
@@ -243,6 +248,13 @@ Future<void> showErrorDialog(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do not show a new error dialog if one is already visible
|
||||||
|
if (_errorDialogVisible) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_errorDialogVisible = true;
|
||||||
|
|
||||||
final Color dialogColor = color ?? COLOR_DANGER;
|
final Color dialogColor = color ?? COLOR_DANGER;
|
||||||
|
|
||||||
OneContext()
|
OneContext()
|
||||||
@@ -263,6 +275,7 @@ Future<void> showErrorDialog(
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
.then((value) {
|
.then((value) {
|
||||||
|
_errorDialogVisible = false;
|
||||||
if (onDismissed != null) {
|
if (onDismissed != null) {
|
||||||
onDismissed();
|
onDismissed();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user