Interface

FlexBoxConfig

Represents a configuration for a [FlexBox] container.

Overload 1

Common
@ExperimentalFlexBoxApi
fun 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

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.