From 0d2680e6c170eaaa5baf42eebfecda357af38ae0 Mon Sep 17 00:00:00 2001 From: Zhou Weidong <502333560@qq.com> Date: Tue, 20 Oct 2026 16:39:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(flutter):=20=E4=BF=AE=E5=A4=8D=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E5=86=B7=E5=90=AF=E5=8A=A8=E7=81=B0=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/core/widgets/remote_image.dart | 4 +++- lib/pages/player/player_view.dart | 8 +++++++- test/home/k28_a_navigation_test.dart | 1 + test/player/player_fullscreen_test.dart | 9 ++++++++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/core/widgets/remote_image.dart b/lib/core/widgets/remote_image.dart index fd3a490..60d10be 100644 --- a/lib/core/widgets/remote_image.dart +++ b/lib/core/widgets/remote_image.dart @@ -16,6 +16,7 @@ class RemoteImage extends StatelessWidget { this.showFallbackIcon = false, this.fallbackIconKey, this.fallbackAspectRatio, + this.fallbackColor = AppColors.bar, }); final String path; @@ -25,6 +26,7 @@ class RemoteImage extends StatelessWidget { final bool showFallbackIcon; final Key? fallbackIconKey; final double? fallbackAspectRatio; + final Color fallbackColor; @override Widget build(BuildContext context) { @@ -47,7 +49,7 @@ class RemoteImage extends StatelessWidget { final fallback = Container( width: width, height: height, - color: AppColors.bar, + color: fallbackColor, alignment: Alignment.center, child: showFallbackIcon ? Icon( diff --git a/lib/pages/player/player_view.dart b/lib/pages/player/player_view.dart index b03546d..186c370 100644 --- a/lib/pages/player/player_view.dart +++ b/lib/pages/player/player_view.dart @@ -300,6 +300,11 @@ class _PlayerPageState extends State with WidgetsBindingObserver { return Stack( fit: StackFit.expand, children: [ + if (widget.homeMode) + const ColoredBox( + key: Key('home-feed-black-background'), + color: Colors.black, + ), if (!ready) _PlayerFallbackBackground(posterUrl: drama.posterUrl), ?video, if (widget.homeMode && _chromeVisible && !logic.chromeHidden) @@ -580,10 +585,11 @@ class _PlayerFallbackBackground extends StatelessWidget { posterUrl, key: const Key('player-fallback-cover'), fit: BoxFit.cover, + fallbackColor: Colors.black, ), const ColoredBox( key: Key('player-fallback-scrim'), - color: Color(0x66000000), + color: Color(0x4D000000), ), ], ); diff --git a/test/home/k28_a_navigation_test.dart b/test/home/k28_a_navigation_test.dart index 89324f9..31a6fe0 100644 --- a/test/home/k28_a_navigation_test.dart +++ b/test/home/k28_a_navigation_test.dart @@ -59,6 +59,7 @@ void main() { expect(find.byKey(const Key('home-feed-title')), findsOneWidget); expect(find.byKey(const Key('home-feed-full-series')), findsOneWidget); + expect(find.byKey(const Key('home-feed-black-background')), findsOneWidget); expect(find.byType(PageView), findsOneWidget); expect(find.byKey(const Key('home-browse-page')), findsNothing); expect( diff --git a/test/player/player_fullscreen_test.dart b/test/player/player_fullscreen_test.dart index 2e17534..c01d548 100644 --- a/test/player/player_fullscreen_test.dart +++ b/test/player/player_fullscreen_test.dart @@ -13,6 +13,7 @@ import 'package:fruitshorts/core/data/repositories/favorite_repository.dart'; import 'package:fruitshorts/core/data/repositories/playback_repository.dart'; import 'package:fruitshorts/core/data/repositories/watch_history_repository.dart'; import 'package:fruitshorts/core/theme/app_colors.dart'; +import 'package:fruitshorts/core/widgets/remote_image.dart'; import 'package:fruitshorts/pages/player/widgets/player_center_toggle.dart'; import 'package:fruitshorts/pages/player/widgets/seek_progress_bar.dart'; @@ -333,11 +334,17 @@ void main() { final fallback = find.byKey(const Key('player-fallback-background')); expect(fallback, findsOneWidget); expect(find.byKey(const Key('player-fallback-cover')), findsOneWidget); + expect( + tester + .widget(find.byKey(const Key('player-fallback-cover'))) + .fallbackColor, + Colors.black, + ); expect( tester .widget(find.byKey(const Key('player-fallback-scrim'))) .color, - const Color(0x66000000), + const Color(0x4D000000), ); expect( tester