floatingToolbarVerticalNestedScroll

fun Modifier.floatingToolbarVerticalNestedScroll(expanded: Boolean, onExpand: () -> Unit, onCollapse: () -> Unit, expandScrollDistanceThreshold: Dp = ScrollDistanceThreshold, collapseScrollDistanceThreshold: Dp = ScrollDistanceThreshold, reverseLayout: Boolean = false): Modifier

This Modifier tracks vertical scroll events on the scrolling container that a floating toolbar appears above. It then calls onExpand and onCollapse to adjust the toolbar's state based on the scroll direction and distance.

Essentially, it expands the toolbar when you scroll down past a certain threshold and collapses it when you scroll back up. You can customize the expand and collapse thresholds through the expandScrollDistanceThreshold and collapseScrollDistanceThreshold.

Parameters

expanded

the current expanded state of the floating toolbar

onExpand

callback to be invoked when the toolbar should expand

onCollapse

callback to be invoked when the toolbar should collapse

expandScrollDistanceThreshold

the scroll distance (in dp) required to trigger an onExpand

collapseScrollDistanceThreshold

the scroll distance (in dp) required to trigger an onCollapse

reverseLayout

indicates that the scrollable content has a reversed scrolling direction