ScalingLazyListState
class ScalingLazyListState : ScrollableState
A state object that can be hoisted to control and observe scrolling.
In most cases, this will be created via rememberScalingLazyListState.
Summary
Public companion properties |
|
|---|---|
Saver<ScalingLazyListState, Any> |
The default |
Public constructors |
|---|
This function is deprecated. Was moved to androidx.wear.compose.foundation.lazy package. |
Public functions |
|
|---|---|
suspend Unit |
animateScrollToItem(index: Int, scrollOffset: Int)Animate (smooth scroll) the given item at |
open Float |
dispatchRawDelta(delta: Float) |
open suspend Unit |
scroll(scrollPriority: MutatePriority, block: suspend ScrollScope.() -> Unit) |
suspend Unit |
scrollToItem(index: Int, scrollOffset: Int)Instantly brings the item at |
Public properties |
|
|---|---|
open Boolean |
|
open Boolean |
|
Int |
The index of the item positioned closest to the viewport center |
Int |
The offset of the item closest to the viewport center. |
open Boolean |
|
ScalingLazyListLayoutInfo |
The object of |
Inherited properties |
||||||
|---|---|---|---|---|---|---|
|
Public companion properties
val Saver: Saver<ScalingLazyListState, Any>
The default Saver implementation for ScalingLazyListState.
Public constructors
ScalingLazyListState(
initialCenterItemIndex: Int = 1,
initialCenterItemScrollOffset: Int = 0
)
| Parameters | |
|---|---|
initialCenterItemIndex: Int = 1 |
the initial value for If the developer wants custom control over position and spacing they can switch off autoCentering and provide contentPadding. |
initialCenterItemScrollOffset: Int = 0 |
the initial value for Note that it is not always possible for the values provided by |
Public functions
suspend fun animateScrollToItem(index: Int, scrollOffset: Int = 0): Unit
Animate (smooth scroll) the given item at index to the center of the viewport and position it based on the anchorType and applies the scrollOffset pixels.
| Parameters | |
|---|---|
index: Int |
the index to which to scroll. Must be non-negative. |
scrollOffset: Int = 0 |
the offset that the item should end up after the scroll (same as |
open suspend fun scroll(scrollPriority: MutatePriority, block: suspend ScrollScope.() -> Unit): Unit
suspend fun scrollToItem(index: Int, scrollOffset: Int = 0): Unit
Instantly brings the item at index to the center of the viewport and positions it based on the anchorType and applies the scrollOffset pixels.
| Parameters | |
|---|---|
index: Int |
the index to which to scroll. Must be non-negative. |
scrollOffset: Int = 0 |
the offset that the item should end up after the scroll. Note that positive offset refers to forward scroll, so in a top-to-bottom list, positive offset will scroll the item further upward (taking it partly offscreen). |
Public properties
val centerItemScrollOffset: Int
The offset of the item closest to the viewport center. Depending on the ScalingLazyListAnchorType of the ScalingLazyColumn the offset will be relative to either the items Edge or Center.
A positive value indicates that the center item's anchor point is above the viewport center-line, a negative value indicates that the center item anchor point is below the viewport center-line.
val layoutInfo: ScalingLazyListLayoutInfo
The object of ScalingLazyListLayoutInfo calculated during the last layout pass. For example, you can use it to calculate what items are currently visible.