Class

StyleResolver

A resolver that will resolve the properties of a given style lambda.

Source set: Common
public class StyleResolver(
    internal val style: CommonStyle,
    internal val styleState: StyleState = MutableStyleState(null),
) : RememberObserver

A resolver that will resolve the properties of a given style lambda. An instance of this should be created and passed to the styleResolver modifier which will resolve the style lambda in context.

Parameters

style a CommonStyle that will be invoked to resolve the style properties. CustomStyle types should provide a toCommonStyle() extension method that converts the custom style to CommonStyle to be passed as the value of the style parameter.
styleState a StyleState instance that is provided to the StyleStateScope as the StyleStateScope.state parameter. This allows the style to read the styleState during resolution to detect, for example, when the component being styled is focused, pressed, hovered, etc. in addition to custom states such as isPlaying.

Functions

resolve

Source set: Common
public inline fun <R> resolve(block: StyleResolverScope.() -> R): R

Asks the StyleResolver to resolve the properties of a given style lambda. The resolved properties can be read in block.

Parameters

block called in a scope that allows style properties to be read.

onRemembered

Source set: Common
override fun onRemembered()

Implements RememberObserver API to allow composition to manage the lifetime of the StyleResolver

onForgotten

Source set: Common
override fun onForgotten()

Implements RememberObserver API to allow composition to manage the lifetime of the StyleResolver

onAbandoned

Source set: Common
override fun onAbandoned()

Implements RememberObserver API to allow composition to manage the lifetime of the StyleResolver

Content updated: