Package-level declarations

Types

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
interface DrawScope
Link copied to clipboard

A part of the composition that can be measured. This represents a layout. The instance should never be stored.

Link copied to clipboard

A Modifier.Element that changes how its wrapped content is measured and laid out. It has the same measurement and layout functionality as the com.jakewharton.mosaic.ui.Layout component, while wrapping exactly one layout due to it being a modifier. In contrast, the com.jakewharton.mosaic.ui.Layout component is used to define the layout behavior of multiple children.

Link copied to clipboard
Link copied to clipboard
fun interface MeasurePolicy
Link copied to clipboard
interface MeasureResult
Link copied to clipboard
interface MeasureScope
Link copied to clipboard

A Modifier that provides data to the parent Layout. This can be read from within the the Layout during measurement and positioning, via IntrinsicMeasurable.parentData. The parent data is commonly used to inform the parent how the child Layout should be measured and positioned.

Link copied to clipboard
abstract class Placeable

Functions

Link copied to clipboard
@Stable
fun Modifier.aspectRatio(ratio: Float, matchHeightConstraintsFirst: Boolean = false): Modifier

Attempts to size the content to match a specified aspect ratio by trying to match one of the incoming constraints in the following order: Constraints.maxWidth, Constraints.maxHeight, Constraints.minWidth, Constraints.minHeight if matchHeightConstraintsFirst is false (which is the default), or Constraints.maxHeight, Constraints.maxWidth, Constraints.minHeight, Constraints.minWidth if matchHeightConstraintsFirst is true. The size in the other dimension is determined by the aspect ratio. The combinations will be tried in this order until one non-empty is found to satisfy the constraints. If no valid size is obtained this way, it means that there is no non-empty size satisfying both the constraints and the aspect ratio, so the constraints will not be respected and the content will be sized such that the Constraints.maxWidth or Constraints.maxHeight is matched (depending on matchHeightConstraintsFirst).

Link copied to clipboard
@Stable
fun Modifier.background(color: Color): Modifier
Link copied to clipboard
@Stable
fun Modifier.defaultMinSize(minWidth: Int = Unspecified, minHeight: Int = Unspecified): Modifier

Constrain the size of the wrapped layout only when it would be otherwise unconstrained: the minWidth and minHeight constraints are only applied when the incoming corresponding constraint is 0. The modifier can be used, for example, to define a default min size of a component, while still allowing it to be overidden with smaller min sizes across usages.

Link copied to clipboard
Link copied to clipboard
@Stable
fun Modifier.fillMaxHeight(fraction: Float = 1.0f): Modifier

Have the content fill (possibly only partially) the Constraints.maxHeight of the incoming measurement constraints, by setting the minimum height and the maximum height to be equal to the maximum height multiplied by fraction. Note that, by default, the fraction is 1, so the modifier will make the content fill the whole available height. If the incoming maximum height is Constraints.Infinity this modifier will have no effect.

Link copied to clipboard
@Stable
fun Modifier.fillMaxSize(fraction: Float = 1.0f): Modifier

Have the content fill (possibly only partially) the Constraints.maxWidth and Constraints.maxHeight of the incoming measurement constraints, by setting the minimum width and the maximum width to be equal to the maximum width multiplied by fraction, as well as the minimum height and the maximum height to be equal to the maximum height multiplied by fraction. Note that, by default, the fraction is 1, so the modifier will make the content fill the whole available space. If the incoming maximum width or height is Constraints.Infinity this modifier will have no effect in that dimension.

Link copied to clipboard
@Stable
fun Modifier.fillMaxWidth(fraction: Float = 1.0f): Modifier

Have the content fill (possibly only partially) the Constraints.maxWidth of the incoming measurement constraints, by setting the minimum width and the maximum width to be equal to the maximum width multiplied by fraction. Note that, by default, the fraction is 1, so the modifier will make the content fill the whole available width. If the incoming maximum width is Constraints.Infinity this modifier will have no effect.

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

