• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Idomatic way of using animateDpAsState in padding jetpack compose

Resolved: Idomatic way of using animateDpAsState in padding jetpack compose

0
By Isaac Tonny on 15/03/2023 Issue
Share
Facebook Twitter LinkedIn

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?
PaddingViewAnimationStateLess
When first time button click animation happens and I can see in layout inspector. I don’t know this is normal or we can fix this problem. Thanks
enter image description here

Best Answer:

Instead of animating the top padding, you can do something different applying a y-translation with the graphicsLayer modifier with the lambda block that causes the layer properties update without triggering recomposition and relayout.
You can apply it to the Column or to each children.
Something like:

If you have better answer, please add a comment about this, thank you!

Source: Stackoverflow.com

android android-jetpack-compose android-jetpack-compose-animation jetpack-compose-animation kotlin
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Reshape tensors of unknown shape with tf.function

26/03/2023

Resolved: Use Svelte Component as Slot

26/03/2023

Resolved: Vaadin 14.9 – Redirect on Session Destroy Event

26/03/2023

Comments are closed.

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.