keep the theme wrapper stable so the layout doesn't remount when artwork arrives

ArtworkTheme swapped between a bare content() and a MaterialTheme wrapper depending on
whether a scheme existed. When the first track's artwork (or a screen's) resolved, that
branch change remounted the whole subtree, reloading images, resetting scroll and
restarting the mini player. Always provide a MaterialTheme, falling back to the ambient
scheme when there is no artwork, and cover it with a test.
This commit is contained in:
austinried
2026-10-04 00:29:58 +00:00
parent 2ba87114da
commit 6081a5c009
2 changed files with 28 additions and 6 deletions
@@ -204,12 +204,11 @@ fun ArtworkTheme(
colors: ArtworkColors?,
content: @Composable () -> Unit,
) {
val scheme = colors?.scheme
if (scheme == null) {
content()
} else {
MaterialTheme(colorScheme = scheme, typography = SubtracksTypography, content = content)
}
MaterialTheme(
colorScheme = colors?.scheme ?: MaterialTheme.colorScheme,
typography = SubtracksTypography,
content = content,
)
}
fun playerSurfaceColor(artwork: ArtworkColors): Color {