public object CarouselDefaults
Contains the default values used by Carousel.
Properties
MinSmallItemSize
public val MinSmallItemSize: Dp = 40.dp
The minimum size that a carousel strategy can choose its small items to be. *
MaxSmallItemSize
public val MaxSmallItemSize: Dp = 56.dp
The maximum size that a carousel strategy can choose its small items to be. *
Functions
singleAdvanceFlingBehavior
@Composable
public fun singleAdvanceFlingBehavior(
state: CarouselState,
snapAnimationSpec: AnimationSpec<Float> = spring(stiffness = Spring.StiffnessMediumLow),
): TargetedFlingBehavior
A TargetedFlingBehavior that limits a fling to one item at a time. snapAnimationSpec can be used to control the snap animation.
Parameters
| state | The CarouselState that controls which Carousel this TargetedFlingBehavior will be applied to. |
| snapAnimationSpec | The animation spec used to finally snap to the position. |
Return
An instance of TargetedFlingBehavior that performs snapping to the next item. The animation will be governed by the post scroll velocity and the Carousel will use snapAnimationSpec to approach the snapped position
multiBrowseFlingBehavior
@Composable
public fun multiBrowseFlingBehavior(
state: CarouselState,
decayAnimationSpec: DecayAnimationSpec<Float> = rememberSplineBasedDecay(),
snapAnimationSpec: AnimationSpec<Float> = spring(stiffness = Spring.StiffnessMediumLow),
): TargetedFlingBehavior
A TargetedFlingBehavior that flings without a limited distance and snaps to a final item according to the gesture's velocity.
The Carousel may use decayAnimationSpec or snapAnimationSpec to approach the target item (calculated using the fling velocity) post-scroll. If the gesture has a high enough velocity to approach the target item, the Carousel will use decayAnimationSpec followed by snapAnimationSpec for the final step of the animation. If the gesture doesn't have enough velocity, it will use snapAnimationSpec to reach the snapped position.
Parameters
| state | The CarouselState that controls which Carousel this TargetedFlingBehavior will be applied to. |
| decayAnimationSpec | The animation spec used to approach the target offset when the the fling velocity is large enough to naturally decay. |
| snapAnimationSpec | The animation spec used to finally snap to the position. |
Return
An instance of TargetedFlingBehavior that performs flinging based on the gesture velocity and then snapping to the closest item post-fling. The animation will be governed by the post scroll velocity and the Carousel will use snapAnimationSpec to approach the snapped position
noSnapFlingBehavior
@Composable
public fun noSnapFlingBehavior(): TargetedFlingBehavior
A TargetedFlingBehavior that flings according to the gesture velocity and does not snap post-fling.
Return
An instance of TargetedFlingBehavior that performs flinging based on the gesture velocity and does not snap to anything post-fling.