Package-level declarations

Types

Link copied to clipboard
@Immutable
value class Constraints(value: Long)

Immutable constraints for measuring layouts, used by layouts or layout modifiers to measure their layout children. The parent chooses the Constraints defining a range, in pixels, within which the measured layout should choose a size:

Link copied to clipboard
@Immutable
value class IntOffset

A two-dimensional position using Int cells for units

Link copied to clipboard
@Immutable
value class IntSize

A two-dimensional size class used for measuring in Int cells.

Functions

Link copied to clipboard

Takes otherConstraints and returns the result of coercing them in the current constraints. Note this means that any size satisfying the resulting constraints will satisfy the current constraints, but they might not satisfy the otherConstraints when the two set of constraints are disjoint. Examples (showing only width, height works the same): (minWidth=2, maxWidth=10).constrain(minWidth=7, maxWidth=12) -> (minWidth = 7, maxWidth = 10) (minWidth=2, maxWidth=10).constrain(minWidth=11, maxWidth=12) -> (minWidth=10, maxWidth=10) (minWidth=2, maxWidth=10).constrain(minWidth=5, maxWidth=7) -> (minWidth=5, maxWidth=7)

Takes a size and returns the closest size to it that satisfies the constraints.

Link copied to clipboard
@Stable
fun Constraints.constrainHeight(height: Int): Int

Takes a height and returns the closest size to it that satisfies the constraints.

Link copied to clipboard
@Stable
fun Constraints(minWidth: Int = 0, maxWidth: Int = Constraints.Infinity, minHeight: Int = 0, maxHeight: Int = Constraints.Infinity): Constraints

Create a Constraints. minWidth and minHeight must be positive and maxWidth and maxHeight must be greater than or equal to minWidth and minHeight, respectively, or Infinity.

Link copied to clipboard
@Stable
fun Constraints.constrainWidth(width: Int): Int

Takes a width and returns the closest size to it that satisfies the constraints.

Link copied to clipboard
@Stable
fun IntOffset(x: Int, y: Int): IntOffset

Constructs a IntOffset from x and y position Int values.

Link copied to clipboard
@Stable
fun IntSize(width: Int, height: Int): IntSize

Constructs an IntSize from width and height Int values.

Link copied to clipboard

Takes a size and returns whether it satisfies the current constraints.

Link copied to clipboard
@Stable
fun Constraints.offset(horizontal: Int = 0, vertical: Int = 0): Constraints

Returns the Constraints obtained by offsetting the current instance with the given values.