androidx.compose.ui.input.nestedscroll
NestedScrollConnection
Interface · from org.jetbrains.compose.ui:ui:1.12.2
No hand-written docs yet.
Interface to connect to the nested scroll system.
interface NestedScrollConnection
Kinds of NestedScrollConnection
Anywhere a NestedScrollConnection is expected, you can pass any of these.
How to get one
Ready-made values and functions that return it
BottomAppBarScrollBehavior:nestedScrollConnectionPagerDefaults:pageNestedScrollConnection()SearchBarScrollBehavior:nestedScrollConnectionTopAppBarScrollBehavior:nestedScrollConnection
Or create one of the kinds listed above.
Used by
Parameters that take a NestedScrollConnection.
HorizontalPager(pageNestedScrollConnection)nestedScroll(connection)VerticalPager(pageNestedScrollConnection)
Functions
onPreScroll
fun onPreScroll(available: Offset, source: NestedScrollSource): Offset
Pre scroll event chain. Called by children to allow parents to consume a portion of a drag event beforehand
onPostScroll
fun onPostScroll(
consumed: Offset,
available: Offset,
source: NestedScrollSource,
): Offset
Post scroll event pass. This pass occurs when the dispatching (scrolling) descendant made their consumption and notifies ancestors with what's left for them to consume.
onPreFling
fun onPreFling(available: Velocity): Velocity
Pre fling event chain. Called by children when they are about to perform fling to allow parents to intercept and consume part of the initial velocity
onPostFling
fun onPostFling(consumed: Velocity, available: Velocity): Velocity
Post fling event chain. Called by the child when it is finished flinging (and sending onPreScroll & onPostScroll events)
Library docs
Interface to connect to the nested scroll system.
Pass this connection to the nestedScroll modifier to participate in the nested scroll hierarchy
and to receive nested scroll events when they are dispatched by the scrolling child (scrolling
child - the element that actually receives scrolling events and dispatches them via
NestedScrollDispatcher).