androidx.compose.ui.node

ModifierNodeElement

Abstract class · from org.jetbrains.compose.ui:ui:1.12.2

No hand-written docs yet.

A Modifier.Element which manages an instance of a particular Modifier.Node implementation. A given Modifier.Node implementation can only be used when a ModifierNodeElement which creates and updates that implementation is applied to a Layout.

abstract class ModifierNodeElement<N : Modifier.Node> : Modifier.Element, InspectableValue

Is a

Functions

create

fun create(): N

This will be called the first time the modifier is applied to the Layout and it should construct and return the corresponding Modifier.Node instance.

update

fun update(node: N)

Called when a modifier is applied to a Layout whose inputs have changed from the previous application. This function will have the current node instance passed in as a parameter, and it is expected that the node will be brought up to date.

inspectableProperties

fun InspectorInfo.inspectableProperties()

Populates an InspectorInfo object with attributes to display in the layout inspector. This is called by tooling to resolve the properties of this modifier. By convention, implementors should set the name``InspectorInfo.name to the function name of the modifier.

Library docs

A Modifier.Element which manages an instance of a particular Modifier.Node implementation. A given Modifier.Node implementation can only be used when a ModifierNodeElement which creates and updates that implementation is applied to a Layout.

A ModifierNodeElement should be very lightweight, and do little more than hold the information necessary to create and maintain an instance of the associated Modifier.Node type.