The key to a [StyleState] value.
StyleStateKeySample
@Composable
fun StyleStateKeySample() {
// Create a new StyleStateKey
val playingStateKey = StyleStateKey(false)
// Introduce an extension function to read the style state
fun StyleScope.playerPlaying(value: Style) {
state(playingStateKey, value) { key, state -> state[key] }
}
// Using the extension function to change the border color to green while playing
val style = Style {
borderColor(Color.Gray)
playerPlaying { borderColor(Color.Green) }
}
// Using the style in a composable that sets the state.
MediaPlayer(url = "https://example.com/media/video", style = style)
}