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
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
override fun onRemembered()
Implements RememberObserver API to allow composition to manage the lifetime of the StyleResolver
onForgotten
override fun onForgotten()
Implements RememberObserver API to allow composition to manage the lifetime of the StyleResolver
onAbandoned
override fun onAbandoned()
Implements RememberObserver API to allow composition to manage the lifetime of the StyleResolver