PagerSnapDistance
[PagerSnapDistance] defines the way the [Pager] will treat the distance between the current page
PagerSnapDistance
Interface
Common
interface PagerSnapDistance
PagerSnapDistance defines the way the Pager will treat the distance between the current page
and the page where it will settle.
Functions
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. |
Returns
| 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. |
