Interface

FlexBoxConfig

Represents a configuration for a FlexBox container.

Source set: Common
public interface FlexBoxConfig

Represents a configuration for a FlexBox container.

This configuration is defined via a lambda that operates on a FlexBoxConfigScope. Because this configuration block is executed during the layout phase rather than the composition phase, reading state variables inside the block will only trigger a layout pass, completely avoiding costly recompositions.

Configuration properties are applied sequentially. If a property is configured multiple times within the block, the final call takes precedence.

Reusability and Responsiveness

Configurations can be extracted, saved, and reused across multiple FlexBox containers:

Furthermore, because the FlexBoxConfigScope provides direct access to the incoming Constraints, you can easily create responsive configurations that dynamically adapt their direction, wrapping, or gaps based on the available screen space:

Functions

configure

Source set: Common
public fun FlexBoxConfigScope.configure()

Applies the configuration to the given FlexBoxConfigScope. This method is invoked by the layout system during the measurement phase, not during composition.

then

Source set: Common
public infix fun then(other: FlexBoxConfig): FlexBoxConfig

Merges this config with another. Configs further "to the right" will override properties to the left of them, on a per-property basis.

Parameters

other the config to merge into the receiver.

Members

Companion

Source set: Common
public companion object : FlexBoxConfig

Functions

configure

Source set: Common
override fun FlexBoxConfigScope.configure()

A default configuration that lays out items in a horizontal row without wrapping, with

items aligned to the start on both axes and no gaps.

then

Source set: Common
override fun then(other: FlexBoxConfig): FlexBoxConfig

Identity elision: merging the identity with any config yields that config.

Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: