Hitanshu Dhawan

    Hitanshu Dhawan

    1 year ago
    Hey, what’s the best way to achieve this kind of animation? Should I use
    IntPropKey()
    and set the x,y coordinates using
    Layout
    composable? or is there any better way of achieving this?
    Is it possible to know the previous state of the composable without making it stateful.? My use case. As in the above video when going from 1 -> 2 there is a different animation than when going from 2 -> 1. So, I have made different states for these 2 cases, but I need to know the previous state (quantity) to decide the next state, it depends on whether user inc or dec the quantity. How can I achieve this use case?
    jim

    jim

    1 year ago
    You're ultimately going to need to store that information somewhere. To remain stateless probably the best you can do is hoist the state up: https://developer.android.com/jetpack/compose/state#stateless-composables