Declare the preferred height of the content to be exactly height. The incoming measurement Constraints may override this value, forcing the content to be either smaller or larger.

Link copied to clipboard
@Stable
fun Modifier.heightIn(min: Int = Unspecified, max: Int = Unspecified): Modifier

Constrain the height of the content to be between min and max as permitted by the incoming measurement Constraints. If the incoming constraints are more restrictive the requested size will obey the incoming constraints and attempt to be as close as possible to the preferred size.

Link copied to clipboard

Creates a LayoutModifier that allows changing how the wrapped element is measured and laid out.

Link copied to clipboard
fun Modifier.offset(offset: () -> IntOffset): Modifier

Offset the content by offset. The offsets can be positive as well as non-positive. Applying an offset only changes the position of the content, without interfering with its size measurement.

@Stable
fun Modifier.offset(x: Int = 0, y: Int = 0): Modifier

Offset the content by (x, y). The offsets can be positive as well as non-positive. Applying an offset only changes the position of the content, without interfering with its size measurement.

Link copied to clipboard
@Stable
fun Modifier.padding(all: Int): Modifier
@Stable
fun Modifier.padding(horizontal: Int = 0, vertical: Int = 0): Modifier
@Stable
fun Modifier.padding(left: Int = 0, top: Int = 0, right: Int = 0, bottom: Int = 0): Modifier
Link copied to clipboard
@Stable
fun Modifier.requiredHeight(height: Int): Modifier

Declare the height of the content to be exactly height. The incoming measurement Constraints will not override this value. If the content chooses a size that does not satisfy the incoming Constraints, the parent layout will be reported a size coerced in the Constraints, and the position of the content will be automatically offset to be centered on the space assigned to the child by the parent layout under the assumption that Constraints were respected.

Link copied to clipboard
@Stable
fun Modifier.requiredHeightIn(min: Int = Unspecified, max: Int = Unspecified): Modifier

Constrain the height of the content to be between min and max. If the content chooses a size that does not satisfy the incoming Constraints, the parent layout will be reported a size coerced in the Constraints, and the position of the content will be automatically offset to be centered on the space assigned to the child by the parent layout under the assumption that Constraints were respected.

Link copied to clipboard

Declare the size of the content to be exactly size. The incoming measurement Constraints will not override this value. If the content chooses a size that does not satisfy the incoming Constraints, the parent layout will be reported a size coerced in the Constraints, and the position of the content will be automatically offset to be centered on the space assigned to the child by the parent layout under the assumption that Constraints were respected.

@Stable
fun Modifier.requiredSize(size: Int): Modifier

Declare the size of the content to be exactly size width and height. The incoming measurement Constraints will not override this value. If the content chooses a size that does not satisfy the incoming Constraints, the parent layout will be reported a size coerced in the Constraints, and the position of the content will be automatically offset to be centered on the space assigned to the child by the parent layout under the assumption that Constraints were respected.

@Stable
fun Modifier.requiredSize(width: Int, height: Int): Modifier

Declare the size of the content to be exactly width and height. The incoming measurement Constraints will not override this value. If the content chooses a size that does not satisfy the incoming Constraints, the parent layout will be reported a size coerced in the Constraints, and the position of the content will be automatically offset to be centered on the space assigned to the child by the parent layout under the assumption that Constraints were respected.

Link copied to clipboard
@Stable
fun Modifier.requiredSizeIn(minWidth: Int = Unspecified, minHeight: Int = Unspecified, maxWidth: Int = Unspecified, maxHeight: Int = Unspecified): Modifier

Constrain the width of the content to be between minWidth and maxWidth, and the height of the content to be between minHeight and maxHeight. If the content chooses a size that does not satisfy the incoming Constraints, the parent layout will be reported a size coerced in the Constraints, and the position of the content will be automatically offset to be centered on the space assigned to the child by the parent layout under the assumption that Constraints were respected.

