PositionIndicatorState

interface PositionIndicatorState


An object representing the relative position of a scrollbar or rolling side button or rotating bezel position. This interface is implemented by classes that adapt other state information such as ScalingLazyListState or ScrollState of scrollable containers or to represent the position of say a volume control that can be 'ticked' using a rolling side button or rotating bezel.

Implementing classes provide positionFraction to determine where in the range 0..1 that the indicator should be displayed and sizeFraction to determine the size of the indicator in the range 0..1. E.g. If a ScalingLazyListState had 50 items and the last 5 were visible it would have a position of 1.0f to show that the scroll is positioned at the end of the list and a size of 5 / 50 = 0.1f to indicate that 10% of the visible items are currently visible.

Summary

Public functions

@FloatRange(from = 0.0, to = 1.0) Float
sizeFraction(scrollableContainerSizePx: @FloatRange(from = 0.0) Float)

Size of the indicator in the range 0f,1f.

PositionIndicatorVisibility
visibility(scrollableContainerSizePx: @FloatRange(from = 0.0) Float)

Should we show the Position Indicator

Public properties

Float

Position of the indicator in the range 0f,1f.

Public functions

sizeFraction

Added in 1.0.0
fun sizeFraction(scrollableContainerSizePx: @FloatRange(from = 0.0) Float): @FloatRange(from = 0.0, to = 1.0) Float

Size of the indicator in the range 0f,1f. 1f means it takes the whole space.

Parameters
scrollableContainerSizePx: @FloatRange(from = 0.0) Float

the height or width of the container in pixels depending on orientation of the indicator, (height for vertical, width for horizontal)

visibility

Added in 1.0.0
fun visibility(scrollableContainerSizePx: @FloatRange(from = 0.0) Float): PositionIndicatorVisibility

Should we show the Position Indicator

Parameters
scrollableContainerSizePx: @FloatRange(from = 0.0) Float

the height or width of the container in pixels depending on orientation of the indicator, (height for vertical, width for horizontal)

Public properties

positionFraction

Added in 1.0.0
val positionFractionFloat

Position of the indicator in the range 0f,1f. 0f means it is at the top|start, 1f means it is positioned at the bottom|end.