fix(home): 移除二级标签筛选按钮
This commit is contained in:
1 parent
3655d94869
commit
9cf1efc316
6 files changed
+27
-109
No files matched your search
@@ -1222,3 +1222,9 @@ $ flutter test
|
||||
- 新增量化测试断言四行首项 x 均为 12、相邻 chip 间距均为 10;`flutter analyze` 无问题。
|
||||
- 修复横向 viewport 对短内容居中:滚动内容最小宽度撑满视口后由 Row.start 排列。
|
||||
- `flutter test test/recommend/all_dramas_filter_alignment_test.dart`:1 项测试通过。
|
||||
|
||||
## 2026-10-22 首页二级标签移除筛选按钮
|
||||
|
||||
- 首页二级标签行改为纯横向滑动,右侧三横线按钮不渲染也不占位。
|
||||
- 删除不再使用的筛选回调、尺寸 token、颜色和 CustomPainter;全部短剧页筛选按钮保持不变。
|
||||
- `flutter analyze`:No issues found。
|
||||
@@ -92,7 +92,6 @@ abstract final class AppColors {
|
||||
static const textSecondary = Color(0xFF8E8E93);
|
||||
static const textTertiary = Color(0xFF9E9E9E);
|
||||
static const textTabInactive = Color(0xFFB0B0B0);
|
||||
static const textFilterIcon = Color(0xFF7A7A7E);
|
||||
|
||||
/// 原生开屏与冷启动过渡底色。
|
||||
static const splashInk = ink;
|
||||
|
||||
@@ -114,10 +114,6 @@ abstract final class AppDimens {
|
||||
static const Duration homeSecondaryTagAnimationDuration = Duration(
|
||||
milliseconds: 150,
|
||||
);
|
||||
static const double homeSecondaryFilterGap = 6;
|
||||
static const double homeSecondaryFilterVisualSize = 26;
|
||||
static const double homeSecondaryFilterIcon = 16;
|
||||
static const double homeSecondaryFilterStroke = 1.7;
|
||||
static const double homePrimaryCategoryGap = 24;
|
||||
static const double homeSecondaryTagGap = 10;
|
||||
static const double homeSearchTopGap = 0;
|
||||
|
||||
@@ -276,7 +276,6 @@ class _HomeTabsState extends State<_HomeTabs> {
|
||||
onSearch: () => _openSearch(context),
|
||||
onOpenVip: () => unawaited(_openVip(context)),
|
||||
onOpenWallet: () => unawaited(_openWallet(context)),
|
||||
onOpenFilter: () => _pushPage(context, const FilterPage()),
|
||||
),
|
||||
onOpenDrama: (drama) => unawaited(logic.playDrama(context, drama)),
|
||||
);
|
||||
|
||||
@@ -40,13 +40,11 @@ class HomeGridCallbacks {
|
||||
required this.onSearch,
|
||||
required this.onOpenVip,
|
||||
required this.onOpenWallet,
|
||||
required this.onOpenFilter,
|
||||
});
|
||||
|
||||
final VoidCallback onSearch;
|
||||
final VoidCallback onOpenVip;
|
||||
final VoidCallback onOpenWallet;
|
||||
final VoidCallback onOpenFilter;
|
||||
}
|
||||
|
||||
class HomeGridHeader extends StatelessWidget {
|
||||
@@ -82,7 +80,7 @@ class HomeGridHeader extends StatelessWidget {
|
||||
_searchRow(l10n),
|
||||
_primaryRow(l10n),
|
||||
if (selectedPrimary == HomePrimaryTab.featured)
|
||||
_tagRow(l10n)
|
||||
_tagRow()
|
||||
else
|
||||
const SizedBox(height: AppDimens.homeSecondaryGridGap),
|
||||
],
|
||||
@@ -324,7 +322,7 @@ class HomeGridHeader extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _tagRow(AppLocalizations l10n) {
|
||||
Widget _tagRow() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
AppDimens.feedPageHorizontal,
|
||||
@@ -332,54 +330,19 @@ class HomeGridHeader extends StatelessWidget {
|
||||
AppDimens.feedPageHorizontal,
|
||||
AppDimens.homeSecondaryGridGap,
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
key: const Key('home-secondary-tags'),
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
for (final tag in tags) ...[
|
||||
_tagChip(tag),
|
||||
const SizedBox(width: AppDimens.homeSecondaryTagGap),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: AppDimens.homeSecondaryFilterGap),
|
||||
Tooltip(
|
||||
message: l10n.filter,
|
||||
child: SizedBox.square(
|
||||
dimension: AppDimens.homeSecondaryFilterVisualSize,
|
||||
child: Material(
|
||||
color: AppColors.transparent,
|
||||
child: InkWell(
|
||||
key: const Key('home-grid-filter'),
|
||||
onTap: callbacks.onOpenFilter,
|
||||
child: Center(
|
||||
child: SizedBox.square(
|
||||
key: const Key('home-secondary-filter-visual'),
|
||||
dimension: AppDimens.homeSecondaryFilterVisualSize,
|
||||
child: const Center(
|
||||
child: CustomPaint(
|
||||
key: Key('home-secondary-filter-icon'),
|
||||
size: Size.square(AppDimens.homeSecondaryFilterIcon),
|
||||
painter: _ThreeLineFilterPainter(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
child: SingleChildScrollView(
|
||||
key: const Key('home-secondary-tags'),
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
for (final tag in tags) ...[
|
||||
_tagChip(tag),
|
||||
const SizedBox(width: AppDimens.homeSecondaryTagGap),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -417,26 +380,3 @@ class HomeGridHeader extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _ThreeLineFilterPainter extends CustomPainter {
|
||||
const _ThreeLineFilterPainter();
|
||||
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
final paint = Paint()
|
||||
..color = AppColors.textFilterIcon
|
||||
..strokeWidth = AppDimens.homeSecondaryFilterStroke
|
||||
..strokeCap = StrokeCap.butt;
|
||||
final positions = [
|
||||
size.height * 0.25,
|
||||
size.height * 0.5,
|
||||
size.height * 0.75,
|
||||
];
|
||||
for (final y in positions) {
|
||||
canvas.drawLine(Offset(0, y), Offset(size.width, y), paint);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldRepaint(_ThreeLineFilterPainter oldDelegate) => false;
|
||||
}
|
||||
@@ -94,43 +94,21 @@ void main() {
|
||||
expect(find.byKey(const Key('home-section-category-古装')), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-section-category-社群')), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-secondary-tags')), findsOneWidget);
|
||||
expect(find.byKey(const Key('home-grid-filter')), findsOneWidget);
|
||||
expect(
|
||||
tester.getSize(find.byKey(const Key('home-grid-filter'))),
|
||||
const Size.square(AppDimens.homeSecondaryFilterVisualSize),
|
||||
tester.getRect(find.byKey(const Key('home-secondary-tags'))).left,
|
||||
closeTo(AppDimens.feedPageHorizontal, 0.1),
|
||||
);
|
||||
expect(
|
||||
tester.getSize(find.byKey(const Key('home-secondary-filter-visual'))),
|
||||
const Size.square(AppDimens.homeSecondaryFilterVisualSize),
|
||||
);
|
||||
expect(
|
||||
tester.getCenter(find.byKey(const Key('home-grid-filter'))).dy,
|
||||
closeTo(tester.getCenter(find.byKey(const Key('home-tag-hot'))).dy, 0.1),
|
||||
);
|
||||
expect(
|
||||
tester.getRect(find.byKey(const Key('home-grid-filter'))).right,
|
||||
tester.getRect(find.byKey(const Key('home-secondary-tags'))).right,
|
||||
closeTo(
|
||||
tester.getRect(find.byKey(const Key('home-grid'))).right -
|
||||
AppDimens.feedPageHorizontal,
|
||||
0.1,
|
||||
),
|
||||
);
|
||||
final filterIcon = tester.widget<CustomPaint>(
|
||||
find.byKey(const Key('home-secondary-filter-icon')),
|
||||
);
|
||||
expect(
|
||||
filterIcon.size,
|
||||
const Size.square(AppDimens.homeSecondaryFilterIcon),
|
||||
);
|
||||
final filterMaterial = tester.widget<Material>(
|
||||
find
|
||||
.ancestor(
|
||||
of: find.byKey(const Key('home-grid-filter')),
|
||||
matching: find.byType(Material),
|
||||
)
|
||||
.first,
|
||||
);
|
||||
expect(filterMaterial.color, AppColors.transparent);
|
||||
expect(find.byKey(const Key('home-grid-filter')), findsNothing);
|
||||
expect(find.byKey(const Key('home-secondary-filter-visual')), findsNothing);
|
||||
expect(find.byKey(const Key('home-secondary-filter-icon')), findsNothing);
|
||||
final searchBox = find.descendant(
|
||||
of: find.byKey(const Key('home-search-entry')),
|
||||
matching: find.byType(Container),
|
||||
|
||||
Reference in new issue
Block a user