Skip to content

Commit

Permalink
fix: Remove unnecessary loading spinner
Browse files Browse the repository at this point in the history
  • Loading branch information
spydon committed Jul 17, 2024
1 parent 88984e3 commit 54bf7b6
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions packages/app_center/lib/manage/manage_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -238,42 +238,31 @@ 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,
runSpacing: 10,
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,
),
Expand Down

0 comments on commit 54bf7b6

Please sign in to comment.