https://kotlinlang.org logo
#compose
Title
# compose
a

Afzal Najam

10/26/2020, 1:42 AM
Is the opacity of the
drawShadow
modifier supposed to change the opacity of the whole Box? Changing the
0.3f
opacity changes the opacity of the whole box and its contents. Simplified example:
Copy code
@Composable
private fun StrangeButton() {
    Box(
        modifier = Modifier.then(
            Modifier.drawShadow(
                elevation = 4.dp,
                opacity = 0.3f
            )
        ).then(
            Modifier.background(
                color = Color.Green
            )
        )
    ) {
        Image(
            asset = Icons.Default.Person,
            colorFilter = ColorFilter.tint(Color.White)
        )
    }
}
z

Zach Klippenstein (he/him) [MOD]

10/26/2020, 1:45 AM
Pretty sure it's not, I'd file a bug
FYI you can write your modifiers more concisely:
Copy code
Modifier
  .drawShadow(…)
  .background(…)
☝️ 1
🎉 1
a

Afzal Najam

10/26/2020, 2:05 AM
Done: https://issuetracker.google.com/issues/171624638 Thanks for that tip @Zach Klippenstein (he/him) [MOD]!