feat: Use fraction for the size of MediaHero component

This commit is contained in:
2026-02-18 15:53:24 +01:00
parent 88a8f6f90d
commit e7d2fa3d62
4 changed files with 10 additions and 6 deletions

View File

@@ -73,7 +73,7 @@ private fun EpisodeScreenInternal(
MediaHero(
imageUrl = episode.heroImageUrl,
backgroundColor = MaterialTheme.colorScheme.background,
height = 250.dp,
heightFraction = 0.30f,
modifier = Modifier.fillMaxWidth()
)
EpisodeDetails(

View File

@@ -92,7 +92,7 @@ private fun MovieScreenInternal(
MediaHero(
imageUrl = movie.heroImageUrl,
backgroundColor = MaterialTheme.colorScheme.background,
height = 250.dp,
heightFraction = 0.30f,
modifier = Modifier.fillMaxWidth()
)
MovieDetails(

View File

@@ -91,7 +91,7 @@ private fun SeriesScreenInternal(
) {
MediaHero(
imageUrl = series.heroImageUrl,
height = 250.dp,
heightFraction = 0.30f,
backgroundColor = MaterialTheme.colorScheme.background,
modifier = Modifier.fillMaxWidth()
)

View File

@@ -9,18 +9,22 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.unit.dp
@Composable
fun MediaHero(
imageUrl: String,
backgroundColor: Color,
height: Dp,
heightFraction: Float = 0.4f,
modifier: Modifier = Modifier,
) {
val screenHeight = LocalConfiguration.current.screenHeightDp.dp
val heroHeight = screenHeight * heightFraction
Box(
modifier = modifier
.height(height)
.height(heroHeight)
.background(backgroundColor)
) {
PurefinAsyncImage(