Jetpack Compose Text Gradient Background With Shodow Text

December 17, 2021
Text(
    modifier = Modifier.align(Alignment.BottomStart).background(
        brush = Brush.verticalGradient(
            colors = listOf(
                Color.White.copy(alpha = 0.0f),
                Color.Black.copy(alpha = 0.9f)
            )
        )
    ).padding(4.dp, 10.dp, 4.dp, 4.dp).fillMaxWidth(),
    style = MaterialTheme.typography.body1.copy(
        shadow = Shadow(
            color = Color.DarkGray,
            offset = Offset(2f, 2f),
            blurRadius = 1.5f
        )
    ),
    color = Color.White,
    maxLines = 1,
    overflow = TextOverflow.Ellipsis,
    text = "Hello World",
)
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.