mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-29 21:02:09 +02:00
Reuse downloaded motion artwork for local and downloaded album headers, with static fallbacks and reduced-motion support. Opening an album does not trigger an artwork search or download.
17 lines
724 B
Dart
17 lines
724 B
Dart
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:spotiflac_android/services/motion_artwork_store.dart';
|
|
|
|
typedef PlayerArtworkAlbum = ({String album, String artist});
|
|
|
|
final motionArtworkStoreProvider = Provider((ref) => MotionArtworkStore());
|
|
|
|
/// Player and local album pages read artwork already saved with a download.
|
|
/// Opening either must never search extensions or download more artwork.
|
|
final playerMotionArtworkProvider = FutureProvider.autoDispose
|
|
.family<MotionArtwork?, PlayerArtworkAlbum>((ref, album) async {
|
|
if (album.album.trim().isEmpty || album.artist.trim().isEmpty) {
|
|
return null;
|
|
}
|
|
return ref.watch(motionArtworkStoreProvider).find(album);
|
|
});
|