Chris Fillmore
02/14/2022, 8:13 PMblurRadius
required for Shadow
to be visible? I am just trying to use shadow in a TextStyle. If I don’t specify a non-zero blur radius, there is no shadow. This seems unexpected. I’d expect to be able to use shadow without blur. I’m on compose 1.2.0-alpha02
Chris Sinco [G]
02/14/2022, 11:01 PMSiyamed
02/14/2022, 11:03 PMChris Fillmore
02/14/2022, 11:06 PMChris Fillmore
02/15/2022, 3:37 PMNader Jawad
02/15/2022, 7:45 PMChris Fillmore
02/15/2022, 7:47 PMNader Jawad
02/15/2022, 7:48 PMChris Fillmore
02/15/2022, 7:51 PMText
nodes, one of them with an offset. If no-blur shadow was desired.Nader Jawad
02/15/2022, 7:55 PMChris Fillmore
02/15/2022, 7:57 PMNader Jawad
02/15/2022, 7:58 PMChris Fillmore
02/15/2022, 8:00 PMval text = "my text"
Text(
text = text,
modifier = Modifier.offset(-4f, 4f),
)
Text(
text = text,
)
I think this should produce a basic shadow with no blurNader Jawad
02/15/2022, 8:00 PMSiyamed
02/15/2022, 8:30 PMNader Jawad
02/15/2022, 8:31 PMSiyamed
02/15/2022, 8:35 PMNader Jawad
02/15/2022, 8:38 PMModifier.graphicsLayer
the shadow API that is used on text is part of Paint.setShadowLayer which behaves differently. The latter actually existed before the former however has had different levels of support as Android evolved from being software rendered to hardware rendered and moving away from and back to Skia as the underlying graphics frameworkSiyamed
02/15/2022, 9:06 PMChris Fillmore
02/15/2022, 9:06 PMChris Sinco [G]
02/15/2022, 10:00 PMCSS can generate shadows that are not consistent from a physical standpointWhile this is true, the reality is many designer tools and other UI toolkits on other platforms handle shadows this way (not the Android single-light source way), so it’s reasonable to have this confusion with Android development when the mockup says “build this shadow but make it hard and not blurry” and the APIs + rendered results look different.