@LayoutScopeMarker
class ConstraintLayoutScope : ConstraintLayoutBaseScope


Scope used by the inline DSL of ConstraintLayout.

Summary

Nested types

Convenience API for creating multiple ConstrainedLayoutReference via createRefs.

Public functions

Modifier
Modifier.constrainAs(
    ref: ConstrainedLayoutReference,
    constrainBlock: ConstrainScope.() -> Unit
)

Modifier that defines the constraints, as part of a ConstraintLayout, of the layout element.

ConstrainedLayoutReference

Creates one ConstrainedLayoutReference, which needs to be assigned to a layout within the ConstraintLayout as part of Modifier.constrainAs.

ConstraintLayoutScope.ConstrainedLayoutReferences

Convenient way to create multiple ConstrainedLayoutReferences, which need to be assigned to layouts within the ConstraintLayout as part of Modifier.constrainAs.

open Unit

Inherited functions

From androidx.constraintlayout.compose.ConstraintLayoutBaseScope
Unit
applyTo(state: State)
ConstrainScope

Specifies the constraints associated to the layout identified with ref.

HorizontalChainScope

Specifies additional constraints associated to the horizontal chain identified with ref.

VerticalChainScope

Specifies additional constraints associated to the vertical chain identified with ref.

Unit
constrain(
    vararg refs: ConstrainedLayoutReference,
    constrainBlock: ConstrainScope.() -> Unit
)

Convenient way to apply the same constraints to multiple ConstrainedLayoutReferences.

ConstraintLayoutBaseScope.VerticalAnchor
createAbsoluteLeftBarrier(vararg elements: LayoutReference, margin: Dp)

Creates and returns a left barrier, containing the specified elements.

ConstraintLayoutBaseScope.VerticalAnchor
createAbsoluteRightBarrier(vararg elements: LayoutReference, margin: Dp)

Creates and returns a right barrier, containing the specified elements.

ConstraintLayoutBaseScope.HorizontalAnchor
createBottomBarrier(vararg elements: LayoutReference, margin: Dp)

Creates and returns a bottom barrier, containing the specified elements.

ConstrainedLayoutReference
createColumn(
    vararg elements: LayoutReference,
    spacing: Dp,
    weights: FloatArray
)

Creates a Grid based helper that lays out its elements in a single Column.

ConstraintLayoutBaseScope.VerticalAnchor
createEndBarrier(vararg elements: LayoutReference, margin: Dp)

Creates and returns an end barrier, containing the specified elements.

ConstrainedLayoutReference
createFlow(
    vararg elements: LayoutReference?,
    flowVertically: Boolean,
    verticalGap: Dp,
    horizontalGap: Dp,
    maxElement: Int,
    padding: Dp,
    wrapMode: Wrap,
    verticalAlign: VerticalAlign,
    horizontalAlign: HorizontalAlign,
    horizontalFlowBias: Float,
    verticalFlowBias: Float,
    verticalStyle: FlowStyle,
    horizontalStyle: FlowStyle
)

Flow helpers allows a long sequence of Composable widgets to wrap onto multiple rows or columns.

ConstrainedLayoutReference
createFlow(
    vararg elements: LayoutReference?,
    flowVertically: Boolean,
    verticalGap: Dp,
    horizontalGap: Dp,
    maxElement: Int,
    paddingHorizontal: Dp,
    paddingVertical: Dp,
    wrapMode: Wrap,
    verticalAlign: VerticalAlign,
    horizontalAlign: HorizontalAlign,
    horizontalFlowBias: Float,
    verticalFlowBias: Float,
    verticalStyle: FlowStyle,
    horizontalStyle: FlowStyle
)

Flow helpers allows a long sequence of Composable widgets to wrap onto multiple rows or columns.

ConstrainedLayoutReference
createFlow(
    vararg elements: LayoutReference?,
    flowVertically: Boolean,
    verticalGap: Dp,
    horizontalGap: Dp,
    maxElement: Int,
    paddingLeft: Dp,
    paddingTop: Dp,
    paddingRight: Dp,
    paddingBottom: Dp,
    wrapMode: Wrap,
    verticalAlign: VerticalAlign,
    horizontalAlign: HorizontalAlign,
    horizontalFlowBias: Float,
    verticalFlowBias: Float,
    verticalStyle: FlowStyle,
    horizontalStyle: FlowStyle
)

Flow helpers allows a long sequence of Composable widgets to wrap onto multiple rows or columns.

ConstrainedLayoutReference
createGrid(
    vararg elements: LayoutReference,
    rows: @IntRange(from = 1) Int,
    columns: @IntRange(from = 1) Int,
    isHorizontalArrangement: Boolean,
    verticalSpacing: Dp,
    horizontalSpacing: Dp,
    rowWeights: FloatArray,
    columnWeights: FloatArray,
    skips: Array<Skip>,
    spans: Array<Span>,
    flags: GridFlag
)

