Composable Function

mediaQuery

Evaluates a boolean query against the current [UiMediaScope].

mediaQuery

Common
@ExperimentalMediaQueryApi
@Composable
@ReadOnlyComposable
fun mediaQuery(query: UiMediaScope.() -> Boolean): Boolean

Evaluates a boolean query against the current UiMediaScope.

Avoid reading properties marked with @FrequentlyChangingValue (such as UiMediaScope.windowWidth or UiMediaScope.windowHeight) inside the query block. Reading these properties will cause the composable to recompose on every frame during events such as window resizing, which can affect the performance.

For queries involving such frequently changing values, use derivedMediaQuery instead.

Parameters

query The condition to evaluate against the UiMediaScope.

Returns

The boolean result of the query.