fix(recommend): 固定全部短剧筛选区并统一间距

This commit is contained in:
Zhou Weidong committed 2026-10-22 20:43:15 +08:00
1 parent 099d05064e
commit e147002e00
4 files changed
+144 -64

No files matched your search

@@ -248,6 +248,55 @@ void main() {
for (var row = 0; row < 4; row++) {
expect(find.byKey(Key('all-filter-row-$row')), findsOneWidget);
}
final filterStarts = [
for (var row = 0; row < 4; row++)
tester.getRect(find.byKey(Key('all-filter-row-$row'))).left,
];
expect(
filterStarts,
everyElement(closeTo(AppDimens.feedPageHorizontal, 0.1)),
);
for (var row = 0; row < 3; row++) {
expect(
tester.getSize(find.byKey(Key('all-filter-row-$row'))).height,
AppDimens.filterChipHeight + AppDimens.filterRowGap,
);
}
expect(
tester.getSize(find.byKey(const Key('all-filter-row-3'))).height,
AppDimens.filterChipHeight,
);
expect(
tester.getRect(find.byKey(const Key('all-dramas-scroll'))).top -
tester.getRect(find.byKey(const Key('all-dramas-filters'))).bottom,
closeTo(AppDimens.allDramasFilterToGridGap, 0.1),
);
expect(
find.descendant(
of: find.byKey(const Key('all-dramas-refresh')),
matching: find.byKey(const Key('all-dramas-filters')),
),
findsNothing,
);
expect(
find.descendant(
of: find.byKey(const Key('all-dramas-scroll')),
matching: find.byKey(const Key('all-dramas-grid')),
),
findsOneWidget,
);
final fixedFilterTop = tester
.getRect(find.byKey(const Key('all-dramas-filters')))
.top;
await tester.drag(
find.byKey(const Key('all-dramas-scroll')),
const Offset(0, -120),
);
await tester.pump();
expect(
tester.getRect(find.byKey(const Key('all-dramas-filters'))).top,
closeTo(fixedFilterTop, 0.1),
);
expect(find.byKey(const Key('all-filter-local')), findsOneWidget);
expect(find.byKey(const Key('all-filter-subtitles')), findsOneWidget);
for (final key in [
@@ -259,10 +308,24 @@ void main() {
]) {
expect(find.byKey(Key(key)), findsOneWidget);
}
final rowZero = find.byKey(const Key('all-filter-row-0'));
final rowZeroAll = find.descendant(
of: rowZero,
matching: find.byKey(const Key('all-filter-all')),
);
final rowZeroLocal = find.descendant(
of: rowZero,
matching: find.byKey(const Key('all-filter-local')),
);
expect(
tester.getTopLeft(rowZeroLocal).dx - tester.getTopRight(rowZeroAll).dx,
AppDimens.filterItemGap,
);
await tester.tap(find.byKey(const Key('all-filter-local')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('all-dramas-empty')), findsOneWidget);
expect(_textStyle(tester, 'Local').fontWeight, FontWeight.w600);
expect(_textStyle(tester, 'Local').fontSize, AppDimens.filterChipFont);
expect(_textStyle(tester, 'Local').color, AppColors.textPrimary);
final selectedChip = tester.widget<Container>(
find