🌈 Create new beautiful Compose Gradients with our new wesite ->
Interface

PagerSnapDistance

PagerSnapDistance defines the way the Pager will treat the distance between the current page and the page where it will settle.

Source set: Common
public interface PagerSnapDistance

PagerSnapDistance defines the way the Pager will treat the distance between the current page and the page where it will settle.

Functions

calculateTargetPage

Source set: Common
public fun calculateTargetPage(
        startPage: Int,
        suggestedTargetPage: Int,
        velocity: Float,
        pageSize: Int,
        pageSpacing: Int,
    ): Int

Provides a chance to change where the Pager fling will settle.

Parameters

startPage The current page right before the fling starts.
suggestedTargetPage The proposed target page where this fling will stop. This target will be the page that will be correctly positioned (snapped) after naturally decaying with velocity using a DecayAnimationSpec.
velocity The initial fling velocity.
pageSize The page size for this Pager in pixels.
pageSpacing The spacing used between pages in pixels.

Return

An updated target page where to settle. Note that this value needs to be between 0 and the total count of pages in this pager. If an invalid value is passed, the pager will coerce within the valid values.

Members

Companion

Source set: Common
public companion object

Functions

atMost

Source set: Common
public fun atMost(pages: Int): PagerSnapDistance

Limits the maximum number of pages that can be flung per fling gesture.

Parameters

pages The maximum number of extra pages that can be flung at once.

Content updated: