Is there a way to animate from `wrapContentWidth()...
# compose
t
Is there a way to animate from
wrapContentWidth()
to
fillMaxWidth()
without using
animateContentSize()
? When I use this modifier it clips the elevation shadow 😕
f
An idea could be that you have a BoxWithConstraints or something similar that gives you info what the maximum width is as well as potentially calculating the "wrap" width of the button. Then animating would still be changing the DP state, but you'd know the values. Alternatively, maybe something with ConstraintLayout, but I haven't used it much. Sorry if I'm not of great help, just sharing ideas!
👍🏽 1
t
That could work indeed 🤔
f
Alternatively something like a Layout composable where you can fetch and store the state of the component size would be a good approach, but it might require more work
t
Yeah I guess this one is a bit more tricky, the
BoxWithContraints
already give the size if I remember it right
f
yeah it gives you the maximum width at least
d
Have you tried having
animateContentSize
modifier on the child of the
Surface
. If you put the modifier directly on the surface, it clips the Surface, along with the shadow. Setting the modifier on a child should work.