Known direct subclasses
FlowColumnOverflowScope

Scope for the overflow FlowColumn.


Scope for the children of FlowColumn.

Summary

Public functions

Modifier
@ExperimentalLayoutApi
Modifier.fillMaxColumnWidth(
    fraction: @FloatRange(from = 0.0, to = 1.0) Float
)

Have the item fill (possibly only partially) the max width of the widest item in the column it was placed in, within the FlowColumn.

Cmn

Inherited functions

From androidx.compose.foundation.layout.ColumnScope
Modifier

Align the element horizontally within the Column.

Cmn
Modifier
Modifier.alignBy(alignmentLineBlock: (Measured) -> Int)

Position the element horizontally such that the alignment line for the content as determined by alignmentLineBlock aligns with sibling elements also configured to alignBy.

Cmn
Modifier

Position the element horizontally such that its alignmentLine aligns with sibling elements also configured to alignBy.

Cmn
Modifier
Modifier.weight(
    weight: @FloatRange(from = 0.0, fromInclusive = false) Float,
    fill: Boolean
)

Size the element's height proportional to its weight relative to other weighted sibling elements in the Column.

Cmn

Public functions

fillMaxColumnWidth

@ExperimentalLayoutApi
fun Modifier.fillMaxColumnWidth(
    fraction: @FloatRange(from = 0.0, to = 1.0) Float = 1.0f
): Modifier

Have the item fill (possibly only partially) the max width of the widest item in the column it was placed in, within the FlowColumn.

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.FlowColumn
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.material.Text
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp

FlowColumn(
    Modifier.padding(20.dp)
        .wrapContentHeight(align = Alignment.Top)
        .wrapContentWidth(align = Alignment.Start),
    horizontalArrangement = Arrangement.spacedBy(10.dp),
    verticalArrangement = Arrangement.spacedBy(20.dp),
    maxItemsInEachColumn = 3,
) {
    repeat(9) {
        Box(Modifier.height(100.dp).fillMaxColumnWidth(1f).background(Color.Green)) {
            val text = generateRandomString(IntRange(1, 5).random())
            Text(text = text, fontSize = 18.sp, modifier = Modifier.padding(3.dp))
        }
    }
}
Parameters
fraction: @FloatRange(from = 0.0, to = 1.0) Float = 1.0f

The fraction of the max width of the widest item between 0 and 1, inclusive.

Example usage: