ParallaxToolbarState

Hoisted state of a ComposeParallaxToolbarLayout: observe how far the toolbar has collapsed and drive it programmatically.

Create it with rememberParallaxToolbarState. The collapse fraction survives configuration changes and process death. scrollState backs ParallaxContent.Regular and lazyListState backs ParallaxContent.Lazy unless the content carries its own list state; custom content manages its own scroll state.

Properties

Link copied to clipboard

0f while fully expanded, 1f once fully collapsed.

Link copied to clipboard
Link copied to clipboard

True while the header is being dragged, flung, snapped or animated by collapse and expand. False once it has come to rest.

Link copied to clipboard

Measured geometry, updated on every layout pass.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Current stretch past the expanded height, in px, while stretchEnabled and pulled down.

Link copied to clipboard

0f while the toolbar is on screen, 1f once it has slid away. Only moves in ScrollMode.EnterAlwaysCollapsed; other modes keep the toolbar pinned at 0f.

Functions

Link copied to clipboard
suspend fun collapse(animated: Boolean = true, animationSpec: AnimationSpec<Float>? = null)

Collapses the header. The body keeps its own scroll position.

Link copied to clipboard
suspend fun expand(animated: Boolean = true, animationSpec: AnimationSpec<Float>? = null)

Expands the header and brings an exited toolbar back. The body keeps its own scroll position.