CarouselDefaults
-
Cmn
@ExperimentalMaterial3Api
object CarouselDefaults
Contains the default values used by Carousel.
Summary
Public functions |
||
|---|---|---|
TargetedFlingBehavior |
@ComposableA |
Cmn
|
TargetedFlingBehavior |
A |
Cmn
|
TargetedFlingBehavior |
@ComposableA |
Cmn
|
Public properties |
||
|---|---|---|
Dp |
The maximum size that a carousel strategy can choose its small items to be. * |
Cmn
|
Dp |
The minimum size that a carousel strategy can choose its small items to be. * |
Cmn
|
Public functions
multiBrowseFlingBehavior
@Composable
fun multiBrowseFlingBehavior(
state: CarouselState,
decayAnimationSpec: DecayAnimationSpec<Float> = rememberSplineBasedDecay(),
snapAnimationSpec: AnimationSpec<Float> = spring(stiffness = Spring.StiffnessMediumLow)
): TargetedFlingBehavior
A TargetedFlingBehavior that flings and snaps according to the gesture velocity. snapAnimationSpec and decayAnimationSpec can be used to control the animation specs.
The Carousel may use decayAnimationSpec or snapAnimationSpec to approach the target item post-scroll, depending on the gesture velocity. 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 + snapAnimationSpec in a similar fashion.
| Parameters | |
|---|---|
state: CarouselState |
The |
decayAnimationSpec: DecayAnimationSpec<Float> = rememberSplineBasedDecay() |
The animation spec used to approach the target offset when the the fling velocity is large enough to naturally decay. |
snapAnimationSpec: AnimationSpec<Float> = spring(stiffness = Spring.StiffnessMediumLow) |
The animation spec used to finally snap to the position. |
| Returns | |
|---|---|
TargetedFlingBehavior |
An instance of |
noSnapFlingBehavior
@Composable
fun noSnapFlingBehavior(): TargetedFlingBehavior
A TargetedFlingBehavior that flings according to the gesture velocity and does not snap post-fling.
| Returns | |
|---|---|
TargetedFlingBehavior |
An instance of |
singleAdvanceFlingBehavior
@Composable
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: CarouselState |
The |
snapAnimationSpec: AnimationSpec<Float> = spring(stiffness = Spring.StiffnessMediumLow) |
The animation spec used to finally snap to the position. |
| Returns | |
|---|---|
TargetedFlingBehavior |
An instance of |
Public properties
MaxSmallItemSize
val MaxSmallItemSize: Dp
The maximum size that a carousel strategy can choose its small items to be. *
MinSmallItemSize
val MinSmallItemSize: Dp
The minimum size that a carousel strategy can choose its small items to be. *