androidx.xr.compose.subspace.node
Interfaces
CompositionLocalConsumerSubspaceModifierNode |
Implementing this interface allows your |
LayoutCoordinatesAwareModifierNode |
A |
SubspaceLayoutModifierNode |
A specialized |
SubspaceSemanticsInfo |
Provides semantic information about a node in the Subspace layout hierarchy. |
SubspaceSemanticsModifierNode |
A SubspaceModifier.Node that adds semantics key/values for use in testing, accessibility, and similar use cases. |
Classes
SubspaceModifierNodeElement |
Modifier elements manage an instance of a particular |
Extension functions summary
T |
<T : Any?> CompositionLocalConsumerSubspaceModifierNode.currentValueOf(Returns the current value of |
Unit |
Requests a remeasure of the |
Unit |
Requests a relayout of the |
Extension functions
currentValueOf
fun <T : Any?> CompositionLocalConsumerSubspaceModifierNode.currentValueOf(
local: CompositionLocal<T>
): T
Returns the current value of local at the position in the composition hierarchy of this modifier's attached layout node.
Unlike CompositionLocal.current, reads via this function are not automatically tracked by Compose. Modifiers are not able to recompose in the same way that a Composable can, and therefore can't receive updates arbitrarily for a CompositionLocal.
Because CompositionLocals may change arbitrarily, it is strongly recommended to ensure that the composition local is observed instead of being read once. If you call currentValueOf inside of a modifier callback like SubspaceLayoutModifierNode.measure, then Compose will track the CompositionLocal read. This happens automatically, because these Compose UI phases take place in a snapshot observer that tracks which states are read. If the value of the CompositionLocal changes, and it was read inside of the measure or draw phase, then that phase will automatically be invalidated.
For all other reads of a CompositionLocal, this function will not notify you when the value of the local changes.
This function will fail with an IllegalStateException if you attempt to read a CompositionLocal before the node is attached or after the node is detached.
| Parameters | |
|---|---|
local: CompositionLocal<T> |
The CompositionLocal to get the current value of |
| Returns | |
|---|---|
T |
The value provided by the nearest CompositionLocalProvider component that invokes, directly or indirectly, the composable function that this modifier is attached to. If |
invalidateMeasurement
fun SubspaceLayoutModifierNode.invalidateMeasurement(): Unit
Requests a remeasure of the SubspaceLayoutModifierNode composition tree.
This is used to request a remeasure in stateful layout modifiers that are impacted by events that don't trigger a recomposition. Do not call this from SubspaceLayoutModifierNode.measure.
invalidatePlacement
fun SubspaceLayoutModifierNode.invalidatePlacement(): Unit
Requests a relayout of the SubspaceLayoutModifierNode composition tree.
This is used to request a relayout in stateful layout modifiers that are impacted by events that don't trigger a recomposition. Do not call this from SubspaceLayoutModifierNode.measure.