mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-10-21 15:02:21 +02:00
perf(player): reuse artwork decodes across Mornye transitions
This commit is contained in:
1 parent
a5fdb8db92
commit
604a485cf1
4 files changed
+11
-9
No files matched your search
@@ -263,6 +263,7 @@ class _NowPlayingScreenState extends ConsumerState<NowPlayingScreen> {
|
||||
? PlayerArtwork(
|
||||
artUri: mediaItem.artUri?.toString(),
|
||||
colorScheme: colorScheme,
|
||||
cacheWidth: PlayerArtwork.transitionCacheWidth(context),
|
||||
)
|
||||
: artwork(),
|
||||
),
|
||||
|
||||
@@ -41,10 +41,7 @@ class _MornyePlayerArtworkState extends ConsumerState<MornyePlayerArtwork> {
|
||||
child: PlayerArtwork(
|
||||
artUri: widget.mediaItem.artUri?.toString(),
|
||||
colorScheme: Theme.of(context).colorScheme,
|
||||
cacheWidth:
|
||||
(MediaQuery.sizeOf(context).width *
|
||||
MediaQuery.devicePixelRatioOf(context))
|
||||
.round(),
|
||||
cacheWidth: PlayerArtwork.transitionCacheWidth(context),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -333,11 +333,9 @@ class MornyePlayerLayout extends ConsumerWidget {
|
||||
?.toString(),
|
||||
colorScheme: colorScheme,
|
||||
cacheWidth:
|
||||
(360 *
|
||||
MediaQuery.devicePixelRatioOf(
|
||||
context,
|
||||
))
|
||||
.round(),
|
||||
PlayerArtwork.transitionCacheWidth(
|
||||
context,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -20,6 +20,12 @@ class PlayerArtwork extends StatelessWidget {
|
||||
this.iconSize = 40,
|
||||
});
|
||||
|
||||
/// Share one full-size decode while artwork moves between player panels.
|
||||
static int transitionCacheWidth(BuildContext context) =>
|
||||
(MediaQuery.sizeOf(context).width *
|
||||
MediaQuery.devicePixelRatioOf(context))
|
||||
.round();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final placeholder = Container(
|
||||
|
||||
Reference in new issue
Block a user