@LayoutScopeMarker
class ConstraintSetScope : ConstraintLayoutBaseScope


Scope used by the ConstraintSet DSL.

Summary

Public functions

ConstrainedLayoutReference

Creates one ConstrainedLayoutReference corresponding to the ConstraintLayout element with id.

ConstraintSetScope.ConstrainedLayoutReferences
createRefsFor(vararg ids: Any)

Convenient way to create multiple ConstrainedLayoutReference with one statement, the ids provided should match Composables within ConstraintLayout using Modifier.layoutId.

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,
    skips: Array<Skip>,
    spans: Array<Span>,
    rowWeights: IntArray,
    verticalGap: Dp,
    padding: Dp
)

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

ConstrainedLayoutReference
createColumn(
    vararg elements: LayoutReference,
    skips: Array<Skip>,
    spans: Array<Span>,
    verticalGap: Dp,
    rowWeights: IntArray,
    paddingHorizontal: Dp,
    paddingVertical: Dp
)

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,
    orientation: Int,
    rows: Int,
    columns: Int,
    verticalGap: Dp,
    horizontalGap: Dp,
    rowWeights: IntArray,
    columnWeights: IntArray,
    skips: Array<Skip>,
    spans: Array<Span>,
    padding: Dp,
    flags: Array<GridFlag>
)

Creates a Grid representation with a Grid Helper.

ConstrainedLayoutReference
createGrid(
    vararg elements: LayoutReference,
    orientation: Int,
    rows: Int,
    columns: Int,
    verticalGap: Dp,
    horizontalGap: Dp,
    rowWeights: IntArray,
    columnWeights: IntArray,
    skips: Array<Skip>,
    spans: Array<Span>,
    paddingHorizontal: Dp,
    paddingVertical: Dp,
    flags: Array<GridFlag>
)

Creates a Grid representation with a Grid Helper.

ConstrainedLayoutReference
createGrid(
    vararg elements: LayoutReference,
    orientation: Int,
    rows: Int,
    columns: Int,
    verticalGap: Dp,
    horizontalGap: Dp,
    rowWeights: IntArray,
    columnWeights: IntArray,
    skips: Array<Skip>,
    spans: Array<Span>,
    paddingStart: Dp,
    paddingTop: Dp,
    paddingEnd: Dp,
    paddingBottom: Dp,
    flags: Array<GridFlag>
)

Creates a Grid representation with a Grid Helper.

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,
    skips: Array<Skip>,
    spans: Array<Span>,
    horizontalGap: Dp,
    columnWeights: IntArray,
    padding: Dp
)

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

ConstrainedLayoutReference
createRow(
    vararg elements: LayoutReference,
    skips: Array<Skip>,
    spans: Array<Span>,
    horizontalGap: Dp,
    columnWeights: IntArray,
    paddingHorizontal: Dp,
    paddingVertical: Dp
)

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
open Unit
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

createRefFor

Added in 1.1.0-alpha13
fun createRefFor(id: Any): ConstrainedLayoutReference

Creates one ConstrainedLayoutReference corresponding to the ConstraintLayout element with id.

createRefsFor

Added in 1.1.0-alpha13
fun createRefsFor(vararg ids: Any): ConstraintSetScope.ConstrainedLayoutReferences

Convenient way to create multiple ConstrainedLayoutReference with one statement, the ids provided should match Composables within ConstraintLayout using Modifier.layoutId.

Example:

val (box, text, button) = createRefsFor("box", "text", "button")

Note that the number of ids should match the number of variables assigned.

 

To create a singular ConstrainedLayoutReference see createRefFor.