mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-07 00:50:27 +00:00
fix(ui): refine create task actions and relocate icon sources (#1500)
This commit is contained in:
64 files changed
+193
-139
No files matched your search
@@ -499,11 +499,12 @@ void main() {
|
||||
|
||||
expect(_fieldText(tester, 'create-task-rename-input'), isEmpty);
|
||||
final createButton = tester.widget<AppLoadingButton>(find.byKey(const ValueKey('resolve-create-button')));
|
||||
expect(createButton.child, isA<Text>());
|
||||
final createText = createButton.child as Text;
|
||||
expect(createText.data, 'Create');
|
||||
expect(createText.maxLines, 1);
|
||||
expect(createText.softWrap, isFalse);
|
||||
expect(createButton.child, isA<SizedBox>());
|
||||
expect((createButton.child as SizedBox).width, 68);
|
||||
expect(
|
||||
find.descendant(of: find.byKey(const ValueKey('resolve-create-button')), matching: find.text('Create')),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
tester.getSize(find.byKey(const ValueKey('resolve-cancel-button'))),
|
||||
tester.getSize(find.byKey(const ValueKey('resolve-create-button'))),
|
||||
@@ -555,6 +556,7 @@ void main() {
|
||||
|
||||
await tester.tap(find.byIcon(Icons.history));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('History Links'), findsOneWidget);
|
||||
expect(
|
||||
tester.getSize(find.byKey(const ValueKey('create-history-title-bar'))).width,
|
||||
tester.getSize(find.byKey(const ValueKey('create-history-content'))).width,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:gopeed/features/tasks/presentation/widgets/resolve_task_actions.dart';
|
||||
import 'package:gopeed/features/tasks/presentation/widgets/create_task_action_buttons.dart';
|
||||
import 'package:gopeed/l10n/l10n.dart';
|
||||
import 'package:gopeed/shared/theme/app_component_themes.dart';
|
||||
import 'package:gopeed/shared/theme/app_theme.dart';
|
||||
@@ -36,10 +36,14 @@ void main() {
|
||||
content: SizedBox(width: width < 760 ? width - 32 : 720, height: 100),
|
||||
actions: [
|
||||
Flexible(
|
||||
child: ResolveTaskActions(
|
||||
child: CreateTaskActionButtons(
|
||||
submitting: submitting,
|
||||
onCancel: () => cancelled = true,
|
||||
onCreate: () => setState(() => submitting = true),
|
||||
onSubmit: () => setState(() => submitting = true),
|
||||
cancelLabel: context.l10n.cancel,
|
||||
submitLabel: context.l10n.createAction,
|
||||
cancelButtonKey: const ValueKey('resolve-cancel-button'),
|
||||
submitButtonKey: const ValueKey('resolve-create-button'),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -58,6 +62,9 @@ void main() {
|
||||
final createRect = tester.getRect(create);
|
||||
expect(cancelRect.size, createRect.size);
|
||||
expect(cancelRect.center.dy, createRect.center.dy);
|
||||
expect(createRect.left - cancelRect.right, 12);
|
||||
expect((tester.widget<shad.SecondaryButton>(cancel).child as SizedBox).width, 68);
|
||||
expect((tester.widget<AppLoadingButton>(create).child as SizedBox).width, 68);
|
||||
expect(cancelRect.left, greaterThanOrEqualTo(0));
|
||||
expect(createRect.right, lessThanOrEqualTo(width));
|
||||
expect(find.text(appLocalizationsFor(language).createAction), findsOneWidget);
|
||||
|
||||
@@ -2669,9 +2669,9 @@ void main() {
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: ResolveFileTree(
|
||||
files: [
|
||||
FileInfo(path: 'videos', name: 'clip.mp4', size: 1024),
|
||||
FileInfo(path: 'docs', name: 'notes.txt', size: 128),
|
||||
FileInfo(path: 'docs', name: 'manual.pdf', size: 256),
|
||||
FileInfo(path: 'videos', name: 'clip.mp4', size: 0),
|
||||
FileInfo(path: 'docs', name: 'notes.txt', size: 0),
|
||||
FileInfo(path: 'docs', name: 'manual.pdf', size: 0),
|
||||
],
|
||||
initialSelection: const [0, 1, 2],
|
||||
onSelectionChanged: (values) => selected = values,
|
||||
@@ -2708,7 +2708,26 @@ void main() {
|
||||
expect(find.byKey(const ValueKey('resolve-tree-expand-toggle')), findsOneWidget);
|
||||
expect(find.byType(shad.OutlinedContainer), findsOneWidget);
|
||||
expect(find.text('clip.mp4'), findsOneWidget);
|
||||
expect(find.text('Unknown size'), findsOneWidget);
|
||||
expect(tester.widget<Text>(find.text('clip.mp4')).style?.color, AppPalette.light.textPrimary);
|
||||
final baselines = tester
|
||||
.widgetList<Baseline>(
|
||||
find.descendant(
|
||||
of: find.byKey(const ValueKey('resolve-tree-selection-stats')),
|
||||
matching: find.byType(Baseline),
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
expect(baselines, hasLength(2));
|
||||
expect(baselines.first.baseline, baselines.last.baseline);
|
||||
expect(baselines.every((widget) => widget.baselineType == TextBaseline.alphabetic), isTrue);
|
||||
final filtersRect = tester.getRect(find.byKey(const ValueKey('resolve-tree-filters')));
|
||||
final statsRect = tester.getRect(find.byKey(const ValueKey('resolve-tree-selection-stats')));
|
||||
final selectedCountRect = tester.getRect(find.byKey(const ValueKey('resolve-tree-selected-count')));
|
||||
final selectedSizeRect = tester.getRect(find.byKey(const ValueKey('resolve-tree-selected-size')));
|
||||
expect(statsRect.center.dy, closeTo(filtersRect.center.dy, 0.01));
|
||||
expect(selectedCountRect.center.dy, closeTo(selectedSizeRect.center.dy, 0.01));
|
||||
expect(selectedSizeRect.left, greaterThan(selectedCountRect.right));
|
||||
|
||||
await tester.tap(find.byKey(const ValueKey('resolve-tree-expand-toggle')));
|
||||
await tester.pumpAndSettle();
|
||||
@@ -2770,8 +2789,16 @@ void main() {
|
||||
expect(find.text('clip.mp4'), findsOneWidget);
|
||||
expect(selected, [0, 1, 2]);
|
||||
|
||||
tester.view.physicalSize = const Size(360, 620);
|
||||
tester.view.physicalSize = const Size(280, 620);
|
||||
await tester.pumpAndSettle();
|
||||
expect(
|
||||
tester.getRect(find.byKey(const ValueKey('resolve-tree-selection-stats'))).top,
|
||||
greaterThanOrEqualTo(tester.getRect(find.byKey(const ValueKey('resolve-tree-filters'))).bottom),
|
||||
);
|
||||
expect(
|
||||
tester.getRect(find.byKey(const ValueKey('resolve-tree-selected-size'))).top,
|
||||
greaterThanOrEqualTo(tester.getRect(find.byKey(const ValueKey('resolve-tree-selected-count'))).bottom),
|
||||
);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user