ScrollableState¶
@Stable
class ScrollableState
Mutable state holder for a Scrollable composable.
Create and remember an instance via rememberScrollableState and pass it to Scrollable when you need programmatic control over the scroll position.
Constructors¶
ScrollableState¶
constructor()
Properties¶
childSize¶
Size of the scrollable content in the scroll axis, in pixels.
containerSize¶
var containerSize: Int
Size of the visible container in the scroll axis, in pixels.
currentScrollPosition¶
Smoothly interpolated scroll position used for actual rendering.
isDraggingScrollbar¶
Whether the user is currently dragging the scrollbar thumb.
lastInteractTime¶
var lastInteractTime: Long
Timestamp of the last user interaction (used for fade-out animation).
maxScroll¶
Maximum scroll offset (content size − container size).
scrollOffset¶
var scrollOffset: Double
Current target scroll offset in pixels. Animate towards currentScrollPosition.
Functions¶
onInteraction¶
fun onInteraction()
Records an interaction so the scrollbar fade-out timer resets.
scrollBy¶
Scrolls by delta pixels, clamping the result to the valid range.
Parameters
- delta: Positive values scroll forward (down/right); negative scrolls back.