androidx.compose.foundation.layout

FlexConfigScopeSince 1.11Experimental

Sealed interface · from org.jetbrains.compose.foundation:foundation-layout:1.12.2

No hand-written docs yet.

Scope for configuring flex item properties within a FlexBox.

sealed interface FlexConfigScope : Density

Is a

Used by

Parameters that take a FlexConfigScope.

Properties

flexBoxMainAxisMax

val flexBoxMainAxisMax: Int

The maximum size of the FlexBox container along the main axis. Corresponds to Constraints.maxWidth for FlexDirection.Row/FlexDirection.RowReverse, or Constraints.maxHeight for FlexDirection.Column/FlexDirection.ColumnReverse. Use this for responsive item sizing based on the container's available space.

flexBoxMainAxisMin

val flexBoxMainAxisMin: Int

The minimum size of the FlexBox container along the main axis. Corresponds to Constraints.minWidth for FlexDirection.Row/FlexDirection.RowReverse, or Constraints.minHeight for FlexDirection.Column/FlexDirection.ColumnReverse.

flexBoxCrossAxisMax

val flexBoxCrossAxisMax: Int

The maximum size of the FlexBox container along the cross axis. Corresponds to Constraints.maxHeight for FlexDirection.Row/FlexDirection.RowReverse, or Constraints.maxWidth for FlexDirection.Column/FlexDirection.ColumnReverse.

flexBoxCrossAxisMin

val flexBoxCrossAxisMin: Int

The minimum size of the FlexBox container along the cross axis. Corresponds to Constraints.minHeight for FlexDirection.Row/FlexDirection.RowReverse, or Constraints.minWidth for FlexDirection.Column/FlexDirection.ColumnReverse.

Functions

alignSelf

fun alignSelf(value: FlexAlignSelf)

Overrides the container's FlexBoxConfigScope.alignItems for this specific item.

fun alignSelf(alignmentLine: AlignmentLine)

Aligns this item to a specific baseline within its line, overriding the container's alignment.

fun alignSelf(alignmentLineBlock: (Measured) -> Int)

Aligns this item to a custom baseline computed from the measured item within its line, overriding the container's alignment.

order

fun order(value: Int)

◦ Sets the visual order of this item relative to its siblings.

grow

fun grow(value: Float)

Sets the flex grow factor, determining how much of the remaining positive free space this item should consume relative to its siblings.

shrink

fun shrink(value: Float)

◦ Sets the flex shrink factor, determining how much this item should shrink relative to its siblings when there is not enough space.

basis

fun basis(value: FlexBasis)

Sets the initial main axis size of this item before any free space distribution (grow or shrink) is calculated.

fun basis(value: Dp)

Sets the basis to a fixed Dp value. This is a convenience function equivalent to basis(FlexBasis.Dp(value)).

fun basis(value: Float)

◦ Sets the basis to a fraction of the container's main axis size.This is a convenience function equivalent to basis(FlexBasis.Percent(value)).

Library docs

Scope for configuring flex item properties within a FlexBox.

All configuration functions are called during the layout/measure phase, not during composition.