StylePropertyAccessorScope

Known direct subclasses
StyleResolverScope

The type of the scope of StyleResolver.resolve that allows the block to read the fully resolved values from a style.


Provides access to resolved style property values.

Summary

Public functions

Boolean
anySet(properties: Set<StyleProperty<*>>)

Returns true if any property in properties is set.

Cmn
T?
<T : Any?> getOrNull(property: StyleProperty<T>)

Returns the resolved value of property, or null if it is not set.

Cmn

Public properties

Boolean

Returns true if a value is explicitly set for this StyleProperty.

Cmn
T

Returns the resolved value of this StyleProperty, or its default value if not set.

Cmn

Extension functions

inline T
@ExperimentalFoundationStyleApi
<T : Any?> StylePropertyAccessorScope.getOrElse(
    property: StyleProperty<T>,
    crossinline defaultValue: () -> T
)

Returns the resolved value of property if set, or the result of defaultValue.

Cmn
inline Unit
@ExperimentalFoundationStyleApi
<T : Any?> StylePropertyAccessorScope.ifSet(
    property: StyleProperty<T>,
    crossinline block: (T) -> Unit
)

Call block when property has been provided.

Cmn
inline Unit
@ExperimentalFoundationStyleApi
<R : T, T : Any?> StylePropertyAccessorScope.ifSetAs(
    property: StyleProperty<T>,
    crossinline block: (R) -> Unit
)

Call block when property has been provided and the value is of type R.

Cmn

Public functions

anySet

fun anySet(properties: Set<StyleProperty<*>>): Boolean

Returns true if any property in properties is set.

getOrNull

fun <T : Any?> getOrNull(property: StyleProperty<T>): T?

Returns the resolved value of property, or null if it is not set.

Public properties

StyleProperty.isSet

val StyleProperty<*>.isSetBoolean

Returns true if a value is explicitly set for this StyleProperty.

StyleProperty.value

val StyleProperty<T>.value: T

Returns the resolved value of this StyleProperty, or its default value if not set.

Extension functions

StylePropertyAccessorScope.getOrElse

@ExperimentalFoundationStyleApi
inline fun <T : Any?> StylePropertyAccessorScope.getOrElse(
    property: StyleProperty<T>,
    crossinline defaultValue: () -> T
): T

Returns the resolved value of property if set, or the result of defaultValue.

Parameters
property: StyleProperty<T>

property to retrieve

crossinline defaultValue: () -> T

fallback calculation when property is not set

StylePropertyAccessorScope.ifSet

@ExperimentalFoundationStyleApi
inline fun <T : Any?> StylePropertyAccessorScope.ifSet(
    property: StyleProperty<T>,
    crossinline block: (T) -> Unit
): Unit

Call block when property has been provided.

Parameters
property: StyleProperty<T>

the property to check.

crossinline block: (T) -> Unit

called when property has been provided and is called with the resolved value of property as a parameter.

StylePropertyAccessorScope.ifSetAs

@ExperimentalFoundationStyleApi
inline fun <R : T, T : Any?> StylePropertyAccessorScope.ifSetAs(
    property: StyleProperty<T>,
    crossinline block: (R) -> Unit
): Unit

Call block when property has been provided and the value is of type R.

Parameters
<R : T>

the value of R is required to be.

<T : Any?>

the type of the property inferred from property

property: StyleProperty<T>

the property to check.

crossinline block: (R) -> Unit

called when property has been provided and is called with the resolved value of property as a parameter.

Extension properties

StylePropertyAccessorScope.contentBrush

@ExperimentalFoundationStyleApi
val StylePropertyAccessorScope.contentBrushBrush?

Transitionary value. Do not use. This will be removed before the Styles API is stable.

This gives access to the fill value set by ContentColorScope.

StylePropertyAccessorScope.contentColor

@ExperimentalFoundationStyleApi
val StylePropertyAccessorScope.contentColorColor

Transitionary value. Do not use. This will be removed before the Styles API is stable.

This gives access to the fill value set by ContentColorScope.

StylePropertyAccessorScope.contentFill

@ExperimentalFoundationStyleApi
val StylePropertyAccessorScope.contentFillFill

Transitionary value. Do not use. This will be removed before the Styles API is stable.

This gives access to the fill value set by ContentColorScope.