Skip to content

Instantly share code, notes, and snippets.

@mazzouzi
Last active September 23, 2022 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mazzouzi/e5dc70b4db33f368016f541b92924162 to your computer and use it in GitHub Desktop.
Save mazzouzi/e5dc70b4db33f368016f541b92924162 to your computer and use it in GitHub Desktop.
Header composable
private val headerHeight = 275.dp
@Composable
private fun Header() {
val headerHeightPx = with(LocalDensity.current) { headerHeight.toPx() }
Box(modifier = Modifier.fillMaxWidth().height(headerHeight)) {
Image(
painter = painterResource(id = R.drawable.bg_pexel),
contentDescription = "",
contentScale = ContentScale.FillBounds
)
Box(
Modifier
.fillMaxSize()
.background(
brush = Brush.verticalGradient(
colors = listOf(Color.Transparent, Color(0xAA000000)),
startY = 3 * headerHeightPx / 4 // to wrap the title only
)
)
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment