Package-level declarations
Types
Link copied to clipboard
class SwipeButtonState(val confirmThreshold: Float = 0.9f, onComplete: () -> Unit = {}, onReset: () -> Unit = {}, onProgressChanged: (Float) -> Unit = {})
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.
Functions
Link copied to clipboard
fun DashedSwipeButton(modifier: Modifier = Modifier, text: String = "Swipe to confirm", state: SwipeButtonState = rememberSwipeButtonState(), indicatorColor: Color = MaterialTheme.colorScheme.primary)
A pre-styled SwipeButton featuring a dashed border effect.
Link copied to clipboard
fun FilledSwipeButton(modifier: Modifier = Modifier, text: String = "Swipe to confirm", state: SwipeButtonState = rememberSwipeButtonState(), containerColor: Color = MaterialTheme.colorScheme.primary)
A pre-styled SwipeButton with a solid filled background.
Link copied to clipboard
fun OutlinedSwipeButton(modifier: Modifier = Modifier, text: String = "Swipe to confirm", state: SwipeButtonState = rememberSwipeButtonState(), outlineColor: Color = MaterialTheme.colorScheme.primary)
A pre-styled SwipeButton with an outlined border and transparent background.
Link copied to clipboard
fun rememberSwipeButtonState(confirmThreshold: Float = 0.9f, onComplete: () -> Unit = {}, onReset: () -> Unit = {}, onProgressChanged: (Float) -> Unit = {}): SwipeButtonState
Creates and remembers a SwipeButtonState across recompositions.
Link copied to clipboard
fun SwipeButton(modifier: Modifier = Modifier, state: SwipeButtonState = rememberSwipeButtonState(), isEnabled: Boolean = true, isContentFollow: Boolean = true, cornerRadius: Dp = 12.dp, contentAlphaFactor: Float = 1.5f, widthAnimationSpec: AnimationSpec<Dp> = tween(500), cornerAnimationSpec: AnimationSpec<Dp> = tween(500), restAnimationSpec: AnimationSpec<Float> = spring(stiffness = Spring.StiffnessLow), completeAnimationSpec: AnimationSpec<Float> = tween(300), resetAnimationSpec: AnimationSpec<Float> = tween(300), background: @Composable (enabled: Boolean) -> Unit = {}, content: @Composable (progress: Float) -> Unit, indicator: @Composable (progress: Float) -> Unit, completedContent: @Composable () -> Unit)
This component features smooth animations, state management, and transitions between idle and completed states (where the button collapses into a circular progress indicator).