mirror of
https://github.com/bbara04/Purefin.git
synced 2026-03-31 17:10:08 +02:00
feat: Use fraction for the size of MediaHero component
This commit is contained in:
@@ -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(
|
||||||
|
|||||||
@@ -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(
|
||||||
|
|||||||
@@ -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()
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -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(
|
||||||
|
|||||||
Reference in New Issue
Block a user