perf(player): reuse artwork decodes across Mornye transitions

This commit is contained in:
zarzet committed 2026-10-05 19:20:04 +07:00
1 parent a5fdb8db92
commit 604a485cf1
4 files changed
+11 -9

No files matched your search

+1
View File
@@ -263,6 +263,7 @@ class _NowPlayingScreenState extends ConsumerState<NowPlayingScreen> {
? PlayerArtwork(
artUri: mediaItem.artUri?.toString(),
colorScheme: colorScheme,
cacheWidth: PlayerArtwork.transitionCacheWidth(context),
)
: artwork(),
),
+1 -4
View File
@@ -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),
),
),
);
+3 -5
View File
@@ -333,11 +333,9 @@ class MornyePlayerLayout extends ConsumerWidget {
?.toString(),
colorScheme: colorScheme,
cacheWidth:
(360 *
MediaQuery.devicePixelRatioOf(
context,
))
.round(),
PlayerArtwork.transitionCacheWidth(
context,
),
),
),
),
+6
View File
@@ -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(