diff --git a/lib/screens/now_playing_screen.dart b/lib/screens/now_playing_screen.dart index 5ca5ef3d..d9bb9bea 100644 --- a/lib/screens/now_playing_screen.dart +++ b/lib/screens/now_playing_screen.dart @@ -1301,8 +1301,6 @@ class _NowPlayingScreenState extends ConsumerState { child: showQueue ? MornyePlayerQueue( colorScheme: colorScheme, - onShuffleLibrary: () => - _shuffleLibrary(controller), ) : _lyricsSection( colorScheme, @@ -1486,10 +1484,7 @@ class _NowPlayingScreenState extends ConsumerState { lyricsOptions: showLyrics ? _lyricsOptionsButton(colorScheme) : null, - queue: MornyePlayerQueue( - colorScheme: colorScheme, - onShuffleLibrary: () => _shuffleLibrary(controller), - ), + queue: MornyePlayerQueue(colorScheme: colorScheme), controls: controls(), volume: const MornyeVolumeControl(), ); diff --git a/lib/widgets/mornye_player_queue.dart b/lib/widgets/mornye_player_queue.dart index 9962cc0b..4fb85f64 100644 --- a/lib/widgets/mornye_player_queue.dart +++ b/lib/widgets/mornye_player_queue.dart @@ -7,18 +7,12 @@ import 'package:spotiflac_android/providers/music_player_provider.dart'; import 'package:spotiflac_android/providers/settings_provider.dart'; import 'package:spotiflac_android/widgets/player_artwork.dart'; import 'package:spotiflac_android/widgets/player_queue_dismissible.dart'; -import 'package:spotiflac_android/widgets/mornye_context_menu.dart'; /// Upcoming tracks share the player's artwork backdrop and transport controls. class MornyePlayerQueue extends ConsumerWidget { - const MornyePlayerQueue({ - super.key, - required this.colorScheme, - required this.onShuffleLibrary, - }); + const MornyePlayerQueue({super.key, required this.colorScheme}); final ColorScheme colorScheme; - final VoidCallback onShuffleLibrary; @override Widget build(BuildContext context, WidgetRef ref) { @@ -89,6 +83,7 @@ class MornyePlayerQueue extends ConsumerWidget { padding: const EdgeInsets.symmetric(horizontal: 28), sliver: SliverToBoxAdapter( child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ @@ -140,59 +135,25 @@ class MornyePlayerQueue extends ConsumerWidget { ), ], ), - const SizedBox(height: 12), - Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - context.l10n.mornyeContinuePlaying, - style: type.titleLarge?.copyWith( - color: Colors.white, - ), - ), - if (autoplay && - playback.repeat == AudioServiceRepeatMode.none) - Text( - context.l10n.autoplayFromLibrary, - style: type.bodySmall?.copyWith( - color: Colors.white70, - ), - ), - ], + Padding( + padding: const EdgeInsets.symmetric(vertical: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context.l10n.mornyeContinuePlaying, + style: type.titleLarge?.copyWith(color: Colors.white), ), - ), - Builder( - builder: (buttonContext) => IconButton( - tooltip: MaterialLocalizations.of( - context, - ).moreButtonTooltip, - icon: const Icon( - CupertinoIcons.ellipsis, - color: Colors.white, - ), - onPressed: () => showMornyeContextMenu( - context: buttonContext, - builder: (menuContext) => MornyeContextMenu( - groups: [ - [ - MornyeMenuAction( - icon: CupertinoIcons.shuffle, - label: context.l10n.nowPlayingShuffleLibrary, - onPressed: () { - Navigator.pop(menuContext); - onShuffleLibrary(); - }, - ), - ], - ], + if (autoplay && + playback.repeat == AudioServiceRepeatMode.none) + Text( + context.l10n.autoplayFromLibrary, + style: type.bodySmall?.copyWith( + color: Colors.white70, ), ), - ), - ), - ], + ], + ), ), ], ), diff --git a/lib/widgets/player_queue_dismissible.dart b/lib/widgets/player_queue_dismissible.dart index 8d6efa95..f63d5a37 100644 --- a/lib/widgets/player_queue_dismissible.dart +++ b/lib/widgets/player_queue_dismissible.dart @@ -1,4 +1,7 @@ +import 'package:flutter/cupertino.dart' show CupertinoColors, CupertinoIcons; import 'package:flutter/material.dart'; +import 'package:spotiflac_android/l10n/l10n.dart'; +import 'package:spotiflac_android/theme/mornye_theme.dart'; /// Removing a row affects the queue only, never the song on disk. class PlayerQueueDismissible extends StatelessWidget { @@ -23,19 +26,46 @@ class PlayerQueueDismissible extends StatelessWidget { onRemove(); return false; }, - background: Container( - alignment: AlignmentDirectional.centerEnd, - padding: const EdgeInsets.symmetric(horizontal: 20), - decoration: BoxDecoration( - color: Theme.of(context).colorScheme.error, - borderRadius: BorderRadius.circular(12), - ), - child: Icon( - Icons.delete_outline, - color: Theme.of(context).colorScheme.onError, - semanticLabel: MaterialLocalizations.of(context).deleteButtonTooltip, - ), - ), + background: context.isMornye + ? Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: Align( + alignment: AlignmentDirectional.centerEnd, + child: SizedBox.square( + dimension: 48, + child: DecoratedBox( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: CupertinoColors.systemRed.resolveFrom(context), + border: Border.all( + color: Colors.white.withValues(alpha: 0.18), + ), + ), + child: Icon( + CupertinoIcons.minus, + color: Colors.white, + size: 24, + semanticLabel: context.l10n.dialogRemove, + ), + ), + ), + ), + ) + : Container( + alignment: AlignmentDirectional.centerEnd, + padding: const EdgeInsets.symmetric(horizontal: 20), + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.error, + borderRadius: BorderRadius.circular(12), + ), + child: Icon( + Icons.delete_outline, + color: Theme.of(context).colorScheme.onError, + semanticLabel: MaterialLocalizations.of( + context, + ).deleteButtonTooltip, + ), + ), child: child, ); } diff --git a/test/mornye_player_queue_test.dart b/test/mornye_player_queue_test.dart index 03cdb207..615ec06a 100644 --- a/test/mornye_player_queue_test.dart +++ b/test/mornye_player_queue_test.dart @@ -44,7 +44,6 @@ void main() { 'upcoming queue maps taps and reorders to the complete playback queue', (tester) async { final player = _Player(); - var libraryShuffles = 0; final queue = [ for (final name in ['Previous', 'Current', 'Next', 'Last']) MediaItem(id: name, title: name, artist: 'Artist'), @@ -68,10 +67,7 @@ void main() { localizationsDelegates: AppLocalizations.localizationsDelegates, supportedLocales: AppLocalizations.supportedLocales, home: Scaffold( - body: MornyePlayerQueue( - colorScheme: theme.colorScheme, - onShuffleLibrary: () => libraryShuffles++, - ), + body: MornyePlayerQueue(colorScheme: theme.colorScheme), ), ), ), @@ -108,14 +104,10 @@ void main() { expect(player.shuffled, isTrue); await tester.tap(find.byIcon(CupertinoIcons.repeat)); expect(player.repeat, AudioServiceRepeatMode.all); - await tester.tap(find.byIcon(CupertinoIcons.ellipsis)); - await tester.pumpAndSettle(); + expect(find.byIcon(CupertinoIcons.ellipsis), findsNothing); final shuffleLibrary = AppLocalizations.of( tester.element(find.byType(MornyePlayerQueue)), ).nowPlayingShuffleLibrary; - await tester.tap(find.text(shuffleLibrary)); - await tester.pumpAndSettle(); - expect(libraryShuffles, 1); expect(find.text(shuffleLibrary), findsNothing); expect(find.text('Next'), findsOneWidget); expect(tester.takeException(), isNull);