79759854

Date: 2025-09-09 11:55:33
Score: 0.5
Natty:
Report link

This helped me fix the issue:

Box(
    modifier = Modifier
        .fillMaxWidth(widthPercentage)
        .fillMaxHeight()
        // should not use .background() here
        // use graphicsLayer as a work around to enable alpha compositing
        .graphicsLayer {
            alpha = 0.99f
        }
        .drawWithContent {
            drawRect(
                brush = Brush.horizontalGradient(
                    colors = listOf(
                        Color.Red,
                        Color.Blue,
                    )
                )
            )
            drawRect(
                brush = Brush.verticalGradient(
                    colors = listOf(
                        Color.Black.copy(alpha = 0.6f), // the color doesn't matter
                        Color.Transparent,
                    ),
                ),
                blendMode = BlendMode.DstIn,
            )
        }
)

Result:
enter image description here

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
Posted by: Mehdi Satei