Prevent quick details from using more veritical space if not enough horizontal space (#544)

## Description
Prevents the quick details (the dot separated details) from using more
vertical space if there is not enough horizontal space. Instead, the row
will be clipped at the total width.

This PR also gives more horizontal space to the details header on grid
pages. This matches the home page now.

### Related issues
Fixes #542
This commit is contained in:
Ray 2025-12-22 19:16:12 -05:00 committed by GitHub
parent 9a08cf3f25
commit 2b53a53155
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 4 deletions

View file

@ -846,8 +846,7 @@ fun CollectionFolderGridContent(
item = focusedItem, item = focusedItem,
modifier = modifier =
Modifier Modifier
.fillMaxWidth(.6f) .fillMaxWidth()
// .fillMaxHeight(.25f)
.height(140.dp) .height(140.dp)
.padding(16.dp), .padding(16.dp),
) )

View file

@ -20,14 +20,17 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.CircleShape
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.tv.material3.LocalTextStyle import androidx.tv.material3.LocalTextStyle
@ -54,22 +57,24 @@ fun DotSeparatedRow(
text = text, text = text,
style = textStyle, style = textStyle,
color = MaterialTheme.colorScheme.onSurface, color = MaterialTheme.colorScheme.onSurface,
maxLines = 1,
) )
if (communityRating != null || criticRating != null || index != texts.lastIndex) { if (communityRating != null || criticRating != null || index != texts.lastIndex) {
Dot() Dot()
} }
} }
val height = with(LocalDensity.current) { textStyle.fontSize.toDp() }
communityRating?.let { communityRating?.let {
SimpleStarRating( SimpleStarRating(
communityRating = it, communityRating = it,
modifier = Modifier, modifier = Modifier.height(height),
) )
if (criticRating != null) { if (criticRating != null) {
Dot() Dot()
} }
} }
criticRating?.let { criticRating?.let {
TomatoRating(it) TomatoRating(it, Modifier.height(height))
} }
} }
} }

View file

@ -102,6 +102,7 @@ fun SimpleStarRating(
if (text.isNotNullOrBlank()) { if (text.isNotNullOrBlank()) {
Text( Text(
text = text, text = text,
maxLines = 1,
modifier = Modifier, modifier = Modifier,
) )
val height = with(LocalDensity.current) { LocalTextStyle.current.fontSize.toDp() } val height = with(LocalDensity.current) { LocalTextStyle.current.fontSize.toDp() }
@ -130,6 +131,7 @@ fun TomatoRating(
CompositionLocalProvider(LocalContentColor provides MaterialTheme.colorScheme.onSurface) { CompositionLocalProvider(LocalContentColor provides MaterialTheme.colorScheme.onSurface) {
Text( Text(
text = rating.toInt().toString() + "%", text = rating.toInt().toString() + "%",
maxLines = 1,
modifier = Modifier, modifier = Modifier,
) )
} }