MeasuredSizeAwareModifierNode

A [androidx.compose.ui.Modifier.Node] which receives a callback with the layout's measured size.

MeasuredSizeAwareModifierNode

Interface

Common
interface MeasuredSizeAwareModifierNode : DelegatableNode

A androidx.compose.ui.Modifier.Node which receives a callback with the layout's measured size.

This is the androidx.compose.ui.Modifier.Node equivalent of androidx.compose.ui.layout.OnRemeasuredModifier.

Functions

fun onRemeasured(size: IntSize)

This method is called when the layout content is remeasured. The most common usage is onSizeChanged.

Code Examples

OnSizeChangedSample

@Composable
fun OnSizeChangedSample(name: String) {
    // Use onSizeChanged() for diagnostics. Use Layout or SubcomposeLayout if you want
    // to use the size of one component to affect the size of another component.
    Text(
        "Hello $name",
        Modifier.onSizeChanged { size -> println("The size of the Text in pixels is $size") },
    )
}