Function

mediaQuery

Evaluates a boolean query against the current [UiMediaScope] from a [CompositionLocalAccessorScope].

mediaQuery

Common
@ExperimentalMediaQueryApi
inline fun CompositionLocalAccessorScope.mediaQuery(query: UiMediaScope.() -> Boolean): Boolean

Evaluates a boolean query against the current UiMediaScope from a CompositionLocalAccessorScope.

If called within a snapshot-aware context, the specific property reads within the query will be tracked, and the scope will be invalidated when any of those properties change.

Parameters

query A lambda expression with UiMediaScope as its receiver, representing the condition to check.

Returns

The immediate boolean result of the query.

mediaQuery

Common
@ExperimentalMediaQueryApi
inline fun CompositionLocalConsumerModifierNode.mediaQuery(
    query: UiMediaScope.() -> Boolean
): Boolean

Evaluates a boolean query against the current UiMediaScope from a Modifier.Node.

This function is designed to be used within a Modifier.Node that implements CompositionLocalConsumerModifierNode.

If called within a snapshot-aware context like LayoutModifierNode.measure or DrawModifierNode.draw callbacks, the reads within the query will be tracked, and the scope will be invalidated when the properties change.

Parameters

query A lambda expression with UiMediaScope as its receiver, representing the condition to check.

Returns

The immediate boolean result of the query.