diff --git a/lib/app/cubits/repo_creation.dart b/lib/app/cubits/repo_creation.dart index 7a2c89d5..62a9d665 100644 --- a/lib/app/cubits/repo_creation.dart +++ b/lib/app/cubits/repo_creation.dart @@ -155,19 +155,22 @@ class RepoCreationCubit extends Cubit with AppLogger { return; } - await _loading(() async { - final accessMode = await token.mode; - final suggestedName = await token.suggestedName; - final useCacheServers = - await reposCubit.cacheServers.isEnabledForShareToken(token); - - emit(state.copyWith( - accessMode: accessMode, - suggestedName: suggestedName, - token: token, - useCacheServers: useCacheServers, - )); - }); + await _loading( + () async { + final accessMode = await token.mode; + final suggestedName = await token.suggestedName; + final useCacheServers = + await reposCubit.cacheServers.isEnabledForShareToken(token); + + emit(state.copyWith( + accessMode: accessMode, + suggestedName: suggestedName, + token: token, + useCacheServers: useCacheServers, + )); + }, + showLoading: true, + ); } void acceptSuggestedName() { @@ -255,10 +258,15 @@ class RepoCreationCubit extends Cubit with AppLogger { } } - Future _loading(Future Function() f) async { + Future _loading( + Future Function() f, { + bool showLoading = false, + }) async { try { emit(state.copyWith(loading: true)); - return await Dialogs.executeFutureWithLoadingDialog(null, f.call()); + return showLoading + ? await Dialogs.executeFutureWithLoadingDialog(null, f.call()) + : await f(); } finally { emit(state.copyWith(loading: false)); }