androidx.compose.foundation.layout

requiredSize

Function · from org.jetbrains.compose.foundation:foundation-layout:1.12.2

No hand-written docs yet.

Declare the size of the content to be exactly sizedp 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.

Form 1

fun Modifier.requiredSize(size: Dp)

size: DpRequired

Not described.

With width, height

fun Modifier.requiredSize(width: Dp, height: Dp)

width: DpRequired

Not described.

height: DpRequired

Not described.

Form 3

fun Modifier.requiredSize(size: DpSize)

size: DpSizeRequired

Not described.

Library docs

Declare the size of the content to be exactly sizedp 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.

See requiredSizeIn to set a size range. See size to set a preferred size, which is only respected when the incoming constraints allow it.

Example usage: