merge: 对齐全部短剧筛选行
This commit is contained in:
commit
3b9ff8a306
4 files changed
+62
-3
No files matched your search
@@ -1213,3 +1213,4 @@ $ flutter test
|
||||
- 最热/最新改为纯文字选中态,三横线筛选固定在右端;网格改为左右 12、列距 6、行距 12。
|
||||
- 第三行筛选完整展示,卡片继续复用首页组件;`flutter analyze`:No issues found。
|
||||
- 筛选项字号提升到 15、圆角 15;筛选区移出滚动容器并固定吸顶,下拉刷新仅作用于网格。
|
||||
- 四行首项文字统一到同一 x;行高 30、行距 6、项目距 12,第 4 行保持弹性空白后固定筛选图标。
|
||||
@@ -138,11 +138,11 @@ abstract final class AppDimens {
|
||||
|
||||
/// 全部短剧筛选与追剧双列。
|
||||
static const double filterChipFont = 15;
|
||||
static const double filterChipHeight = 28;
|
||||
static const double filterChipHeight = 30;
|
||||
static const double filterChipRadius = 15;
|
||||
static const double filterChipHorizontalPadding = 12;
|
||||
static const double filterRowGap = 8;
|
||||
static const double filterItemGap = 24;
|
||||
static const double filterRowGap = 6;
|
||||
static const double filterItemGap = 12;
|
||||
static const double allDramasHorizontal = 12;
|
||||
static const double allDramasGridGap = 6;
|
||||
static const double allDramasGridRowGap = 12;
|
||||
|
||||
@@ -193,6 +193,7 @@ class _AllDramasFilterGridState extends State<AllDramasFilterGrid> {
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
for (var index = 0; index < options.length; index++) ...[
|
||||
_chip(
|
||||
@@ -268,6 +269,8 @@ class _AllDramasFilterGridState extends State<AllDramasFilterGrid> {
|
||||
key: const Key('all-filter-row-3'),
|
||||
height: AppDimens.filterChipHeight,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
_sortOption(
|
||||
key: const Key('all-sort-hot'),
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user