merge: 优化二级标签选中样式

This commit is contained in:
Zhou Weidong committed 2026-10-22 18:28:51 +08:00
commit da69a058b4
4 files changed
+29 -11

No files matched your search

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