clamp the now playing title and subtitle heights

This commit is contained in:
austinried
2026-10-04 00:29:54 +00:00
parent c145fe51f0
commit 3ebf59dd21
@@ -195,33 +195,36 @@ fun NowPlayingScreen(
) )
} }
val density = LocalDensity.current val density = LocalDensity.current
val titleHeight =
with(density) {
MaterialTheme.typography.headlineSmall.lineHeight
.toDp()
}
val subtitleHeight =
with(density) {
MaterialTheme.typography.bodyMedium.lineHeight
.toDp()
}
Column( Column(
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(6.dp),
modifier = modifier =
Modifier Modifier
.padding(top = 28.dp) .padding(top = 28.dp)
.height( .height(titleHeight + 6.dp + subtitleHeight),
with(density) {
MaterialTheme.typography.headlineSmall.lineHeight
.toDp() +
6.dp +
MaterialTheme.typography.bodyMedium.lineHeight
.toDp()
},
),
) { ) {
Text( Text(
text = state.item?.title.orEmpty(), text = state.item?.title.orEmpty(),
style = titleStyle, style = titleStyle,
maxLines = 1, maxLines = 1,
modifier = Modifier.basicMarquee(), modifier = Modifier.height(titleHeight).basicMarquee(),
) )
Text( Text(
text = listOfNotNull(state.item?.artist, state.item?.album).joinToString(" • "), text = listOfNotNull(state.item?.artist, state.item?.album).joinToString(" • "),
style = subtitleStyle, style = subtitleStyle,
color = MaterialTheme.colorScheme.onSurfaceVariant, color = MaterialTheme.colorScheme.onSurfaceVariant,
maxLines = 1, maxLines = 1,
modifier = Modifier.padding(top = 6.dp).basicMarquee(), modifier = Modifier.height(subtitleHeight).basicMarquee(),
) )
} }
SeekBar( SeekBar(