LayoutModifierNodeElement
A layout modifier: declares a LayoutModifierNode that measures one child between the constraints its parent offers and the result it reports back, and keeps its state across passes, such as an animation mid-flight. A child declares one through ConstrainedScope.layout.
Its equals decides whether a later declaration updates the node: an equal one leaves the node as it is, and an unequal one runs update, after which the child is measured again unless the node's shouldAutoInvalidate is false.
Properties
The capability a Foundation Layout must support to interpret this modifier.
Functions
fun SwingModifier.absoluteOffset(x: Int = 0, y: Int = 0): SwingModifier
fun SwingModifier.absolutePadding(left: Int = 0, top: Int = 0, right: Int = 0, bottom: Int = 0): SwingModifier
Paints the component at alpha of its opacity, content and children alike, cut to the decorated box as androidx's Modifier.alpha cuts it.
fun SwingModifier.aspectRatio(@FloatRange(from = 0.0,
Sizes the child to ratio width per unit height, taking the size from the greatest width its incoming constraints allow, then the greatest height, then the least width and the least height, and stopping at the first of those that satisfies both the constraints and the ratio. Where none of them does, the constraints are not respected: the child takes the size the first of those extents that names a size at all implies at the ratio, and only where none of them names one is the child measured under the incoming constraints unchanged.
Fills shape's outline with color under the component's content; the solid-color overload of background.
Softens everything inside it, by radius: the component's content, its border and its children.
Clips everything inside it to shape's outline - the component's content, its border and, on a container, its children.
Clips the child's paint, and its descendants', to the box the modifiers after this one report for it, even where a modifier further along places something larger, such as a size transition mid-flight. A decoration declared before it is not clipped, and one declared after it is.
Declares decorator on a component that paints through a decoration: a component implementing Decoratable. Any other component is refused, with an IllegalStateException naming Decoratable.
Declares element, whose DecorationModifierNode is one step of the component's decoration, such as a DrawModifierNode. It paints at its place among the other steps, as a declared Decorator does, so the component must be a Decoratable and element must be additive; either is refused, before the node attaches when element names Decoratable as its target type, or as the node attaches otherwise.
fun SwingModifier.defaultMinSize(minWidth: Int? = null, minHeight: Int? = null): SwingModifier
Raises the child's minimum size to minWidth by minHeight along whichever axis its incoming constraints leave a minimum of zero on. An axis already claiming a minimum is left as it is, and the minimum raised to is held between nothing and the space the child was offered, so a child in a container smaller than the minimum takes the container.
Draws onDraw into the component's area before the content declared after this modifier. A shortcut for a DrawModifierNode whose ContentDrawScope.drawContent runs after the block.
Draws onDraw into the component's area, letting the block decide when the content declared after this modifier is painted by calling ContentDrawScope.drawContent.
fun SwingModifier.fillMaxHeight(@FloatRange(from = 0.0,
Makes the child occupy fraction of the greatest bounded height its parent offers it. The result is held between the offered minimum and maximum height. An unbounded height is left unchanged.
fun SwingModifier.fillMaxSize(@FloatRange(from = 0.0,
Makes the child occupy fraction of the greatest bounded width and height its parent offers it. Each result is held between the offered minimum and maximum. Either unbounded axis is left unchanged.
fun SwingModifier.fillMaxWidth(@FloatRange(from = 0.0,
Makes the child occupy fraction of the greatest bounded width its parent offers it. The result is held between the offered minimum and maximum width. An unbounded width is left unchanged.
Prefers an exact height, while still allowing the constraints the parent offers to override it.
fun SwingModifier.height(intrinsicSize: IntrinsicSize): SwingModifier
Prefers the child's intrinsicSize height, while still allowing the constraints the parent offers to override it.
fun SwingModifier.heightIn(min: Int? = null, max: Int? = null): SwingModifier
fun SwingModifier.layout(measure: MeasureScope.(measurable: Measurable, constraints: Constraints) -> MeasureResult): SwingModifier
Measures and places the child with measure, a layout modifier written as a lambda: measure measures the child's measurable under the constraints it is handed, and answers with MeasureScope.layout.
Moves the child by (x, y) from where it would otherwise sit, neither axis moved by default, without changing the space it measures into. A positive x moves the child toward the trailing edge: right under a left-to-right reading order and left under a right-to-left one. See absoluteOffset for an offset that always moves it toward the right.
Runs onPlaced with the bounds the component occupies in its parent whenever those bounds change.
Runs onSizeChanged with the extent the component occupies whenever its size changes.
Reserves all along every edge of the child. A decoration declared before a padding paints over the space it reserves as well, as paint outsets: background(brush).padding(8) fills the child and the space around it.
fun SwingModifier.padding(horizontal: Int = 0, vertical: Int = 0): SwingModifier
Reserves horizontal before and after the child along the reading order, and vertical above and below it, either pair left unreserved by default.
fun SwingModifier.padding(start: Int = 0, top: Int = 0, end: Int = 0, bottom: Int = 0): SwingModifier
Declares which part of this component's insets is paint outsets; see PaintOutsets. Under a Swing parent it changes only what a Decoratable reports and clips.
Requires an exact height, even where it is outside the constraints the parent offers.
fun SwingModifier.requiredHeight(intrinsicSize: IntrinsicSize): SwingModifier
Requires the child's intrinsicSize height, even where it is outside the constraints the parent offers.
fun SwingModifier.requiredHeightIn(min: Int? = null, max: Int? = null): SwingModifier
Requires a height inside the bounds named here, with either bound absent when it is null.
Requires an exact square size, even where it is outside the constraints the parent offers.
fun SwingModifier.requiredSize(width: Int, height: Int): SwingModifier
fun SwingModifier.requiredSizeIn(minWidth: Int? = null, minHeight: Int? = null, maxWidth: Int? = null, maxHeight: Int? = null): SwingModifier
Requires a size inside the bounds named here, with any null bound absent.
Requires an exact width, even where it is outside the constraints the parent offers.
fun SwingModifier.requiredWidth(intrinsicSize: IntrinsicSize): SwingModifier
Requires the child's intrinsicSize width, even where it is outside the constraints the parent offers.
fun SwingModifier.requiredWidthIn(min: Int? = null, max: Int? = null): SwingModifier
Requires a width inside the bounds named here, with either bound absent when it is null.
Casts a blurred shadow of everything inside it, into outsets the component grows by.
Prefers an exact square size, while still allowing the constraints the parent offers to override it.
fun SwingModifier.sizeIn(minWidth: Int? = null, minHeight: Int? = null, maxWidth: Int? = null, maxHeight: Int? = null): SwingModifier
Prefers a size inside the bounds named here, with any null bound absent. The constraints the parent offers still take precedence.
Prefers an exact width, while still allowing the constraints the parent offers to override it.
fun SwingModifier.width(intrinsicSize: IntrinsicSize): SwingModifier
Prefers the child's intrinsicSize width, while still allowing the constraints the parent offers to override it.
fun SwingModifier.widthIn(min: Int? = null, max: Int? = null): SwingModifier
fun SwingModifier.wrapContentHeight(align: Alignment.Vertical = Alignment.CenterVertically, unbounded: Boolean = false): SwingModifier
fun SwingModifier.wrapContentSize(align: Alignment = Alignment.Center, unbounded: Boolean = false): SwingModifier
fun SwingModifier.wrapContentWidth(align: Alignment.Horizontal = Alignment.CenterHorizontally, unbounded: Boolean = false): SwingModifier
Places the child at zIndex in its container's paint and hit-testing order: a child with a larger value paints over, and receives a mouse event before, every sibling with a smaller one. Siblings with the same value keep the order they are declared in, the last on top, whatever order their container places them in. A child declaring none is at 0f.