interface ScrollInfoProvider


An interface for providing scroll information for different scrollable containers, such lists. Used for scrolling away, showing, hiding or scaling screen elements based on scrollable state.

ScrollInfoProvider can be used to create a ScrollAway modifier, typically applied to an object that appears at the top of the screen to scroll it away vertically when a list is scrolled upwards. The scrolled offset is typically calculated with reference to the position of an anchor e.g. the top item.

Summary

Public properties

Float

The amount that the anchor item has been scrolled upwards in the y direction (in Pixels), relative to the initial position of the scrolling container (so >= zero).

Boolean

Whether it is valid to scroll away the anchor item with the current configuration, For example, if the selected anchor item does not exist, it is not valid to scroll away.

Boolean

Whether the list is currently scrolling (which can be used to show/hide a scroll indicator or time text during the scroll operation).

Boolean

Whether the container is currently scrollable.

Float

The amount of space between the last item (which may not be visible) and the bottom edge of the viewport.

Public properties

anchorItemOffset

Added in 1.5.0-alpha07
val anchorItemOffsetFloat

The amount that the anchor item has been scrolled upwards in the y direction (in Pixels), relative to the initial position of the scrolling container (so >= zero). In the event that the anchor item is no longer visible on the screen and its offset cannot be calculated, the returned offset is Float.NaN.

isScrollAwayValid

Added in 1.5.0-alpha07
val isScrollAwayValidBoolean

Whether it is valid to scroll away the anchor item with the current configuration, For example, if the selected anchor item does not exist, it is not valid to scroll away.

isScrollInProgress

Added in 1.5.0-alpha07
val isScrollInProgressBoolean

Whether the list is currently scrolling (which can be used to show/hide a scroll indicator or time text during the scroll operation).

isScrollable

Added in 1.5.0-alpha07
val isScrollableBoolean

Whether the container is currently scrollable.

lastItemOffset

Added in 1.5.0-alpha07
val lastItemOffsetFloat

The amount of space between the last item (which may not be visible) and the bottom edge of the viewport. This is always greater or equal to 0, if there is no (or negative) room (including the case in which the last item is not on screen), 0 should be returned.