OnRemeasuredModifier


A modifier whose onRemeasured is called when the layout content is remeasured. The most common usage is onSizeChanged.

Example usage:

import androidx.compose.material.Text
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.onSizeChanged

// 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") }
)

Summary

Public functions

Unit

Called after a layout's contents have been remeasured.

Cmn

Inherited functions

From androidx.compose.ui.Modifier
open infix Modifier
then(other: Modifier)

Concatenates this modifier with another.

Cmn
From androidx.compose.ui.Modifier.Element
open Boolean
all(predicate: (Modifier.Element) -> Boolean)

Returns true if predicate returns true for all Elements in this Modifier or if this Modifier contains no Elements.

Cmn
open Boolean
any(predicate: (Modifier.Element) -> Boolean)

Returns true if predicate returns true for any Element in this Modifier.

Cmn
open R
<R : Any?> foldIn(initial: R, operation: (Modifier.Element, R) -> R)

Accumulates a value starting with initial and applying operation to the current value and each element from outside in.

Cmn
open R
<R : Any?> foldOut(initial: R, operation: (Modifier.Element, R) -> R)

Accumulates a value starting with initial and applying operation to the current value and each element from inside out.

Cmn

Public functions

onRemeasured

fun onRemeasured(size: IntSize): Unit

Called after a layout's contents have been remeasured.