In this post, we will see how to resolve Idomatic way of using animateDpAsState in padding jetpack compose
Question:I am learning animateDpAsState from the doc. I did it without any problem, but I see a lot of recomposing happens. So I want to know what is the recommended way of doing this?
Best Answer:Instead of animating the top padding, you can do something different applying a y-translation with the
graphicsLayermodifier with the lambda block that causes the layer properties update without triggering recomposition and relayout.
You can apply it to the
Columnor to each children.
If you have better answer, please add a comment about this, thank you!