From d36d62f6a6d3b552c38e08213d3a0f6aa32a3f42 Mon Sep 17 00:00:00 2001 From: Zhou Weidong <502333560@qq.com> Date: Tue, 20 Oct 2026 13:48:42 +0800 Subject: [PATCH] =?UTF-8?q?fix(flutter):=20=E5=8E=BB=E9=99=A4=E5=85=B3?= =?UTF-8?q?=E6=B3=A8=20tab=20=E5=B9=B6=E5=8A=A0=E6=B7=B1=E8=89=B2=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E5=AF=BC=E8=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/core/widgets/app_bottom_nav.dart | 35 +++++++++++++------ lib/l10n/app_en.arb | 1 - lib/l10n/app_id.arb | 1 - lib/l10n/app_localizations.dart | 6 ---- lib/l10n/app_localizations_en.dart | 3 -- lib/l10n/app_localizations_id.dart | 3 -- lib/l10n/app_localizations_zh.dart | 3 -- lib/l10n/app_zh.arb | 1 - lib/pages/home/home_view.dart | 1 + .../widgets/home_feed_overlay_parts.dart | 7 ++-- test/home/home_nav_ui_test.dart | 22 ++++++++++-- test/home/k28_a_navigation_test.dart | 4 +-- 12 files changed, 48 insertions(+), 39 deletions(-) diff --git a/lib/core/widgets/app_bottom_nav.dart b/lib/core/widgets/app_bottom_nav.dart index 231deec..8905618 100644 --- a/lib/core/widgets/app_bottom_nav.dart +++ b/lib/core/widgets/app_bottom_nav.dart @@ -26,18 +26,20 @@ class AppBottomNavItem { final bool selected; } -/// 四槽底部导航,仅做浅色暖橙视觉换肤。 +/// 四槽底部导航:首页 feed 用深色样式,其它页面保持浅色暖橙风格。 class AppBottomNav extends StatelessWidget { const AppBottomNav({ super.key, required this.items, this.backgroundColor = AppColors.bar, this.barKey, + this.dark = false, }); final List items; final Color backgroundColor; final Key? barKey; + final bool dark; @override Widget build(BuildContext context) { @@ -50,11 +52,25 @@ class AppBottomNav extends StatelessWidget { key: barKey, height: AppDimens.navHeight, decoration: BoxDecoration( - color: backgroundColor.withValues(alpha: 0.95), - border: const Border(top: BorderSide(color: AppColors.border)), + color: dark + ? const Color(0xE6000000) + : backgroundColor.withValues(alpha: 0.95), + border: Border( + top: BorderSide( + color: dark ? Colors.white12 : AppColors.border, + ), + ), ), child: Row( - children: [for (final item in items) _NavDestination(item: item)], + children: [ + for (final item in items) + _NavDestination( + item: item, + unselectedColor: dark + ? Colors.white70 + : AppColors.navUnselected, + ), + ], ), ), ), @@ -64,9 +80,10 @@ class AppBottomNav extends StatelessWidget { } class _NavDestination extends StatelessWidget { - const _NavDestination({required this.item}); + const _NavDestination({required this.item, required this.unselectedColor}); final AppBottomNavItem item; + final Color unselectedColor; @override Widget build(BuildContext context) => Expanded( @@ -89,9 +106,7 @@ class _NavDestination extends StatelessWidget { child: Icon( item.selected ? item.selectedIcon : item.icon, size: AppDimens.navIcon, - color: item.selected - ? AppColors.blue - : AppColors.navUnselected, + color: item.selected ? AppColors.blue : unselectedColor, ), ), const SizedBox(height: 2), @@ -102,9 +117,7 @@ class _NavDestination extends StatelessWidget { style: TextStyle( fontSize: AppDimens.navLabel, fontWeight: item.selected ? FontWeight.w700 : FontWeight.w500, - color: item.selected - ? AppColors.blue - : AppColors.navUnselected, + color: item.selected ? AppColors.blue : unselectedColor, letterSpacing: 0, ), ), diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 0483ed0..bd73cbc 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -44,7 +44,6 @@ "episodes": {"type": "String"} } }, - "feedTabFollowing": "Following", "feedTabAnime": "Anime", "feedTabReal": "Live-action", "feedTabForYou": "For you", diff --git a/lib/l10n/app_id.arb b/lib/l10n/app_id.arb index 98312cb..8ae2c4c 100644 --- a/lib/l10n/app_id.arb +++ b/lib/l10n/app_id.arb @@ -33,7 +33,6 @@ "watchFullscreen": "Layar penuh", "seriesMeta": "Serial · {episodes} eps | {viewers} menonton", "watchFullSeries": "Tonton serial lengkap · {episodes} eps", - "feedTabFollowing": "Mengikuti", "feedTabAnime": "Anime", "feedTabReal": "Live-action", "feedTabForYou": "Untukmu", diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index b01c917..1da0b30 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -298,12 +298,6 @@ abstract class AppLocalizations { /// **'Watch full series · {episodes} eps'** String watchFullSeries(String episodes); - /// No description provided for @feedTabFollowing. - /// - /// In en, this message translates to: - /// **'Following'** - String get feedTabFollowing; - /// No description provided for @feedTabAnime. /// /// In en, this message translates to: diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 2a273c4..a0b04dc 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -114,9 +114,6 @@ class AppLocalizationsEn extends AppLocalizations { return 'Watch full series · $episodes eps'; } - @override - String get feedTabFollowing => 'Following'; - @override String get feedTabAnime => 'Anime'; diff --git a/lib/l10n/app_localizations_id.dart b/lib/l10n/app_localizations_id.dart index c257713..f0d6374 100644 --- a/lib/l10n/app_localizations_id.dart +++ b/lib/l10n/app_localizations_id.dart @@ -114,9 +114,6 @@ class AppLocalizationsId extends AppLocalizations { return 'Tonton serial lengkap · $episodes eps'; } - @override - String get feedTabFollowing => 'Mengikuti'; - @override String get feedTabAnime => 'Anime'; diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index 3ca6a26..1f82f34 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -111,9 +111,6 @@ class AppLocalizationsZh extends AppLocalizations { return '观看完整剧集 · 全$episodes集'; } - @override - String get feedTabFollowing => '关注'; - @override String get feedTabAnime => '漫剧'; diff --git a/lib/l10n/app_zh.arb b/lib/l10n/app_zh.arb index 1c89f23..039959f 100644 --- a/lib/l10n/app_zh.arb +++ b/lib/l10n/app_zh.arb @@ -33,7 +33,6 @@ "watchFullscreen": "全屏观看", "seriesMeta": "系列剧 · 共{episodes}集 | 共{viewers}人在追", "watchFullSeries": "观看完整剧集 · 全{episodes}集", - "feedTabFollowing": "关注", "feedTabAnime": "漫剧", "feedTabReal": "真人剧", "feedTabForYou": "推荐", diff --git a/lib/pages/home/home_view.dart b/lib/pages/home/home_view.dart index d1e878a..084ecae 100644 --- a/lib/pages/home/home_view.dart +++ b/lib/pages/home/home_view.dart @@ -198,6 +198,7 @@ class _HomeTabsState extends State<_HomeTabs> { Widget _nav(BuildContext context, AppLocalizations l10n) { return AppBottomNav( barKey: const Key('home-tabs-bar'), + dark: logic.tab == 0, items: [ _navItem(context, l10n, 0), _navItem(context, l10n, 1), diff --git a/lib/pages/player/widgets/home_feed_overlay_parts.dart b/lib/pages/player/widgets/home_feed_overlay_parts.dart index 629c157..aed95ef 100644 --- a/lib/pages/player/widgets/home_feed_overlay_parts.dart +++ b/lib/pages/player/widgets/home_feed_overlay_parts.dart @@ -2,24 +2,21 @@ part of 'home_feed_overlay.dart'; -/// 顶部频道 tab:关注/漫剧点击提示即将上线。 +/// 顶部频道 tab:漫剧点击提示即将上线。 enum _FeedTab { - following, anime, real, recommend; - bool get comingSoon => this == _FeedTab.following || this == _FeedTab.anime; + bool get comingSoon => this == _FeedTab.anime; String get keyName => switch (this) { - _FeedTab.following => 'follow', _FeedTab.anime => 'anime', _FeedTab.real => 'real', _FeedTab.recommend => 'recommend', }; String label(AppLocalizations l10n) => switch (this) { - _FeedTab.following => l10n.feedTabFollowing, _FeedTab.anime => l10n.feedTabAnime, _FeedTab.real => l10n.feedTabReal, _FeedTab.recommend => l10n.feedTabForYou, diff --git a/test/home/home_nav_ui_test.dart b/test/home/home_nav_ui_test.dart index 40b220d..763eb84 100644 --- a/test/home/home_nav_ui_test.dart +++ b/test/home/home_nav_ui_test.dart @@ -52,9 +52,21 @@ void main() { final bar = tester.widget(barFinder); final decoration = bar.decoration as BoxDecoration; final border = decoration.border as Border; - expect(decoration.color, AppColors.bar.withValues(alpha: 0.95)); - expect(border.top.color, AppColors.border); - expect(border.top.color, isNot(Colors.white)); + // 首页 feed 用深色导航。 + expect(decoration.color, const Color(0xE6000000)); + expect(border.top.color, Colors.white12); + expect( + tester + .widget( + find.descendant( + of: find.byKey(const Key('tab-theater')), + matching: find.text('Theater'), + ), + ) + .style + ?.color, + Colors.white70, + ); expect( tester .widget( @@ -88,6 +100,10 @@ void main() { await tester.tap(find.byKey(const Key('tab-theater'))); await tester.pumpAndSettle(); expect(haptics.selectionClicks, 1); + final lightBar = tester.widget(barFinder); + final lightDecoration = lightBar.decoration as BoxDecoration; + expect(lightDecoration.color, AppColors.bar.withValues(alpha: 0.95)); + expect((lightDecoration.border as Border).top.color, AppColors.border); await tester.tap(find.byKey(const Key('tab-theater'))); await tester.pumpAndSettle(); expect(haptics.selectionClicks, 1); diff --git a/test/home/k28_a_navigation_test.dart b/test/home/k28_a_navigation_test.dart index 79bc0c4..148bdf8 100644 --- a/test/home/k28_a_navigation_test.dart +++ b/test/home/k28_a_navigation_test.dart @@ -77,7 +77,7 @@ void main() { expect(find.byKey(const Key('player-episodes-sheet')), findsOneWidget); }); - testWidgets('should_show_coming_soon_for_danmaku_and_following_tab', ( + testWidgets('should_show_coming_soon_for_danmaku_and_anime_tab', ( tester, ) async { await _pumpApp(tester); @@ -86,7 +86,7 @@ void main() { await tester.pump(); expect(find.text('Coming soon'), findsOneWidget); - await tester.tap(find.byKey(const Key('home-feed-tab-follow'))); + await tester.tap(find.byKey(const Key('home-feed-tab-anime'))); await tester.pump(); expect(find.text('Coming soon'), findsOneWidget); });