Skip to content

Commit

Permalink
dhonti/ANDROID-15405-postercard: Update use the "cardContentOverlay" …
Browse files Browse the repository at this point in the history
…in background shadow main content text
  • Loading branch information
dhonti-axpe committed Nov 27, 2024
1 parent 573a304 commit faf034f
Showing 1 changed file with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shadow
import androidx.compose.ui.graphics.SolidColor
Expand All @@ -31,7 +30,13 @@ internal fun PosterCardMainContent(
Column(
modifier = modifier
.fillMaxWidth()
.background(brush = buildTextBackgroundGradientBrush(backgroundType = backgroundType))
.background(
brush = if (backgroundType.inverseDisplay) {
MisticaTheme.brushes.cardContentOverlay
} else {
SolidColor(Color.Transparent)
}
)
.padding(
top = 16.dp,
start = 16.dp,
Expand Down Expand Up @@ -117,16 +122,3 @@ internal fun buildPosterCardTextShadow() = Shadow(
color = Color.Black.copy(alpha = 0.4f),
blurRadius = 15f
)

private fun buildTextBackgroundGradientBrush(backgroundType: PosterCardBackgroundType): Brush =
if (backgroundType.inverseDisplay) {
Brush.verticalGradient(
colorStops = arrayOf(
0.0f to Color.Black.copy(alpha = 0f),
0.3f to Color.Black.copy(alpha = 0.4f),
1.0f to Color.Black.copy(alpha = 0.7f)
)
)
} else {
SolidColor(Color.Transparent)
}

0 comments on commit faf034f

Please sign in to comment.