If I have a `Box` with two composables of differen...
# compose
d
If I have a
Box
with two composables of different height and use `AnimateVisibility`/`AnimateContent` so that one of them is removed, what is the best way to make this
Box
stay with
height = max(composable1.height, composable2.height)
? Otherwise layout content jumps which doesn't look good.
2
d
You could configure
contentAlignment
for
AnimatedContent
to center the content of different height. Combined with the default size animation it should give you a smooth change of the content instead of jump.
d
Animation itself is smooth. The problem is that after animation is finished all content which is underneath the animated Layout is shifted up or down. And I want it to stay in place. I drew this rough picture to explain 🙂
d
😄 Thanks for the diagram. If there is a guarantee that large content will show first, you could create a layout modifier that returns the largest height seen in the MeasureResult. But if either one can show first, you won't know the size of something that isn't in the tree.
👍 1