Swipe Button State
In accordance with the Compose state management pattern, this class encapsulates the physical interaction logic (dragging, progress, and thresholds) while remaining agnostic of the visual styling.
Parameters
The normalized value (0.0 to 1.0) that the user must drag beyond to trigger the completion state. Defaults to 0.9 (90%).
Callback invoked when the button successfully reaches the completed state.
Callback invoked when the button is reset from completed to idle.
Callback providing real-time updates of the drag progress (0.0 to 1.0).
Constructors
Properties
Whether the swipe action has been successfully completed. When true, the button typically transforms into a loading or success indicator.
Indicates whether the user is currently interacting with the slider.
The internal animatable progress of the swipe (0f = start, 1f = end).
Functions
Animates the slider back to the start position. Usually called when the user releases the drag before reaching the confirmThreshold.
Transitions the state to completed and animates the progress to 100%.
Immediately sets the state to completed without playing an animation.
Immediately resets the state to idle without playing an animation.
Resets the button to its initial idle state with an animation.
Updates the current swipe progress instantly.