Hey everyone, How can I have a clickable Surface ...
# compose
t
Hey everyone, How can I have a clickable Surface with elevation and shape? When I do
Modifier.clip(shape).clickable {}
, the Surface loses its elevation
f
Surface has shape parameter
And I think even clickable overload
Actually that might've been Card
t
Surface’s shape parameter doesn’t clip the ripple effect. There is an experimental overload that accepts onClick, but I figured I’d ask first, before using experimental apis
f
You can just try making a
Box
inside
Surface
clickable and
clip
that
👍 5
t
Yep, that’ll work, thanks!
👌 1
a
It doesn’t clip the ripple because you are setting clickable modifier yourself instead of using the overload with
onClick
parameter. Experimental just means the api might change in the future and is safe to use. The doc also says:
If you want to have a Surface that handles clicks, consider using another overload.