From 54bf7b65e8cf993d22c9eddd7f5f9f377f759738 Mon Sep 17 00:00:00 2001 From: Lukas Klingsbo Date: Wed, 17 Jul 2024 14:21:20 +0200 Subject: [PATCH] fix: Remove unnecessary loading spinner --- .../app_center/lib/manage/manage_page.dart | 25 ++++++------------- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/packages/app_center/lib/manage/manage_page.dart b/packages/app_center/lib/manage/manage_page.dart index 0ea024ca6..e14639ee1 100644 --- a/packages/app_center/lib/manage/manage_page.dart +++ b/packages/app_center/lib/manage/manage_page.dart @@ -238,24 +238,10 @@ class _ActionButtons extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final l10n = AppLocalizations.of(context); final updatesModel = ref.watch(updatesModelProvider); + final localSnapsModel = ref.watch(filteredLocalSnapsProvider); final updateChangeId = ref.watch(updateChangeIdProvider); final hasInternet = updatesModel.value?.hasInternet ?? true; - final (label, icon) = updatesModel.when( - data: (_) => (l10n.managePageCheckForUpdates, const Icon(YaruIcons.sync)), - loading: () => ( - l10n.managePageCheckingForUpdates, - const SizedBox( - height: kCircularProgressIndicatorHeight, - child: YaruCircularProgressIndicator( - strokeWidth: 2, - ), - ), - ), - error: (_, __) => - (l10n.managePageCheckForUpdates, const Icon(YaruIcons.sync)), - ); - final updatesInProgress = !updatesModel.isLoading && updateChangeId != null; return Wrap( spacing: 10, @@ -263,17 +249,20 @@ class _ActionButtons extends ConsumerWidget { crossAxisAlignment: WrapCrossAlignment.center, children: [ PushButton.outlined( - onPressed: updatesInProgress || updatesModel.hasError + onPressed: updatesInProgress || + updatesModel.hasError || + updatesModel.isLoading || + localSnapsModel.isLoading ? null : () => ref.refresh(updatesModelProvider), child: Row( mainAxisSize: MainAxisSize.min, children: [ - icon, + const Icon(YaruIcons.sync), const SizedBox(width: 8), Flexible( child: Text( - label, + l10n.managePageCheckForUpdates, maxLines: 1, overflow: TextOverflow.ellipsis, ),