ExitAlwaysFloatingToolbarScrollBehavior


A FloatingToolbarScrollBehavior that adjusts its properties to affect the size of a floating toolbar.

A floating toolbar that is set up with this FloatingToolbarScrollBehavior will immediately collapse when the nested content is pulled up, and will immediately appear when the content is pulled down.

Summary

Public constructors

ExitAlwaysFloatingToolbarScrollBehavior(
    exitDirection: FloatingToolbarExitDirection,
    state: FloatingToolbarState,
    snapAnimationSpec: AnimationSpec<Float>,
    flingAnimationSpec: DecayAnimationSpec<Float>
)
Cmn

Public functions

open Modifier

A Modifier that is attached to this behavior.

Cmn
open suspend Velocity
onPostFling(consumed: Velocity, available: Velocity)

Post fling event chain.

Cmn
open Offset
onPostScroll(
    consumed: Offset,
    available: Offset,
    source: NestedScrollSource
)

Post scroll event pass.

Cmn

Public properties

open FloatingToolbarExitDirection

indicates the direction towards which the floating toolbar exits the screen

Cmn
open DecayAnimationSpec<Float>

an DecayAnimationSpec that defines how to fling the floating toolbar when the user flings the toolbar itself, or the content below it

Cmn
open AnimationSpec<Float>

an AnimationSpec that defines how the floating toolbar snaps to either fully collapsed or fully extended state when a fling or a drag scrolled it into an intermediate position

Cmn
open FloatingToolbarState

a FloatingToolbarState

Cmn

Inherited functions

From androidx.compose.ui.input.nestedscroll.NestedScrollConnection
open suspend Velocity
onPreFling(available: Velocity)

Pre fling event chain.

Cmn
open Offset
onPreScroll(available: Offset, source: NestedScrollSource)

Pre scroll event chain.

Cmn

Public constructors

ExitAlwaysFloatingToolbarScrollBehavior

ExitAlwaysFloatingToolbarScrollBehavior(
    exitDirection: FloatingToolbarExitDirection,
    state: FloatingToolbarState,
    snapAnimationSpec: AnimationSpec<Float>,
    flingAnimationSpec: DecayAnimationSpec<Float>
)
Parameters
exitDirection: FloatingToolbarExitDirection

indicates the direction towards which the floating toolbar exits the screen

state: FloatingToolbarState

a FloatingToolbarState

snapAnimationSpec: AnimationSpec<Float>

an AnimationSpec that defines how the floating toolbar snaps to either fully collapsed or fully extended state when a fling or a drag scrolled it into an intermediate position

flingAnimationSpec: DecayAnimationSpec<Float>

an DecayAnimationSpec that defines how to fling the floating toolbar when the user flings the toolbar itself, or the content below it

Public functions

floatingScrollBehavior

open fun Modifier.floatingScrollBehavior(): Modifier

A Modifier that is attached to this behavior.

onPostFling

open suspend 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)

Parameters
consumed: Velocity

the amount of velocity consumed by the child

available: Velocity

the amount of velocity left for a parent to fling after the child (if desired)

Returns
Velocity

the amount of velocity consumed by the fling operation in this connection

onPostScroll

open 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.

Parameters
consumed: Offset

the amount that was consumed by all nested scroll nodes below the hierarchy

available: Offset

the amount of delta available for this connection to consume

source: NestedScrollSource

source of the scroll

Returns
Offset

the amount that was consumed by this connection

Public properties

exitDirection

open val exitDirectionFloatingToolbarExitDirection

indicates the direction towards which the floating toolbar exits the screen

flingAnimationSpec

open val flingAnimationSpecDecayAnimationSpec<Float>

an DecayAnimationSpec that defines how to fling the floating toolbar when the user flings the toolbar itself, or the content below it

snapAnimationSpec

open val snapAnimationSpecAnimationSpec<Float>

an AnimationSpec that defines how the floating toolbar snaps to either fully collapsed or fully extended state when a fling or a drag scrolled it into an intermediate position