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( MediaHero(
imageUrl = episode.heroImageUrl, imageUrl = episode.heroImageUrl,
backgroundColor = MaterialTheme.colorScheme.background, backgroundColor = MaterialTheme.colorScheme.background,
height = 250.dp, heightFraction = 0.30f,
modifier = Modifier.fillMaxWidth() modifier = Modifier.fillMaxWidth()
) )
EpisodeDetails( EpisodeDetails(

View File

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

View File

@@ -91,7 +91,7 @@ private fun SeriesScreenInternal(
) { ) {
MediaHero( MediaHero(
imageUrl = series.heroImageUrl, imageUrl = series.heroImageUrl,
height = 250.dp, heightFraction = 0.30f,
backgroundColor = MaterialTheme.colorScheme.background, backgroundColor = MaterialTheme.colorScheme.background,
modifier = Modifier.fillMaxWidth() 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.Brush
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale 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 @Composable
fun MediaHero( fun MediaHero(
imageUrl: String, imageUrl: String,
backgroundColor: Color, backgroundColor: Color,
height: Dp, heightFraction: Float = 0.4f,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
) { ) {
val screenHeight = LocalConfiguration.current.screenHeightDp.dp
val heroHeight = screenHeight * heightFraction
Box( Box(
modifier = modifier modifier = modifier
.height(height) .height(heroHeight)
.background(backgroundColor) .background(backgroundColor)
) { ) {
PurefinAsyncImage( PurefinAsyncImage(