merge: 修正筛选左起始与横向滑动
This commit is contained in:
commit
64bc1997ba
4 files changed
+50
-15
No files matched your search
@@ -1216,3 +1216,5 @@ $ flutter test
|
|||||||
- 四行首项文字统一到同一 x;行高 30、行距 6、项目距 12,第 4 行保持弹性空白后固定筛选图标。
|
- 四行首项文字统一到同一 x;行高 30、行距 6、项目距 12,第 4 行保持弹性空白后固定筛选图标。
|
||||||
- 按最新截图改为 16sp、32 高、10 行距、16 项距;选中态为 `#21090E` 底配 `#FF4D6A` 粉字。
|
- 按最新截图改为 16sp、32 高、10 行距、16 项距;选中态为 `#21090E` 底配 `#FF4D6A` 粉字。
|
||||||
- 第 4 行复用选中胶囊样式,右侧改为 44×44 圆形深灰按钮和 22 三横线图标;`flutter analyze` 无问题。
|
- 第 4 行复用选中胶囊样式,右侧改为 44×44 圆形深灰按钮和 22 三横线图标;`flutter analyze` 无问题。
|
||||||
|
- 筛选行距收紧到 6、项距 10,chip 左右 padding 12;四行均可横向回弹滑动。
|
||||||
|
- 第 4 行仅最热/最新在滚动区内,44 圆形筛选按钮固定在滚动区外;`flutter analyze` 无问题。
|
||||||
@@ -140,9 +140,9 @@ abstract final class AppDimens {
|
|||||||
static const double filterChipFont = 16;
|
static const double filterChipFont = 16;
|
||||||
static const double filterChipHeight = 32;
|
static const double filterChipHeight = 32;
|
||||||
static const double filterChipRadius = 16;
|
static const double filterChipRadius = 16;
|
||||||
static const double filterChipHorizontalPadding = 14;
|
static const double filterChipHorizontalPadding = 12;
|
||||||
static const double filterRowGap = 10;
|
static const double filterRowGap = 6;
|
||||||
static const double filterItemGap = 16;
|
static const double filterItemGap = 10;
|
||||||
static const double allDramasHorizontal = 12;
|
static const double allDramasHorizontal = 12;
|
||||||
static const double allDramasGridGap = 6;
|
static const double allDramasGridGap = 6;
|
||||||
static const double allDramasGridRowGap = 12;
|
static const double allDramasGridRowGap = 12;
|
||||||
|
|||||||
@@ -190,8 +190,11 @@ class _AllDramasFilterGridState extends State<AllDramasFilterGrid> {
|
|||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: AppDimens.filterChipHeight,
|
height: AppDimens.filterChipHeight,
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
|
key: Key('all-filter-scroll-$row'),
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
|
physics: const BouncingScrollPhysics(),
|
||||||
child: Row(
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
@@ -274,20 +277,34 @@ class _AllDramasFilterGridState extends State<AllDramasFilterGrid> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
_chip(
|
Expanded(
|
||||||
key: const Key('all-sort-hot'),
|
child: SingleChildScrollView(
|
||||||
label: l10n.hot,
|
key: const Key('all-filter-scroll-3'),
|
||||||
selected: !_newest,
|
scrollDirection: Axis.horizontal,
|
||||||
onTap: () => setState(() => _newest = false),
|
physics: const BouncingScrollPhysics(),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
_chip(
|
||||||
|
key: const Key('all-sort-hot'),
|
||||||
|
label: l10n.hot,
|
||||||
|
selected: !_newest,
|
||||||
|
onTap: () => setState(() => _newest = false),
|
||||||
|
),
|
||||||
|
const SizedBox(width: AppDimens.filterItemGap),
|
||||||
|
_chip(
|
||||||
|
key: const Key('all-sort-new'),
|
||||||
|
label: l10n.newest,
|
||||||
|
selected: _newest,
|
||||||
|
onTap: () => setState(() => _newest = true),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: AppDimens.filterItemGap),
|
const SizedBox(width: AppDimens.filterItemGap),
|
||||||
_chip(
|
|
||||||
key: const Key('all-sort-new'),
|
|
||||||
label: l10n.newest,
|
|
||||||
selected: _newest,
|
|
||||||
onTap: () => setState(() => _newest = true),
|
|
||||||
),
|
|
||||||
const Spacer(),
|
|
||||||
Material(
|
Material(
|
||||||
key: const Key('all-dramas-filter-page-button'),
|
key: const Key('all-dramas-filter-page-button'),
|
||||||
color: AppColors.filterMenuButton,
|
color: AppColors.filterMenuButton,
|
||||||
|
|||||||
@@ -247,6 +247,11 @@ void main() {
|
|||||||
expect(delegate.mainAxisSpacing, AppDimens.allDramasGridRowGap);
|
expect(delegate.mainAxisSpacing, AppDimens.allDramasGridRowGap);
|
||||||
for (var row = 0; row < 4; row++) {
|
for (var row = 0; row < 4; row++) {
|
||||||
expect(find.byKey(Key('all-filter-row-$row')), findsOneWidget);
|
expect(find.byKey(Key('all-filter-row-$row')), findsOneWidget);
|
||||||
|
final scroll = tester.widget<SingleChildScrollView>(
|
||||||
|
find.byKey(Key('all-filter-scroll-$row')),
|
||||||
|
);
|
||||||
|
expect(scroll.scrollDirection, Axis.horizontal);
|
||||||
|
expect(scroll.physics, isA<BouncingScrollPhysics>());
|
||||||
}
|
}
|
||||||
final filterStarts = [
|
final filterStarts = [
|
||||||
for (var row = 0; row < 4; row++)
|
for (var row = 0; row < 4; row++)
|
||||||
@@ -355,6 +360,10 @@ void main() {
|
|||||||
of: rowZero,
|
of: rowZero,
|
||||||
matching: find.byKey(const Key('all-filter-local')),
|
matching: find.byKey(const Key('all-filter-local')),
|
||||||
);
|
);
|
||||||
|
expect(
|
||||||
|
tester.getTopLeft(rowZeroAll).dx,
|
||||||
|
closeTo(pageRect.left + AppDimens.feedPageHorizontal, 0.1),
|
||||||
|
);
|
||||||
expect(
|
expect(
|
||||||
tester.getTopLeft(rowZeroLocal).dx - tester.getTopRight(rowZeroAll).dx,
|
tester.getTopLeft(rowZeroLocal).dx - tester.getTopRight(rowZeroAll).dx,
|
||||||
AppDimens.filterItemGap,
|
AppDimens.filterItemGap,
|
||||||
@@ -426,6 +435,13 @@ void main() {
|
|||||||
BorderRadius.circular(AppDimens.filterChipRadius),
|
BorderRadius.circular(AppDimens.filterChipRadius),
|
||||||
);
|
);
|
||||||
final filterButton = find.byKey(const Key('all-dramas-filter-page'));
|
final filterButton = find.byKey(const Key('all-dramas-filter-page'));
|
||||||
|
expect(
|
||||||
|
find.descendant(
|
||||||
|
of: find.byKey(const Key('all-filter-scroll-3')),
|
||||||
|
matching: filterButton,
|
||||||
|
),
|
||||||
|
findsNothing,
|
||||||
|
);
|
||||||
expect(
|
expect(
|
||||||
tester.getSize(filterButton),
|
tester.getSize(filterButton),
|
||||||
const Size.square(AppDimens.allDramasFilterButton),
|
const Size.square(AppDimens.allDramasFilterButton),
|
||||||
|
|||||||
Reference in new issue
Block a user