Thread
#compose
    deniskrr

    deniskrr

    1 year ago
    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)
    Vitor Prado

    Vitor Prado

    1 year ago
    gradient modifier:
    fun Modifier.verticalGradientBackground(colors: List<Color>, alpha: Float = 1f) =
        background(brush = Brush.verticalGradient(colors = colors), alpha = alpha)
    layout:
    NetworkImage(
                    collection.coverUrl,
                    modifier = Modifier
                        .fillMaxWidth()
                        .aspectRatio(16f / 9f)
                )
    
                Box(modifier = Modifier
                    .fillMaxWidth()
                    .aspectRatio(16f / 9f)
                    .verticalGradientBackground(
                        listOf(AppColors.leBleu, AppColors.gradientDarkColor),
                        alpha = .5f
                    )
                )
    deniskrr

    deniskrr

    1 year ago
    Works 😄 Thank you very much @Vitor Prado
    Vitor Prado

    Vitor Prado

    1 year ago
    you can write your own gradient modifier and use in all images.