Add this code to make drag animation resets smoother:
varoffsetXbyremember{mutableStateOf(0f)}valdraggableState=DraggableState{delta->offsetX+=delta}Box(modifier=Modifier.draggable(orientation=Orientation.Horizontal,state=draggableState,onDragStopped={draggableState.drag(MutatePriority.PreventUserInput){Animatable(offsetX).animateTo(targetValue=0f,tween(durationMillis=300)){dragBy(value-offsetX)}}})){//The Column is the item that will do the movingColumn(modifier=Modifier.offset{IntOffset(offsetX.roundToInt(),0)}){}}
Conclusion
Thank you for taking the time out of your day to read this blog post of mine. If you have any questions or concerns please comment below or reach out to me on Twitter.
Top comments (0)
Subscribe
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)