Fix multi dialog issues (#857)

This commit is contained in:
Oliver
2026-07-13 12:57:20 +10:00
committed by GitHub
parent 3647b32cc0
commit 228371e271
+13
View File
@@ -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();
} }