public class MutableStyleState constructor(override val interactionSource: InteractionSource?) : StyleState()
The state a style that can be updated to reflect the current state of a component. This value should be created in a component and updated to select the style parameter to be set for the component.
A component that uses an interaction source can create a MutableStyleState that observes the interactions emitted to the interaction source.
Properties
isEnabled
override var isEnabled: Boolean
isFocused
override var isFocused: Boolean
isHovered
override var isHovered: Boolean
isPressed
override var isPressed: Boolean
isSelected
override var isSelected: Boolean
triStateToggle
override var triStateToggle: ToggleableState
isChecked
override var isChecked: Boolean
Functions
get
override operator fun <T> get(key: StyleStateKey<T>): T
set
public operator fun <T> set(key: StyleStateKey<T>, value: T)
Set the value of the key in the StyleState.
remove
public fun <T> remove(key: StyleStateKey<T>)
Removes the StyleStateKey from the StyleState.
A Style will read the StyleStateKey.defaultValue for the StyleStateKey when the key is not present in the StyleState.
Removing a key that is updated via an InteractionSource will no longer observe the interaction source.
Predefined style keys, such as StyleStateKey.Pressed and StyleStateKey.Hovered, cannot be removed from the set of keys and this will throw if removed.
processInteractions
override suspend fun processInteractions(interactions: InteractionSource)