feat(ui): rework extension update detection and entry point (#1535)

This commit is contained in:
Levi authored and GitHub committed 2026-10-10 22:09:47 +08:00
1 parent ba84a04a43
commit 87a8f87b70
31 files changed
+434 -228

No files matched your search

+29 -2
View File
@@ -50,6 +50,7 @@ import 'package:gopeed/features/home/presentation/widgets/tasks_top_bar.dart';
import 'package:gopeed/features/extensions/application/extensions_controller.dart';
import 'package:gopeed/features/extensions/presentation/pages/extension_details_page.dart';
import 'package:gopeed/features/extensions/presentation/pages/extensions_page.dart';
import 'package:gopeed/features/extensions/presentation/widgets/extension_icon.dart';
import 'package:gopeed/features/home/presentation/widgets/primary_rail.dart';
import 'package:gopeed/features/tasks/application/pending_update_task.dart';
import 'package:gopeed/features/tasks/application/task_batch_selection_controller.dart';
@@ -688,6 +689,30 @@ void main() {
expect(tester.takeException(), isNull);
});
for (final width in [320.0, 1100.0]) {
testWidgets('extension update status keeps the card header at icon height at $width', (tester) async {
await _setTestSize(tester, Size(width, 900));
await tester.pumpWidget(
ProviderScope(
overrides: [extensionsControllerProvider.overrideWith(UpdateableExtensionsController.new)],
child: shad.ShadcnApp(
theme: AppTheme.light(),
materialTheme: AppTheme.materialLight(),
home: const ExtensionsPage(),
),
),
);
await tester.pumpAndSettle();
final card = find.byKey(const ValueKey('extension-card-extension-0'));
final icon = find.descendant(of: card, matching: find.byType(ExtensionIcon));
final description = find.descendant(of: card, matching: find.text('Installed extension'));
expect(find.byKey(const ValueKey('extension-card-update-status-extension-0')), findsOneWidget);
expect(tester.getRect(description).top - tester.getRect(icon).bottom, closeTo(10, 0.01));
expect(tester.takeException(), isNull);
});
}
testWidgets('extension details reuse the desktop detail drawer', (WidgetTester tester) async {
await _setTestSize(tester, const Size(1100, 900));
final controller = FakeExtensionsController();
@@ -817,7 +842,9 @@ void main() {
await tester.tap(find.byKey(const ValueKey('extension-card-extension-0')));
await tester.pumpAndSettle();
}
final entry = find.byKey(ValueKey(details ? 'extension-details-update' : 'update-extension-extension-0'));
final entry = find.byKey(
ValueKey(details ? 'extension-details-update' : 'extension-card-update-status-extension-0'),
);
final dialog = find.byKey(const ValueKey('extension-update-dialog'));
final confirm = find.byKey(const ValueKey('confirm-update-extension-button'));
final cancel = find.byKey(const ValueKey('cancel-update-extension-button'));
@@ -2327,7 +2354,7 @@ void main() {
final progress = find.descendant(of: updateButton, matching: find.byType(shad.CircularProgressIndicator));
expect(progress, findsOneWidget);
expect(tester.getSize(progress), const Size.square(14));
expect(find.descendant(of: updateButton, matching: find.text('Update Now')), findsOneWidget);
expect(find.descendant(of: updateButton, matching: find.text('Update')), findsOneWidget);
runtimeController.completeTrackerUpdate();
await tester.pumpAndSettle();