GleamState

class GleamState constructor(skipPartiallyExpanded: Boolean, density: Density, initialValue: GleamValue = Hidden, confirmValueChange: (GleamValue) -> Boolean = { true }, skipHiddenState: Boolean = false)

State of a Gleam composable, such as Gleam.

Contains states relating to its swipe position and animations between state values.

Parameters

skipPartiallyExpanded

Whether the partially expanded state, if the Gleam is large enough, should be skipped. If true, the Gleam will always expand to the Expanded state and move to the Hidden state if available when hiding the Gleam, either programmatically or by user interaction.

initialValue

The initial value of the state, representing the Gleam's initial visibility.

density

The density that this state can use to convert values to and from dp.

confirmValueChange

Optional callback invoked to confirm or veto a pending Gleam state change.

skipHiddenState

Whether the hidden state should be skipped. If true, the Gleam will always expand to the Expanded state and move to the PartiallyExpanded if available, either programmatically or by user interaction.

Constructors

Link copied to clipboard
constructor(skipPartiallyExpanded: Boolean, density: Density, initialValue: GleamValue = Hidden, confirmValueChange: (GleamValue) -> Boolean = { true }, skipHiddenState: Boolean = false)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The current visibility state of the Gleam.

Link copied to clipboard

Checks if the Gleam has a defined Expanded state.

Link copied to clipboard

Checks if the Gleam has a defined PartiallyExpanded state.

Link copied to clipboard

Checks if the Gleam is currently visible.

Link copied to clipboard

The target visibility state of the Gleam.

Functions

Link copied to clipboard

Delegates the confirmation of a proposed value change to the underlying anchoredDraggableState. This allows for centralized control over value change logic, including potential vetoing of changes.

Link copied to clipboard
suspend fun expand()

Animates the Gleam to its Expanded state and suspends the coroutine until the animation finishes or is cancelled.

Link copied to clipboard
suspend fun forcedHide()

Forcibly hides the Gleam without animation and suspends the coroutine until it is fully hidden. This function differs from hide by ignoring any ongoing user interactions like swipes or taps, ensuring the Gleam is hidden immediately.

Link copied to clipboard
suspend fun hide()

Hides the Gleam with animation and suspends the coroutine until it is fully hidden or animation has been cancelled.

Link copied to clipboard
suspend fun partialExpand()

Animates the Gleam to its PartiallyExpanded state and suspends the coroutine until the animation finishes or is cancelled.

Link copied to clipboard

Retrieves the current offset (in pixels) of the Gleam.

Link copied to clipboard
suspend fun show()

Animates the Gleam to either its PartiallyExpanded state (if defined) or the Expanded state, and suspends the coroutine until the animation finishes or is cancelled.