Hey :smile: Does anyone know how I can draw a tra...
# compose
d
Hey 😄 Does anyone know how I can draw a transparent gradient over an image? I’m trying to achieve this: (there’s a black gradient starting from the bottom)
v
gradient modifier:
Copy code
fun Modifier.verticalGradientBackground(colors: List<Color>, alpha: Float = 1f) =
    background(brush = Brush.verticalGradient(colors = colors), alpha = alpha)
layout:
Copy code
NetworkImage(
                collection.coverUrl,
                modifier = Modifier
                    .fillMaxWidth()
                    .aspectRatio(16f / 9f)
            )

            Box(modifier = Modifier
                .fillMaxWidth()
                .aspectRatio(16f / 9f)
                .verticalGradientBackground(
                    listOf(AppColors.leBleu, AppColors.gradientDarkColor),
                    alpha = .5f
                )
            )
👍 4
d
Works 😄 Thank you very much @Vitor Prado
v
you can write your own gradient modifier and use in all images.