Function

mediaQuery

Evaluates a query against the current UiMediaScope from a CompositionLocalAccessorScope.

mediaQuery

Source set: Common
public inline fun <T> CompositionLocalAccessorScope.mediaQuery(query: UiMediaScope.() -> T): T

Evaluates a 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 evaluate.

Return

The immediate result of the query.

mediaQuery

Source set: Common
public inline fun <T> CompositionLocalConsumerModifierNode.mediaQuery(
    query: UiMediaScope.() -> T
): T

Evaluates a 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 evaluate.

Return

The immediate result of the query.

Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: