chore: Follow up loading dialog

This commit is contained in:
krille-chan 2024-10-19 09:16:33 +02:00
commit 31907f74de
No known key found for this signature in database
4 changed files with 15 additions and 9 deletions

View file

@ -19,20 +19,23 @@ Future<Result<T>> showFutureLoadingDialog<T>({
String? backLabel,
String Function(dynamic exception)? onError,
bool barrierDismissible = false,
bool delay = true,
}) async {
final futureExec = future();
final resultFuture = ResultFuture(futureExec);
var i = 3;
do {
final result = resultFuture.result;
if (result != null) {
if (result.isError) break;
return result;
if (delay) {
var i = 3;
while (i > 0) {
final result = resultFuture.result;
if (result != null) {
if (result.isError) break;
return result;
}
await Future.delayed(const Duration(milliseconds: 100));
i--;
}
await Future.delayed(const Duration(milliseconds: 100));
i--;
} while (i > 0);
}
final result = await showAdaptiveDialog<Result<T>>(
context: context,