From 334db07283f4e758b5949cecbc033b8a8b32cd7f Mon Sep 17 00:00:00 2001 From: zarzet <42882290+zarzet@users.noreply.github.com> Date: Fri, 23 Oct 2026 23:14:38 +0700 Subject: [PATCH] fix(player): give the phone navigation bar the cover scheme The Material mini player took the playing cover's scheme while the navigation bar under it kept the app's, so the bottom chrome changed color halfway down. The bar, its indicator and the shared backdrop now take the same artwork scheme as the mini player, and return to the app scheme when nothing with readable artwork is playing. Only this scope listens to the track, so a cover change does not rebuild the shell. --- lib/screens/main_shell.dart | 83 +++++++++++++++++++++++-------------- 1 file changed, 52 insertions(+), 31 deletions(-) diff --git a/lib/screens/main_shell.dart b/lib/screens/main_shell.dart index 4717ef6ab..9148afc67 100644 --- a/lib/screens/main_shell.dart +++ b/lib/screens/main_shell.dart @@ -49,6 +49,7 @@ import 'package:mornye/widgets/app_icon.dart'; import 'package:mornye/widgets/app_loading_indicator.dart'; import 'package:mornye/widgets/mornye_chrome.dart'; import 'package:mornye/theme/mornye_theme.dart'; +import 'package:mornye/theme/player_artwork_theme.dart'; import 'package:mornye/widgets/selection_bottom_bar.dart'; import 'package:mornye/widgets/desktop/desktop_commands.dart'; import 'package:mornye/widgets/desktop/desktop_inspector.dart'; @@ -1156,38 +1157,58 @@ class _MainShellState extends ConsumerState ), ); } - final bottomBar = Column( - mainAxisSize: MainAxisSize.min, - children: [ - const MiniPlayer(), - // The bar's container fill separates it; no divider, so - // the mini player and the bar read as one surface. - if (!useNavigationRail) - ExpressiveNavigationBar( - selectedIndex: _currentIndex.clamp(0, maxIndex), - onDestinationSelected: _onNavTap, - isTablet: isTablet, - backgroundColor: settingsGroupColor( - context, - ).withValues(alpha: 0.72), - destinations: destinations, + final blurEnabled = ref.watch(backdropBlurEnabledProvider); + // The mini player and the bar read as one surface, so the bar + // takes the playing track's artwork scheme too; with nothing + // playing both keep the app scheme. Only this scope listens + // to the track, so a cover change does not rebuild the shell. + return Consumer( + builder: (context, ref, child) => PlayerArtworkTheme( + artUri: ref.watch( + currentMediaItemProvider.select( + (item) => item.value?.artUri?.toString(), ), - ], - ); - // The backdrop blur re-filters everything scrolling underneath on - // every frame; low-end devices get an opaque base instead unless - // the user forces blur on in appearance settings. - if (!ref.watch(backdropBlurEnabledProvider)) { - return ColoredBox( - color: settingsGroupColor(context), - child: bottomBar, - ); - } - return ClipRect( - child: BackdropFilter( - filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), - blendMode: BlendMode.src, - child: bottomBar, + ), + child: child!, + ), + child: Builder( + builder: (context) { + final bottomBar = Column( + mainAxisSize: MainAxisSize.min, + children: [ + const MiniPlayer(), + // The bar's container fill separates it; no divider, + // so the mini player and the bar read as one surface. + if (!useNavigationRail) + ExpressiveNavigationBar( + selectedIndex: _currentIndex.clamp(0, maxIndex), + onDestinationSelected: _onNavTap, + isTablet: isTablet, + backgroundColor: settingsGroupColor( + context, + ).withValues(alpha: 0.72), + destinations: destinations, + ), + ], + ); + // The backdrop blur re-filters everything scrolling + // underneath on every frame; low-end devices get an + // opaque base instead unless the user forces blur on in + // appearance settings. + if (!blurEnabled) { + return ColoredBox( + color: settingsGroupColor(context), + child: bottomBar, + ); + } + return ClipRect( + child: BackdropFilter( + filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), + blendMode: BlendMode.src, + child: bottomBar, + ), + ); + }, ), ); },