Link copied to clipboard
@Stable
fun Modifier.requiredWidth(width: Int): Modifier

Declare the width of the content to be exactly width. The incoming measurement Constraints will not override this value. If the content chooses a size that does not satisfy the incoming Constraints, the parent layout will be reported a size coerced in the Constraints, and the position of the content will be automatically offset to be centered on the space assigned to the child by the parent layout under the assumption that Constraints were respected.

Link copied to clipboard
@Stable
fun Modifier.requiredWidthIn(min: Int = Unspecified, max: Int = Unspecified): Modifier

Constrain the width of the content to be between min and max. If the content chooses a size that does not satisfy the incoming Constraints, the parent layout will be reported a size coerced in the Constraints, and the position of the content will be automatically offset to be centered on the space assigned to the child by the parent layout under the assumption that Constraints were respected.

Link copied to clipboard
@Stable
fun Modifier.size(size: IntSize): Modifier

Declare the preferred size of the content to be exactly size. The incoming measurement Constraints may override this value, forcing the content to be either smaller or larger.

@Stable
fun Modifier.size(size: Int): Modifier

Declare the preferred size of the content to be exactly size square. The incoming measurement Constraints may override this value, forcing the content to be either smaller or larger.

@Stable
fun Modifier.size(width: Int, height: Int): Modifier

Declare the preferred size of the content to be exactly width by height. The incoming measurement Constraints may override this value, forcing the content to be either smaller or larger.

Link copied to clipboard
@Stable
fun Modifier.sizeIn(minWidth: Int = Unspecified, minHeight: Int = Unspecified, maxWidth: Int = Unspecified, maxHeight: Int = Unspecified): Modifier

Constrain the width of the content to be between minWidth and maxWidth and the height of the content to be between minHeight and maxHeight as permitted by the incoming measurement Constraints. If the incoming constraints are more restrictive the requested size will obey the incoming constraints and attempt to be as close as possible to the preferred size.

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

Declare the preferred width of the content to be exactly width. The incoming measurement Constraints may override this value, forcing the content to be either smaller or larger.

Link copied to clipboard
@Stable
fun Modifier.widthIn(min: Int = Unspecified, max: Int = Unspecified): Modifier

Constrain the width of the content to be between min and max as permitted by the incoming measurement Constraints. If the incoming constraints are more restrictive the requested size will obey the incoming constraints and attempt to be as close as possible to the preferred size.

Link copied to clipboard
@Stable
fun Modifier.wrapContentHeight(align: Alignment.Vertical = Alignment.CenterVertically, unbounded: Boolean = false): Modifier

Allow the content to measure at its desired height without regard for the incoming measurement minimum height constraint, and, if unbounded is true, also without regard for the incoming measurement maximum height constraint. If the content's measured size is smaller than the minimum height constraint, align it within that minimum height space. If the content's measured size is larger than the maximum height constraint (only possible when unbounded is true), align over the maximum height space.

Link copied to clipboard
@Stable
fun Modifier.wrapContentSize(align: Alignment = Alignment.Center, unbounded: Boolean = false): Modifier

Allow the content to measure at its desired size without regard for the incoming measurement minimum width or minimum height constraints, and, if unbounded is true, also without regard for the incoming maximum constraints. If the content's measured size is smaller than the minimum size constraint, align it within that minimum sized space. If the content's measured size is larger than the maximum size constraint (only possible when unbounded is true), align within the maximum space.

Link copied to clipboard
@Stable
fun Modifier.wrapContentWidth(align: Alignment.Horizontal = Alignment.CenterHorizontally, unbounded: Boolean = false): Modifier

Allow the content to measure at its desired width without regard for the incoming measurement minimum width constraint, and, if unbounded is true, also without regard for the incoming measurement maximum width constraint. If the content's measured size is smaller than the minimum width constraint, align it within that minimum width space. If the content's measured size is larger than the maximum width constraint (only possible when unbounded is true), align over the maximum width space.