Any idea what would cause a shadow around card com...
# compose
z
Any idea what would cause a shadow around card composable appear with like a thick black border? In the preview or if I try the same in another app, it looks correct 🤔
Copy code
Card(
    shape = RoundedCornerShape(8.dp),
    elevation = 10.dp
)
c
Do you have any more code to show? What composable is this composable nested in?
z
Basically just in the Column, something like:
Copy code
Column(
    modifier = modifier
        .fillMaxSize()
        .background(Color.White)
) {
    Card(
        shape = RoundedCornerShape(8.dp),
        elevation = 10.dp
    )
}
c
Anything in your theme or something? The fact that you say that if you try in another app and it works seems to point that some wrapper composable/theme is the culprit
👍 1
z
I was thinking about theme too but it’s like a first composable in the whole app, I tried to wrap it in
MaterialTheme
but result was the same. Although there is a custom theme set in `AndroidManifest`… 💭
c
If you could upload the entire project or gist that repos the issue I'll try it on my end.
z
Unfortunately I can’t share the project. This shadow style is definitely coming from the application theme setting in
AndroidManifest
, I just need to find out which flag is it 😬. I’m quite surprised that wrapping the composable into
MaterialTheme
doesn’t override it though
found in sources:
Copy code
* The opacity of the final ambient shadow is a function of the shadow caster height, the
     * alpha channel of the [ambientShadowColor] (typically opaque), and the
     * [android.R.attr.ambientShadowAlpha] theme attribute.
c
Nice find!
c
Yeah sharing the theme and the Composable parent would be useful to help diagnose things further
z
The reason
ambientShadowAlpha
was changed is described here. I have quite a mix feeling now about adopting Compose to an existing app (especially really big ones), relaying on an XML based settings in such way can be really hard to find later on.