fix(offline): move Shuffle all from Home to Library only
Operator: Shuffle-all belongs in the Library view, not the Home app bar. Moved the shuffle IconButton to LibraryScreen's app bar (same behavior — online server-random / offline cache-union via shuffleSourceProvider); reverted Home's app bar to the original MainAppBarActions-only and dropped the now-unused imports. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,9 +4,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
||||||
import '../api/errors.dart';
|
import '../api/errors.dart';
|
||||||
import '../cache/shuffle_source.dart';
|
|
||||||
import '../cache/tile_providers.dart';
|
import '../cache/tile_providers.dart';
|
||||||
import '../player/player_provider.dart';
|
|
||||||
import '../models/playlist.dart';
|
import '../models/playlist.dart';
|
||||||
import '../models/system_playlists_status.dart';
|
import '../models/system_playlists_status.dart';
|
||||||
import '../models/track.dart';
|
import '../models/track.dart';
|
||||||
@@ -43,28 +41,7 @@ class HomeScreen extends ConsumerWidget {
|
|||||||
backgroundColor: fs.obsidian,
|
backgroundColor: fs.obsidian,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
title: Text('Minstrel', style: TextStyle(color: fs.parchment)),
|
title: Text('Minstrel', style: TextStyle(color: fs.parchment)),
|
||||||
actions: [
|
actions: const [MainAppBarActions(currentRoute: '/home')],
|
||||||
IconButton(
|
|
||||||
key: const Key('shuffle_all_button'),
|
|
||||||
tooltip: 'Shuffle all',
|
|
||||||
icon: Icon(Icons.shuffle, color: fs.parchment),
|
|
||||||
onPressed: () async {
|
|
||||||
final messenger = ScaffoldMessenger.of(context);
|
|
||||||
final refs =
|
|
||||||
await ref.read(shuffleSourceProvider).tracks();
|
|
||||||
if (refs.isEmpty) {
|
|
||||||
messenger.showSnackBar(const SnackBar(
|
|
||||||
content: Text('Nothing to shuffle yet'),
|
|
||||||
));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await ref
|
|
||||||
.read(playerActionsProvider)
|
|
||||||
.playTracks(refs, shuffle: true);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const MainAppBarActions(currentRoute: '/home'),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: index.when(
|
child: index.when(
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import '../cache/cache_first.dart';
|
|||||||
import '../cache/connectivity_provider.dart';
|
import '../cache/connectivity_provider.dart';
|
||||||
import '../cache/db.dart';
|
import '../cache/db.dart';
|
||||||
import '../cache/metadata_prefetcher.dart';
|
import '../cache/metadata_prefetcher.dart';
|
||||||
|
import '../cache/shuffle_source.dart';
|
||||||
import '../cache/tile_providers.dart';
|
import '../cache/tile_providers.dart';
|
||||||
import '../library/library_providers.dart' show dioProvider;
|
import '../library/library_providers.dart' show dioProvider;
|
||||||
import '../models/album.dart';
|
import '../models/album.dart';
|
||||||
@@ -377,7 +378,27 @@ class _LibraryScreenState extends ConsumerState<LibraryScreen>
|
|||||||
backgroundColor: fs.obsidian,
|
backgroundColor: fs.obsidian,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
title: Text('Library', style: TextStyle(color: fs.parchment)),
|
title: Text('Library', style: TextStyle(color: fs.parchment)),
|
||||||
actions: const [MainAppBarActions(currentRoute: '/library')],
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
key: const Key('shuffle_all_button'),
|
||||||
|
tooltip: 'Shuffle all',
|
||||||
|
icon: Icon(Icons.shuffle, color: fs.parchment),
|
||||||
|
onPressed: () async {
|
||||||
|
final messenger = ScaffoldMessenger.of(context);
|
||||||
|
final refs = await ref.read(shuffleSourceProvider).tracks();
|
||||||
|
if (refs.isEmpty) {
|
||||||
|
messenger.showSnackBar(const SnackBar(
|
||||||
|
content: Text('Nothing to shuffle yet'),
|
||||||
|
));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await ref
|
||||||
|
.read(playerActionsProvider)
|
||||||
|
.playTracks(refs, shuffle: true);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const MainAppBarActions(currentRoute: '/library'),
|
||||||
|
],
|
||||||
bottom: TabBar(
|
bottom: TabBar(
|
||||||
controller: _ctrl,
|
controller: _ctrl,
|
||||||
isScrollable: true,
|
isScrollable: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user