fix(recommend): 对齐全部短剧筛选行

This commit is contained in:
Zhou Weidong committed 2026-10-22 20:46:13 +08:00
1 parent 3289012f64
commit af4d918938
4 files changed
+62 -3

No files matched your search

@@ -256,6 +256,43 @@ void main() {
filterStarts,
everyElement(closeTo(AppDimens.feedPageHorizontal, 0.1)),
);
final pageRect = tester.getRect(find.byKey(const Key('recommend-page')));
for (var row = 0; row < 4; row++) {
final rowRect = tester.getRect(find.byKey(Key('all-filter-row-$row')));
expect(rowRect.left, closeTo(pageRect.left + 14, 0.1));
expect(rowRect.right, closeTo(pageRect.right - 14, 0.1));
}
final firstTexts = [
find.descendant(
of: find.byKey(const Key('all-filter-row-0')),
matching: find.byType(Text),
),
find.descendant(
of: find.byKey(const Key('all-filter-row-1')),
matching: find.byType(Text),
),
find.descendant(
of: find.byKey(const Key('all-filter-row-2')),
matching: find.byType(Text),
),
find.descendant(
of: find.byKey(const Key('all-filter-row-3')),
matching: find.byType(Text),
),
];
final firstTextX = firstTexts
.map((finder) => tester.getTopLeft(finder.first).dx)
.toList();
expect(firstTextX, everyElement(closeTo(firstTextX.first, 0.1)));
expect(
firstTextX.first,
closeTo(
pageRect.left +
AppDimens.feedPageHorizontal +
AppDimens.filterChipHorizontalPadding,
0.1,
),
);
for (var row = 0; row < 3; row++) {
expect(
tester.getSize(find.byKey(Key('all-filter-row-$row'))).height,
@@ -321,6 +358,24 @@ void main() {
tester.getTopLeft(rowZeroLocal).dx - tester.getTopRight(rowZeroAll).dx,
AppDimens.filterItemGap,
);
final rowOne = find.byKey(const Key('all-filter-row-1'));
final rowTwo = find.byKey(const Key('all-filter-row-2'));
for (final row in [rowOne, rowTwo]) {
final all = find.descendant(
of: row,
matching: find.byKey(const Key('all-filter-all')),
);
final next = find.descendant(
of: row,
matching: row == rowOne
? find.byKey(const Key('all-filter-subtitles'))
: find.byKey(const Key('all-filter-reversal')),
);
expect(
tester.getTopLeft(next).dx - tester.getTopRight(all).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);