From bcf7e736d50ab29ecbc2700ce6412a9f38ab89d8 Mon Sep 17 00:00:00 2001 From: franzap <_@franzap.com> Date: Mon, 9 Dec 2024 14:57:04 -0300 Subject: [PATCH] Install button, better indication when not ready --- lib/widgets/install_button.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/widgets/install_button.dart b/lib/widgets/install_button.dart index 4d43f8c..2f81bdf 100644 --- a/lib/widgets/install_button.dart +++ b/lib/widgets/install_button.dart @@ -61,13 +61,15 @@ class InstallButton extends HookConsumerWidget { builder: (context) => InstallAlertDialog(app: app), ); } - } else { + } else if (app.canUpdate) { app.install().catchError((e) { if (context.mounted) { context.showError( title: 'Could not install', description: e.message); } }); + } else { + // no action } }, ErrorInstallProgress(:final e, :final info, :final actions) => () { @@ -93,7 +95,9 @@ class InstallButton extends HookConsumerWidget { backgroundColor: switch (progress) { ErrorInstallProgress() => Colors.red, IdleInstallProgress() => - app.hasCertificateMismatch ? Colors.grey : kUpdateColor, + (!app.canInstall && !app.canUpdate || app.hasCertificateMismatch) + ? Colors.grey + : kUpdateColor, _ => kUpdateColor, }, progressColor: Colors.blue[800],