mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-17 13:53:41 +00:00
refactor(ui): replace update dot with tappable status chip
Card and detail headers now show a green update chip next to the extension title; on cards it opens the update dialog directly. The red dot and the red card button are gone, and the status chip no longer duplicates inside the detail content. Shorten the English label so the chip fits narrow cards.
This commit is contained in:
1 parent
d8758267c4
commit
51b7abed48
8 files changed
+103
-68
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_status.dart';
|
||||
|
||||
class ExtensionDetailsPage extends ConsumerWidget {
|
||||
const ExtensionDetailsPage({super.key, required this.extensionId, this.initialItem});
|
||||
@@ -24,6 +25,9 @@ class ExtensionDetailsPage extends ConsumerWidget {
|
||||
return AppDetailPage(
|
||||
title: item?.title ?? context.l10n.extensions,
|
||||
onBack: () => context.canPop() ? context.pop() : context.go('/extensions'),
|
||||
titleTrailing: _canUpdate(stateAsync.value, item)
|
||||
? ExtensionUpdateStatus(label: context.l10n.extensionCanUpdate)
|
||||
: null,
|
||||
child: item == null
|
||||
? Center(
|
||||
child: stateAsync.isLoading
|
||||
@@ -33,4 +37,9 @@ class ExtensionDetailsPage extends ConsumerWidget {
|
||||
: ExtensionDetailView(key: ValueKey(item.id), item: item, mobile: true),
|
||||
);
|
||||
}
|
||||
|
||||
bool _canUpdate(ExtensionsState? state, ExtensionListItem? item) {
|
||||
final installed = item?.installed;
|
||||
return item != null && installed != null && (state?.updateFlags.containsKey(installed.identity) ?? false);
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import '../widgets/extension_detail_view.dart';
|
||||
import '../widgets/extension_icon.dart';
|
||||
import '../widgets/extension_setting_field.dart';
|
||||
import '../widgets/extension_update_dialog.dart';
|
||||
import '../widgets/extension_update_status.dart';
|
||||
|
||||
const _extensionCardMinWidth = 290.0;
|
||||
const _extensionGridSpacing = 10.0;
|
||||
@@ -992,15 +993,12 @@ class _ExtensionCard extends ConsumerWidget {
|
||||
style: TextStyle(color: palette.textPrimary, fontSize: 14, fontWeight: FontWeight.w700),
|
||||
),
|
||||
),
|
||||
if (canUpdate) ...[
|
||||
const SizedBox(width: 6),
|
||||
Container(
|
||||
key: ValueKey('extension-card-update-dot-${item.id}'),
|
||||
width: 8,
|
||||
height: 8,
|
||||
decoration: BoxDecoration(color: palette.error, shape: BoxShape.circle),
|
||||
if (canUpdate && installed != null)
|
||||
ExtensionUpdateStatus(
|
||||
key: ValueKey('extension-card-update-status-${item.id}'),
|
||||
label: context.l10n.extensionCanUpdate,
|
||||
onTap: busy ? null : () => showExtensionUpdateDialog(context, installed),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
@@ -1070,16 +1068,6 @@ class _ExtensionCard extends ConsumerWidget {
|
||||
key: ValueKey('extension-card-actions-${item.id}'),
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (canUpdate && installed != null)
|
||||
shad.GhostButton(
|
||||
key: ValueKey('update-extension-${installed.identity}'),
|
||||
density: shad.ButtonDensity.dense,
|
||||
onPressed: busy ? null : () => showExtensionUpdateDialog(context, installed),
|
||||
child: Text(
|
||||
context.l10n.extensionUpdateAction,
|
||||
style: TextStyle(color: palette.error, fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
if (installed == null && item.store != null)
|
||||
shad.GhostButton(
|
||||
key: ValueKey('install-store-extension-${item.store!.id}'),
|
||||
|
||||
Reference in new issue
Block a user