Hello folks, Anyone has idea why `shadow` modifier...
# compose-android
a
Hello folks, Anyone has idea why
shadow
modifier doesn't render properly if parent composable is a
Surface
? If it is under
Box
, it is rendered correctly. Couldn't find in the documentation. In the attached screenshots, notice the sharp edge if parent is
Surface
. TIA Snippet in 🧵
Copy code
Surface( //Or Box

    modifier = Modifier
        .background(Color.White.copy(alpha = 0.2f))
        .padding(50.dp)
) {
    val shape = RoundedCornerShape(8.dp)
    val backgroundColor = Color.Yellow
    Row(
    modifier = Modifier
        .shadow(
            color = Color.Red.copy(alpha = 0.12f),
            offsetY = 4.dp, blurRadius = 8.dp, spread = 4.dp
        )
        .clip(shape)
        .background(
            color = backgroundColor,
            shape = shape
        )
        .border(
            width = 1.dp,
            color = Color.Red,
            shape = shape
        )
    ) {
        //Text content
    }
}
s
The Surface is clipping content by design, as defined by the Material Design component specification.
👍 1
thank you color 1
☝️ 1