From 8feede17634e87e42705833a2e697786a5339076 Mon Sep 17 00:00:00 2001 From: Zhou Weidong <502333560@qq.com> Date: Thu, 22 Oct 2026 18:48:20 +0800 Subject: [PATCH] =?UTF-8?q?fix(home):=20=E6=94=BE=E5=A4=A7=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E6=A0=8F=E5=8F=B3=E4=BE=A7=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/plans/PROGRESS.md | 2 +- lib/core/theme/app_dimens.dart | 2 +- lib/pages/home/widgets/home_grid_header.dart | 21 ++++++++++++++------ test/home/home_nav_ui_test.dart | 12 +++++++++++ 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/docs/plans/PROGRESS.md b/docs/plans/PROGRESS.md index 23a7ef2..c29f445 100644 --- a/docs/plans/PROGRESS.md +++ b/docs/plans/PROGRESS.md @@ -1115,7 +1115,7 @@ $ flutter test - 四类卡片去底板/描边,封面统一 3:4、8 圆角、行距 10、封底标题间距 6;状态角标为右上角紧凑异形丝带。 - 标题下方恢复左对齐题材文字,使用 `|` 分隔、灰色小字,与封面状态角标保持独立。 - 首页搜索栏到一级、一级到二级、二级到网格间距为 8/8/10;非精选 tab 直接以 10 衔接网格。 -- 搜索框右侧皇冠与礼物改为 40 热区、24 彩色图标,透明背景、间距 12,保留礼物角标。 +- 搜索框右侧皇冠与礼物改为 40 热区、28 彩色图标,透明背景、间距 12,保留礼物角标。 - 播放量贴封面右下角(底 2、右 6),火焰图标 11 + 12/w400 纯文字,间距 4,并保留极淡底部渐变。 - 修复二级 chip 运行时颜色误用 `const TextStyle` 的编译错误,并校正相关测试 Finder 类型。 - 全部短剧的地区、字幕、配音筛选 UI 已占位;以下接口待补:地区、字幕/配音筛选数据。 diff --git a/lib/core/theme/app_dimens.dart b/lib/core/theme/app_dimens.dart index 729e973..c7cfd1d 100644 --- a/lib/core/theme/app_dimens.dart +++ b/lib/core/theme/app_dimens.dart @@ -126,7 +126,7 @@ abstract final class AppDimens { static const double homeSecondaryGridGap = 10; static const double homeHeaderIcon = 22; static const double homeActionSlot = 40; - static const double homeActionIcon = 24; + static const double homeActionIcon = 28; static const double homeActionGap = 12; /// 推荐分区。 diff --git a/lib/pages/home/widgets/home_grid_header.dart b/lib/pages/home/widgets/home_grid_header.dart index 929862c..5891547 100644 --- a/lib/pages/home/widgets/home_grid_header.dart +++ b/lib/pages/home/widgets/home_grid_header.dart @@ -142,6 +142,7 @@ class HomeGridHeader extends StatelessWidget { const SizedBox(width: AppDimens.spaceSm), _headerAction( key: const Key('home-vip-entry'), + frameKey: const Key('home-vip-icon-frame'), icon: Icons.workspace_premium_outlined, color: AppColors.homeCrownGold, tooltip: l10n.vipMembership, @@ -150,6 +151,7 @@ class HomeGridHeader extends StatelessWidget { const SizedBox(width: AppDimens.homeActionGap), _headerAction( key: const Key('home-wallet-entry'), + frameKey: const Key('home-wallet-icon-frame'), icon: Icons.card_giftcard_rounded, color: AppColors.homeGiftPink, tooltip: l10n.wallet, @@ -163,6 +165,7 @@ class HomeGridHeader extends StatelessWidget { Widget _headerAction({ required Key key, + required Key frameKey, required IconData icon, required Color color, required String tooltip, @@ -182,10 +185,16 @@ class HomeGridHeader extends StatelessWidget { child: InkWell( key: key, onTap: onTap, - child: Icon( - icon, - size: AppDimens.homeActionIcon, - color: color, + child: Center( + child: SizedBox.square( + key: frameKey, + dimension: AppDimens.homeActionIcon, + child: Icon( + icon, + size: AppDimens.homeActionIcon, + color: color, + ), + ), ), ), ), @@ -194,8 +203,8 @@ class HomeGridHeader extends StatelessWidget { if (badge != null && badge > 0) Positioned( key: const Key('home-wallet-badge'), - top: -5, - right: -6, + top: 0, + right: 0, child: Container( constraints: const BoxConstraints(minWidth: 20, minHeight: 16), padding: const EdgeInsets.symmetric(horizontal: 5), diff --git a/test/home/home_nav_ui_test.dart b/test/home/home_nav_ui_test.dart index dd783fd..94de1fc 100644 --- a/test/home/home_nav_ui_test.dart +++ b/test/home/home_nav_ui_test.dart @@ -62,6 +62,18 @@ void main() { tester.getSize(walletEntry), const Size.square(AppDimens.homeActionSlot), ); + expect( + tester.getSize(find.byKey(const Key('home-vip-icon-frame'))), + const Size.square(AppDimens.homeActionIcon), + ); + expect( + tester.getSize(find.byKey(const Key('home-wallet-icon-frame'))), + const Size.square(AppDimens.homeActionIcon), + ); + expect( + tester.getCenter(find.byKey(const Key('home-vip-icon-frame'))).dy, + tester.getCenter(find.byKey(const Key('home-wallet-icon-frame'))).dy, + ); expect( tester.getCenter(vipEntry).dy, closeTo(tester.getCenter(searchEntry).dy, 0.1),