Trying to draw `Text` with a horizontal gradient. ...
# compose
t
Trying to draw
Text
with a horizontal gradient. After much trial and error, found that this works only if I specify
alpha = 0.99f
in the
graphicsLayer
(output in ๐Ÿงต) Can someone explain why? ๐Ÿ˜–
Copy code
Text(
    text = "$ 20",
    modifier = Modifier.graphicsLayer(alpha = 0.99f)
        .drawWithCache {
            val brush = Brush.horizontalGradient(listOf(StartColor, EndColor))
            onDrawWithContent {
                drawContent()
                drawRect(brush, blendMode = BlendMode.SrcAtop)
            }
        },
)
๐Ÿ‘ 1
output
t
Oh wow, I thought I was going crazy! Thanks ๐Ÿ˜…
๐Ÿ‘ 2
c
@Tash how'd this end up working for you. I got some acceptance criteria to build this out today and wanted to give your code a shot.
c
oh wayyy cool. repo. love the pokemon card!
๐Ÿ™๐Ÿผ 1
๐Ÿ˜… 1