Helper that creates a fixed Grid layout.

ConstraintLayoutBaseScope.VerticalAnchor

Creates a guideline at a width fraction from the left of the ConstraintLayout.

ConstraintLayoutBaseScope.VerticalAnchor

Creates a guideline at a specific offset from the left of the ConstraintLayout.

ConstraintLayoutBaseScope.VerticalAnchor

Creates a guideline at a width fraction from the right of the ConstraintLayout.

ConstraintLayoutBaseScope.VerticalAnchor

Creates a guideline at a specific offset from the right of the ConstraintLayout.

ConstraintLayoutBaseScope.HorizontalAnchor

Creates a guideline at a height percentage from the bottom of the ConstraintLayout.

ConstraintLayoutBaseScope.HorizontalAnchor

Creates a guideline at a specific offset from the bottom of the ConstraintLayout.

ConstraintLayoutBaseScope.VerticalAnchor

Creates a guideline at a width fraction from the end of the ConstraintLayout.

ConstraintLayoutBaseScope.VerticalAnchor

Creates a guideline at a specific offset from the end of the ConstraintLayout.

ConstraintLayoutBaseScope.VerticalAnchor

Creates a guideline at a specific offset from the start of the ConstraintLayout.

ConstraintLayoutBaseScope.VerticalAnchor

Creates a guideline at a specific offset from the start of the ConstraintLayout.

ConstraintLayoutBaseScope.HorizontalAnchor

Creates a guideline at a height fraction from the top of the ConstraintLayout.

ConstraintLayoutBaseScope.HorizontalAnchor

Creates a guideline at a specific offset from the top of the ConstraintLayout.

HorizontalChainReference
createHorizontalChain(
    vararg elements: LayoutReference,
    chainStyle: ChainStyle
)

Creates a horizontal chain including the referenced layouts.

ConstrainedLayoutReference
createRow(
    vararg elements: LayoutReference,
    spacing: Dp,
    weights: FloatArray
)

Creates a Grid based helper that lays out its elements in a single Row.

ConstraintLayoutBaseScope.VerticalAnchor
createStartBarrier(vararg elements: LayoutReference, margin: Dp)

Creates and returns a start barrier, containing the specified elements.

ConstraintLayoutBaseScope.HorizontalAnchor
createTopBarrier(vararg elements: LayoutReference, margin: Dp)

Creates and returns a top barrier, containing the specified elements.

VerticalChainReference
createVerticalChain(
    vararg elements: LayoutReference,
    chainStyle: ChainStyle
)

Creates a vertical chain including the referenced layouts.

open operator Boolean
equals(other: Any?)
open Int
LayoutReference
LayoutReference.withChainParams(
    startMargin: Dp,
    topMargin: Dp,
    endMargin: Dp,
    bottomMargin: Dp,
    startGoneMargin: Dp,
    topGoneMargin: Dp,
    endGoneMargin: Dp,
    bottomGoneMargin: Dp,
    weight: Float
)

Sets the parameters that are used by chains to customize the resulting layout.

LayoutReference
LayoutReference.withHorizontalChainParams(
    startMargin: Dp,
    endMargin: Dp,
    startGoneMargin: Dp,
    endGoneMargin: Dp,
    weight: Float
)

Sets the parameters that are used by horizontal chains to customize the resulting layout.

LayoutReference
LayoutReference.withVerticalChainParams(
    topMargin: Dp,
    bottomMargin: Dp,
    topGoneMargin: Dp,
    bottomGoneMargin: Dp,
    weight: Float
)

Sets the parameters that are used by vertical chains to customize the resulting layout.

Inherited properties

From androidx.constraintlayout.compose.ConstraintLayoutBaseScope
MutableList<(State) -> Unit>

This property is deprecated. Tasks is unused, it breaks the immutability promise.

Public functions

fun Modifier.constrainAs(
    ref: ConstrainedLayoutReference,
    constrainBlock: ConstrainScope.() -> Unit
): Modifier

Modifier that defines the constraints, as part of a ConstraintLayout, of the layout element.

createRef

Added in 1.1.0-rc01
fun createRef(): ConstrainedLayoutReference

Creates one ConstrainedLayoutReference, which needs to be assigned to a layout within the ConstraintLayout as part of Modifier.constrainAs. To create more references at the same time, see createRefs.

createRefs

Added in 1.1.0-rc01
fun createRefs(): ConstraintLayoutScope.ConstrainedLayoutReferences

Convenient way to create multiple ConstrainedLayoutReferences, which need to be assigned to layouts within the ConstraintLayout as part of Modifier.constrainAs. To create just one reference, see createRef.

reset

open fun reset(): Unit