diff --git a/docs/plans/PROGRESS.md b/docs/plans/PROGRESS.md index b654c0c..a4fd01e 100644 --- a/docs/plans/PROGRESS.md +++ b/docs/plans/PROGRESS.md @@ -1111,7 +1111,7 @@ $ flutter test ## 2026-10-22 首页布局对齐修正 -- 一级分类改为页内切换 6 个列表,未选 16/w400 灰字、选中 20/w700 白字,无下划线;二级 chips 仅精选显示。 +- 一级分类页内切换 6 个列表,未选 16/w400、选中 20/w700,无下划线;二级 chips 高 26、字 15、间距 14,仅精选显示。 - 四类短剧卡片移除底板/描边,封面统一 8 圆角,网格行距 10、封底到标题 6;热剧/新剧/漫剧角标移至右上角异形丝带。 - 标题下方恢复左对齐题材文字,使用 `|` 分隔、灰色小字,与封面状态角标保持独立。 - 首页搜索栏到一级、一级到二级、二级到网格间距为 8/8/10;非精选 tab 直接以 10 衔接网格。 diff --git a/lib/core/theme/app_dimens.dart b/lib/core/theme/app_dimens.dart index 1e1eb9c..f6e2fbc 100644 --- a/lib/core/theme/app_dimens.dart +++ b/lib/core/theme/app_dimens.dart @@ -106,9 +106,12 @@ abstract final class AppDimens { static const Duration homePrimaryTabAnimationDuration = Duration( milliseconds: 180, ); - static const double homeSecondaryTagFont = 13; + static const double homeSecondaryTagFont = 15; + static const double homeSecondaryTagHeight = 26; + static const double homeSecondaryTagHorizontalPadding = 10; + static const double homeSecondaryTagRadius = 13; static const double homePrimaryCategoryGap = 24; - static const double homeSecondaryTagGap = 18; + static const double homeSecondaryTagGap = 14; static const double homeSearchTopGap = 0; static const double homeSearchPrimaryGap = 8; static const double homePrimarySecondaryGap = 8; diff --git a/lib/pages/home/widgets/home_grid_header.dart b/lib/pages/home/widgets/home_grid_header.dart index df3445f..44dd11a 100644 --- a/lib/pages/home/widgets/home_grid_header.dart +++ b/lib/pages/home/widgets/home_grid_header.dart @@ -362,7 +362,7 @@ class HomeGridHeader extends StatelessWidget { style: TextStyle( color: selected ? AppColors.navSelected : AppColors.textTertiary, fontSize: AppDimens.homeSecondaryTagFont, - fontWeight: selected ? FontWeight.w700 : FontWeight.w400, + fontWeight: selected ? FontWeight.w600 : FontWeight.w400, letterSpacing: 0, ), ); @@ -372,19 +372,22 @@ class HomeGridHeader extends StatelessWidget { onTap: () => onTagSelected(selected ? null : tag.id), child: selected ? Container( + height: AppDimens.homeSecondaryTagHeight, padding: const EdgeInsets.symmetric( - horizontal: AppDimens.spaceMd, - vertical: AppDimens.spaceSm, + horizontal: AppDimens.homeSecondaryTagHorizontalPadding, ), + alignment: Alignment.center, decoration: BoxDecoration( color: AppColors.contentSurface, - borderRadius: BorderRadius.circular(AppDimens.pillRadius), + borderRadius: BorderRadius.circular( + AppDimens.homeSecondaryTagRadius, + ), ), child: label, ) - : Padding( - padding: const EdgeInsets.symmetric(vertical: AppDimens.spaceSm), - child: label, + : SizedBox( + height: AppDimens.homeSecondaryTagHeight, + child: Align(alignment: Alignment.centerLeft, child: label), ), ); } diff --git a/test/home/home_preview_layout_test.dart b/test/home/home_preview_layout_test.dart index 152ffe7..36e8e79 100644 --- a/test/home/home_preview_layout_test.dart +++ b/test/home/home_preview_layout_test.dart @@ -157,6 +157,10 @@ void main() { expect(primaryGap, closeTo(AppDimens.homePrimaryCategoryGap, 0.1)); final tagStart = tester.getTopLeft(find.text('Hot')); expect(tagStart.dx, pageStart.dx); + expect( + tester.getSize(find.byKey(const Key('home-tag-hot'))).height, + AppDimens.homeSecondaryTagHeight, + ); final tagGap = tester.getTopLeft(find.text('Uplifting')).dx - tester.getBottomRight(find.text('Hot')).dx; @@ -173,6 +177,14 @@ void main() { (selectedTagChip.decoration! as BoxDecoration).color, AppColors.contentSurface, ); + expect( + (selectedTagChip.decoration! as BoxDecoration).borderRadius, + BorderRadius.circular(AppDimens.homeSecondaryTagRadius), + ); + expect( + tester.getSize(find.byKey(const Key('home-tag-hot'))).height, + AppDimens.homeSecondaryTagHeight, + ); final selectedTag = tester.widget( find.descendant( of: find.byKey(const Key('home-tag-hot')), @@ -180,7 +192,7 @@ void main() { ), ); expect(selectedTag.style?.color, AppColors.navSelected); - expect(selectedTag.style?.fontWeight, FontWeight.w700); + expect(selectedTag.style?.fontWeight, FontWeight.w600); expect(find.byType(PageView), findsNothing); expect(tester.takeException(), isNull); });