Scope for configuring the structure of a Grid.

This interface is implemented by the configuration block in Grid. It allows defining columns, rows, and gaps.

Summary

Public functions

Unit
column(percentage: Float)

Defines a percentage-based column.

Cmn
Unit
column(size: Dp)

Defines a fixed-width column.

Cmn
Unit

Defines a new column track with the specified size.

Cmn
Unit
column(weight: Fr)

Defines a flexible column.

Cmn
Unit
columnGap(gap: Dp)

Sets the gap (gutter) size between columns.

Cmn
Unit
gap(all: Dp)

Sets both the row and column gaps (gutters) to all.

Cmn
Unit
gap(row: Dp, column: Dp)

Sets independent gaps for rows and columns.

Cmn
Unit
row(percentage: Float)

Defines a percentage-based row.

Cmn
Unit
row(size: Dp)

Defines a fixed-width row.

Cmn
Unit

Defines a new row track with the specified size.

Cmn
Unit
row(weight: Fr)

Defines a flexible row.

Cmn
Unit
rowGap(gap: Dp)

Sets the gap (gutter) size between rows.

Cmn

Public properties

GridFlow

The direction in which items that do not specify a position are placed.

Cmn
open Fr

Creates an Fr unit from a Double.

Cmn
open Fr

Creates an Fr unit from a Float.

Cmn
open Fr

Creates an Fr unit from an Int.

Cmn

Extension functions

Unit

Adds multiple columns with the specified specs.

Cmn
Unit

Adds multiple rows with the specified specs.

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

column

fun column(percentage: Float): Unit

Defines a percentage-based column. Maps to GridTrackSize.Percentage.

column

fun column(size: Dp): Unit

Defines a fixed-width column. Maps to GridTrackSize.Fixed.

column

fun column(size: GridTrackSize): Unit

Defines a new column track with the specified size.

column

fun column(weight: Fr): Unit

Defines a flexible column. Maps to GridTrackSize.Flex.

columnGap

fun columnGap(gap: Dp): Unit

Sets the gap (gutter) size between columns.

Precedence: If this is called multiple times, the last call takes precedence. This call will overwrite the column component of any previous gap call.

Throws
kotlin.IllegalArgumentException

if gap is negative.

gap

fun gap(all: Dp): Unit

Sets both the row and column gaps (gutters) to all.

Precedence: If this is called multiple times, or mixed with columnGap or rowGap, the last call takes precedence.

Throws
kotlin.IllegalArgumentException

if all is negative.

gap

fun gap(row: Dp, column: Dp): Unit

Sets independent gaps for rows and columns.

Precedence: If this is called multiple times, or mixed with columnGap or rowGap, the last call takes precedence.

Throws
kotlin.IllegalArgumentException

if row or column is negative.

row

fun row(percentage: Float): Unit

Defines a percentage-based row. Maps to GridTrackSize.Percentage.

row

fun row(size: Dp): Unit

Defines a fixed-width row. Maps to GridTrackSize.Fixed.

row

fun row(size: GridTrackSize): Unit

Defines a new row track with the specified size.

row

fun row(weight: Fr): Unit

Defines a flexible row. Maps to GridTrackSize.Flex.

rowGap

fun rowGap(gap: Dp): Unit

Sets the gap (gutter) size between rows.

Precedence: If this is called multiple times, the last call takes precedence. This call will overwrite the row component of any previous gap call.

Throws
kotlin.IllegalArgumentException

if gap is negative.

Public properties

flow

var flowGridFlow

The direction in which items that do not specify a position are placed. Defaults to GridFlow.Row.

@ExperimentalGridApi
open val Double.frFr

Creates an Fr unit from a Double.

@ExperimentalGridApi
open val Float.frFr

Creates an Fr unit from a Float.

@ExperimentalGridApi
open val Int.frFr

Creates an Fr unit from an Int.

Extension functions

@ExperimentalGridApi
fun GridConfigurationScope.columns(vararg specs: GridTrackSpec): Unit

Adds multiple columns with the specified specs.

@ExperimentalGridApi
fun GridConfigurationScope.rows(vararg specs: GridTrackSpec): Unit

Adds multiple rows with the specified specs.