diff --git a/docs/plans/PROGRESS.md b/docs/plans/PROGRESS.md index c29f445..420ef2b 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 热区、28 彩色图标,透明背景、间距 12,保留礼物角标。 +- 搜索框右侧皇冠与礼物使用 28 图片图标,缺图时回退原彩色 Icon;透明热区、间距和角标不变。 - 播放量贴封面右下角(底 2、右 6),火焰图标 11 + 12/w400 纯文字,间距 4,并保留极淡底部渐变。 - 修复二级 chip 运行时颜色误用 `const TextStyle` 的编译错误,并校正相关测试 Finder 类型。 - 全部短剧的地区、字幕、配音筛选 UI 已占位;以下接口待补:地区、字幕/配音筛选数据。 diff --git a/lib/pages/home/widgets/home_grid_header.dart b/lib/pages/home/widgets/home_grid_header.dart index 5891547..04931ed 100644 --- a/lib/pages/home/widgets/home_grid_header.dart +++ b/lib/pages/home/widgets/home_grid_header.dart @@ -143,7 +143,9 @@ class HomeGridHeader extends StatelessWidget { _headerAction( key: const Key('home-vip-entry'), frameKey: const Key('home-vip-icon-frame'), - icon: Icons.workspace_premium_outlined, + imageKey: const Key('home-vip-image'), + assetPath: 'assets/icon/crown.png', + fallbackIcon: Icons.workspace_premium_outlined, color: AppColors.homeCrownGold, tooltip: l10n.vipMembership, onTap: callbacks.onOpenVip, @@ -152,7 +154,9 @@ class HomeGridHeader extends StatelessWidget { _headerAction( key: const Key('home-wallet-entry'), frameKey: const Key('home-wallet-icon-frame'), - icon: Icons.card_giftcard_rounded, + imageKey: const Key('home-wallet-image'), + assetPath: 'assets/icon/gift.png', + fallbackIcon: Icons.card_giftcard_rounded, color: AppColors.homeGiftPink, tooltip: l10n.wallet, onTap: callbacks.onOpenWallet, @@ -166,7 +170,9 @@ class HomeGridHeader extends StatelessWidget { Widget _headerAction({ required Key key, required Key frameKey, - required IconData icon, + required Key imageKey, + required String assetPath, + required IconData fallbackIcon, required Color color, required String tooltip, required VoidCallback onTap, @@ -189,10 +195,17 @@ class HomeGridHeader extends StatelessWidget { child: SizedBox.square( key: frameKey, dimension: AppDimens.homeActionIcon, - child: Icon( - icon, - size: AppDimens.homeActionIcon, - color: color, + child: Image.asset( + assetPath, + key: imageKey, + width: AppDimens.homeActionIcon, + height: AppDimens.homeActionIcon, + fit: BoxFit.contain, + errorBuilder: (_, _, _) => Icon( + fallbackIcon, + size: AppDimens.homeActionIcon, + color: color, + ), ), ), ), diff --git a/pubspec.yaml b/pubspec.yaml index 5951cc5..2133e43 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -81,6 +81,7 @@ flutter: # the material Icons class. uses-material-design: true assets: + - assets/icon/ - assets/icon/splash_logo.png - assets/icon/splash_logo_android12.png - assets/icon/rail/ diff --git a/test/home/home_nav_ui_test.dart b/test/home/home_nav_ui_test.dart index 94de1fc..b1d78ad 100644 --- a/test/home/home_nav_ui_test.dart +++ b/test/home/home_nav_ui_test.dart @@ -74,6 +74,14 @@ void main() { tester.getCenter(find.byKey(const Key('home-vip-icon-frame'))).dy, tester.getCenter(find.byKey(const Key('home-wallet-icon-frame'))).dy, ); + final crownImage = tester.widget( + find.byKey(const Key('home-vip-image')), + ); + final giftImage = tester.widget( + find.byKey(const Key('home-wallet-image')), + ); + expect((crownImage.image as AssetImage).assetName, 'assets/icon/crown.png'); + expect((giftImage.image as AssetImage).assetName, 'assets/icon/gift.png'); expect( tester.getCenter(vipEntry).dy, closeTo(tester.getCenter(searchEntry).dy, 0.1),