ParallaxHeaderConfig

class ParallaxHeaderConfig(val height: HeaderHeight, val gradient: Brush?, val isExpandedWhenFirstDisplayed: Boolean = true, val parallaxMultiplier: Float = ParallaxToolbarDefaults.HeaderParallaxMultiplier, val snapOnRelease: Boolean = false, val scrollMode: ScrollMode = ScrollMode.ExitUntilCollapsed, val fadeOnCollapse: Boolean = true, val stretchEnabled: Boolean = false, val stretchTriggerDistance: Dp = ParallaxToolbarDefaults.StretchTriggerDistance, val animationSpec: AnimationSpec<Float> = ParallaxToolbarDefaults.AnimationSpec, val snapThreshold: Float = ParallaxToolbarDefaults.SnapThreshold)(source)

Header appearance and initial state.

Parameters

parallaxMultiplier

How much of the scroll distance the header content moves by. 0f pins it, 1f scrolls it with the body, 0.5f is the classic parallax.

snapOnRelease

When a drag or fling ends with the header partly collapsed, settle it to a resting position instead of leaving it there. A fling settles in its direction; a plain release settles by snapThreshold.

snapThreshold

Collapse progress, 0f..1f, at or past which a plain release settles collapsed rather than expanded. 0.5f settles to the nearer position; 0.75f favors expanded. In ScrollMode.EnterAlwaysCollapsed the same threshold applies to the toolbar's exit.

scrollMode

How the header and toolbar react to the body scrolling; see ScrollMode.

fadeOnCollapse

Fade the whole header out as it collapses. Turn off, together with a parallaxMultiplier of 0f, when header elements use the per-element modifiers of ParallaxToolbarScope instead.

stretchEnabled

Let a downward drag past the top stretch the header, which zooms its content and pushes the body down, then springs back on release. Pair with the layout's onStretchTrigger for pull-to-refresh.

stretchTriggerDistance

How far the header must be stretched when released for onStretchTrigger to fire.

animationSpec

Animation used when the header settles on its own: snaps, stretch releases, and collapse()/expand() when they are not given a spec. Use a snap() or a short tween to honor a reduced-motion setting.

Constructors

Link copied to clipboard
constructor(height: HeaderHeight, gradient: Brush?, isExpandedWhenFirstDisplayed: Boolean = true, parallaxMultiplier: Float = ParallaxToolbarDefaults.HeaderParallaxMultiplier, snapOnRelease: Boolean = false, scrollMode: ScrollMode = ScrollMode.ExitUntilCollapsed, fadeOnCollapse: Boolean = true, stretchEnabled: Boolean = false, stretchTriggerDistance: Dp = ParallaxToolbarDefaults.StretchTriggerDistance, animationSpec: AnimationSpec<Float> = ParallaxToolbarDefaults.AnimationSpec, snapThreshold: Float = ParallaxToolbarDefaults.SnapThreshold)

Properties

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

Functions

Link copied to clipboard
fun copy(height: HeaderHeight = this.height, gradient: Brush? = this.gradient, isExpandedWhenFirstDisplayed: Boolean = this.isExpandedWhenFirstDisplayed, parallaxMultiplier: Float = this.parallaxMultiplier, snapOnRelease: Boolean = this.snapOnRelease, scrollMode: ScrollMode = this.scrollMode, fadeOnCollapse: Boolean = this.fadeOnCollapse, stretchEnabled: Boolean = this.stretchEnabled, stretchTriggerDistance: Dp = this.stretchTriggerDistance, animationSpec: AnimationSpec<Float> = this.animationSpec, snapThreshold: Float = this.snapThreshold): ParallaxHeaderConfig
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String