Scope for configuring FlexBox container properties.

Properties are read during the layout/measure phase, not during composition. Changes to state-backed properties trigger relayout, not recomposition.

See also
FlexBoxConfig

Summary

Public functions

Unit

Aligns items to a specific baseline.

Cmn
Unit
alignItemsToBaseline(alignmentLineBlock: (Measured) -> Int)

Aligns items to a custom baseline.

Cmn
Unit
gap(value: Dp)

Convenience function to set both rowGap and columnGap to the same value.

Cmn

Public properties

FlexAlignContent

How multiple lines are aligned along the cross axis.

Cmn
FlexAlignItems

Default alignment for children along the cross axis within each line.

Cmn
Dp

Horizontal spacing between columns of items.

Cmn
Constraints

The layout constraints passed to this FlexBox from its parent.

Cmn
FlexDirection

The direction of the main axis along which children are laid out.

Cmn
FlexJustifyContent

How children are distributed along the main axis.

Cmn
Dp

Vertical spacing between items (in Column) or lines (in Row with wrap).

Cmn
FlexWrap

Whether children should wrap to new lines when they exceed the main axis size.

Cmn

Inherited functions

From androidx.compose.ui.unit.Density
open Int

Convert Dp to Int by rounding

Cmn
open Int

Convert Sp to Int by rounding

Cmn
open Dp

Convert an Int pixel value to Dp.

Cmn
open Dp

Convert a Float pixel value to a Dp

Cmn
open DpSize

Convert a Size to a DpSize.

Cmn
open Float

Convert Dp to pixels.

Cmn
open Float

Convert Sp to pixels.

Cmn
open Rect

Convert a DpRect to a Rect.

Cmn
open Size

Convert a DpSize to a Size.

Cmn
open TextUnit

Convert an Int pixel value to Sp.

Cmn
open TextUnit

Convert a Float pixel value to a Sp

Cmn
From androidx.compose.ui.unit.FontScaling
open Dp

Convert Sp to Dp.

Cmn
open TextUnit

Convert Dp to Sp.

Cmn

Inherited properties

From androidx.compose.ui.unit.Density
Float

The logical density of the display.

Cmn
From androidx.compose.ui.unit.FontScaling
Float

Current user preference for the scaling factor for fonts.

Cmn

Public functions

alignItemsToBaseline

fun alignItemsToBaseline(alignmentLine: AlignmentLine): Unit

Aligns items to a specific baseline. Overrides alignItems when set.

Example:

FlexBox(
flexBoxConfig = {
alignItemsToBaseline(FirstBaseline)
// or
alignItemsToBaseline(LastBaseline)
// or custom
alignItemsToBaseline { measured ->
measured[FirstBaseline] + 10
}
}
)

alignItemsToBaseline

fun alignItemsToBaseline(alignmentLineBlock: (Measured) -> Int): Unit

Aligns items to a custom baseline. Overrides alignItems when set.

gap

fun gap(value: Dp): Unit

Convenience function to set both rowGap and columnGap to the same value.

Parameters
value: Dp

The gap size to apply to both row and column gaps.

Public properties

alignContent

var alignContentFlexAlignContent

How multiple lines are aligned along the cross axis. Only applies when wrap is FlexWrap.Wrap or FlexWrap.WrapReverse with multiple lines.

alignItems

var alignItemsFlexAlignItems

Default alignment for children along the cross axis within each line. Can be overridden per-child using FlexConfigScope.alignSelf.

columnGap

var columnGapDp

Horizontal spacing between columns of items.

constraints

val constraintsConstraints

The layout constraints passed to this FlexBox from its parent.

These constraints represent the minimum and maximum size limits that the parent has imposed on this FlexBox. This can be useful for creating responsive layouts that adapt based on available space.

See also
Constraints

direction

var directionFlexDirection

The direction of the main axis along which children are laid out.

justifyContent

var justifyContentFlexJustifyContent

How children are distributed along the main axis.

rowGap

var rowGapDp

Vertical spacing between items (in Column) or lines (in Row with wrap).

wrap

var wrapFlexWrap

Whether children should wrap to new lines when they exceed the main axis size.