refactor(ui): make the status chip the only update entry

Remove the update button from the detail actions; the green chip next
to the extension title opens the update dialog on cards, the desktop
drawer and the mobile details page alike.
This commit is contained in:
Levi committed 2026-09-19 20:49:20 +08:00
1 parent 948f6d5487
commit 04ebca60cf
4 files changed
+16 -13

No files matched your search

@@ -8,6 +8,7 @@ import '../../../../shared/theme/app_palette.dart';
import '../../../../shared/widgets/detail/app_detail_surface.dart';
import '../../application/extensions_controller.dart';
import '../widgets/extension_detail_view.dart';
import '../widgets/extension_update_dialog.dart';
import '../widgets/extension_update_status.dart';
class ExtensionDetailsPage extends ConsumerWidget {
@@ -26,7 +27,13 @@ class ExtensionDetailsPage extends ConsumerWidget {
title: item?.title ?? context.l10n.extensions,
onBack: () => context.canPop() ? context.pop() : context.go('/extensions'),
titleTrailing: _canUpdate(stateAsync.value, item)
? ExtensionUpdateStatus(label: context.l10n.extensionCanUpdate)
? ExtensionUpdateStatus(
key: const ValueKey('extension-details-update-mobile'),
label: context.l10n.extensionCanUpdate,
onTap: item?.installed == null
? null
: () => showExtensionUpdateDialog(context, item!.installed!),
)
: null,
child: item == null
? Center(
@@ -35,12 +35,19 @@ class ExtensionDetailDrawer extends ConsumerWidget {
final installed = item?.installed;
final canUpdate =
item != null && installed != null && (state?.updateFlags.containsKey(installed.identity) ?? false);
final updateChip = canUpdate
? ExtensionUpdateStatus(
key: const ValueKey('extension-details-update'),
label: context.l10n.extensionCanUpdate,
onTap: () => showExtensionUpdateDialog(context, installed),
)
: null;
return AppDetailDrawer(
open: item != null,
title: item?.title ?? '',
onClose: onClose,
drawerKey: const ValueKey('extension-details-drawer'),
titleTrailing: canUpdate ? ExtensionUpdateStatus(label: context.l10n.extensionCanUpdate) : null,
titleTrailing: updateChip,
child: item == null ? const SizedBox.shrink() : ExtensionDetailView(item: item!),
);
}
@@ -134,15 +141,6 @@ class ExtensionDetailView extends ConsumerWidget {
_runAction(context, () => ref.read(extensionsControllerProvider.notifier).installFromStore(store)),
child: Text(context.l10n.extensionInstall),
),
if (installed != null && canUpdate)
AppLoadingButton(
key: const ValueKey('extension-details-update'),
loading: false,
variant: AppLoadingButtonVariant.primary,
icon: const Icon(Icons.upgrade, size: 16),
onPressed: busy ? null : () => showExtensionUpdateDialog(context, installed),
child: Text(context.l10n.extensionUpdateAction),
),
if (installed != null && !canUpdate)
AppLoadingButton(
key: const ValueKey('extension-details-installed'),
-1
View File
@@ -120,7 +120,6 @@
}
},
"extensionUpdateSuccess": "Updated successfully",
"extensionUpdateAction": "Update",
"extensionUpdateCheckFailed": "Failed to check for updates. Please check your network",
"extensionDelete": "Delete Extension",
"extensionAlreadyLatest": "It's already the latest version",
-1
View File
@@ -106,7 +106,6 @@
"extensionInstallSuccess": "安装成功",
"extensionUpdateConfirm": "确定将“{name}”更新到最新版本吗?",
"extensionUpdateSuccess": "更新成功",
"extensionUpdateAction": "更新",
"extensionUpdateCheckFailed": "检查更新失败,请检查网络后重试",
"extensionDelete": "删除扩展",
"extensionAlreadyLatest": "已经是最新版本",