# PositionIndicatorState

# PositionIndicatorState

Artifact:[androidx.wear.compose:compose-material](https://developer.android.com/jetpack/androidx/releases/wear-compose)  
[View Source](https://cs.android.com/search?q=file:androidx/wear/compose/material/PositionIndicator.kt+class:androidx.wear.compose.material.PositionIndicatorState)  
Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.0.0)

<br />

```
interface PositionIndicatorState
```

<br />

*** ** * ** ***

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](https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/ScalingLazyListState)or[ScrollState](https://developer.android.com/reference/kotlin/androidx/compose/foundation/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](https://developer.android.com/reference/kotlin/androidx/wear/compose/material/PositionIndicatorState#positionFraction())to determine where in the range 0..1 that the indicator should be displayed and[sizeFraction](https://developer.android.com/reference/kotlin/androidx/wear/compose/material/PositionIndicatorState#sizeFraction(kotlin.Float))to determine the size of the indicator in the range 0..1. E.g. If a[ScalingLazyListState](https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/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](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0.0, to = 1.0) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | [sizeFraction](https://developer.android.com/reference/kotlin/androidx/wear/compose/material/PositionIndicatorState#sizeFraction(kotlin.Float))`(scrollableContainerSizePx: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0.0) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`)` Size of the indicator in the range 0f,1f. |
| [PositionIndicatorVisibility](https://developer.android.com/reference/kotlin/androidx/wear/compose/material/PositionIndicatorVisibility)                                                               | [visibility](https://developer.android.com/reference/kotlin/androidx/wear/compose/material/PositionIndicatorState#visibility(kotlin.Float))`(scrollableContainerSizePx: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0.0) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`)` Should we show the Position Indicator         |

|                              ### Public properties                              |
|---------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | [positionFraction](https://developer.android.com/reference/kotlin/androidx/wear/compose/material/PositionIndicatorState#positionFraction()) Position of the indicator in the range 0f,1f. |

## Public functions

### sizeFraction

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#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](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0.0) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | 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](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.0.0)  

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

Should we show the Position Indicator  

|                                                                                                       Parameters                                                                                                        |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|
| `scrollableContainerSizePx: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0.0) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | 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](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.0.0)  

```
val positionFraction: Float
```

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.