public 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.
Properties
isScrollAwayValid
public val isScrollAwayValid: 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.
isScrollable
public val isScrollable: Boolean
Whether the container is currently scrollable.
isScrollInProgress
public val isScrollInProgress: Boolean
Whether the list is currently scrolling (which can be used to show/hide a scroll indicator or time text during the scroll operation).
anchorItemOffset
public val anchorItemOffset: 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). 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.
lastItemOffset
public val lastItemOffset: Float
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.