-
@Deprecated(message = accompanist/pager is deprecated. The androidx.compose equivalent of Pager is androidx.compose.foundation.pager.Pager. For more migration information, please visit https://google.github.io/accompanist/pager/#migration ) public class PagerDefaults
Contains the default values used by HorizontalPager and VerticalPager.
-
-
Field Summary
Fields Modifier and Type Field Description private final Function1<SnapperLayoutInfo, Float>singlePageFlingDistanceprivate final Function3<SnapperLayoutInfo, Integer, Integer, Integer>singlePageSnapIndexpublic final static PagerDefaultsINSTANCE
-
Method Summary
Modifier and Type Method Description final FlingBehaviorflingBehavior(PagerState state, DecayAnimationSpec<Float> decayAnimationSpec, AnimationSpec<Float> snapAnimationSpec, Function1<SnapperLayoutInfo, Float> maximumFlingDistance, Dp endContentPadding)Remember the default FlingBehavior that represents the scroll curve. final FlingBehaviorflingBehavior(PagerState state, DecayAnimationSpec<Float> decayAnimationSpec, AnimationSpec<Float> snapAnimationSpec, Dp endContentPadding, Function3<SnapperLayoutInfo, Integer, Integer, Integer> snapIndex)Remember the default FlingBehavior that represents the scroll curve. final FlingBehaviorflingBehavior(PagerState state, DecayAnimationSpec<Float> decayAnimationSpec, AnimationSpec<Float> snapAnimationSpec, Dp endContentPadding)Remember the default FlingBehavior that represents the scroll curve. final Function1<SnapperLayoutInfo, Float>getSinglePageFlingDistance()The default implementation for the maximumFlingDistanceparameter of flingBehavior which limits the fling distance to a single page.final Function3<SnapperLayoutInfo, Integer, Integer, Integer>getSinglePageSnapIndex()The default implementation for the snapIndexparameter of flingBehavior which limits the fling distance to a single page.-
-
Method Detail
-
flingBehavior
final FlingBehavior flingBehavior(PagerState state, DecayAnimationSpec<Float> decayAnimationSpec, AnimationSpec<Float> snapAnimationSpec, Function1<SnapperLayoutInfo, Float> maximumFlingDistance, Dp endContentPadding)
Remember the default FlingBehavior that represents the scroll curve.
Please remember to provide the correct endContentPadding if supplying your own FlingBehavior to VerticalPager or HorizontalPager. See those functions for how they calculate the value.
- Parameters:
state- The PagerState to update.decayAnimationSpec- The decay animation spec to use for decayed flings.snapAnimationSpec- The animation spec to use when snapping.maximumFlingDistance- Block which returns the maximum fling distance in pixels.endContentPadding- The amount of content padding on the end edge of the lazy list in pixels (end/bottom depending on the scrolling direction).
-
flingBehavior
final FlingBehavior flingBehavior(PagerState state, DecayAnimationSpec<Float> decayAnimationSpec, AnimationSpec<Float> snapAnimationSpec, Dp endContentPadding, Function3<SnapperLayoutInfo, Integer, Integer, Integer> snapIndex)
Remember the default FlingBehavior that represents the scroll curve.
Please remember to provide the correct endContentPadding if supplying your own FlingBehavior to VerticalPager or HorizontalPager. See those functions for how they calculate the value.
- Parameters:
state- The PagerState to update.decayAnimationSpec- The decay animation spec to use for decayed flings.snapAnimationSpec- The animation spec to use when snapping.endContentPadding- The amount of content padding on the end edge of the lazy list in pixels (end/bottom depending on the scrolling direction).snapIndex- Block which returns the index to snap to.
-
flingBehavior
final FlingBehavior flingBehavior(PagerState state, DecayAnimationSpec<Float> decayAnimationSpec, AnimationSpec<Float> snapAnimationSpec, Dp endContentPadding)
Remember the default FlingBehavior that represents the scroll curve.
Please remember to provide the correct endContentPadding if supplying your own FlingBehavior to VerticalPager or HorizontalPager. See those functions for how they calculate the value.
- Parameters:
state- The PagerState to update.decayAnimationSpec- The decay animation spec to use for decayed flings.snapAnimationSpec- The animation spec to use when snapping.endContentPadding- The amount of content padding on the end edge of the lazy list in pixels (end/bottom depending on the scrolling direction).
-
getSinglePageFlingDistance
final Function1<SnapperLayoutInfo, Float> getSinglePageFlingDistance()
The default implementation for the
maximumFlingDistanceparameter of flingBehavior which limits the fling distance to a single page.
-
getSinglePageSnapIndex
final Function3<SnapperLayoutInfo, Integer, Integer, Integer> getSinglePageSnapIndex()
The default implementation for the
snapIndexparameter of flingBehavior which limits the fling distance to a single page.
-
-
-
-