положили в композишн локал?
var mainColor by remember { mutableStateOf(Color.Black) } CompositionLocalProvider( LocalMainColor provides mainColor ) { Column { Button( onClick = { mainColor = Color.Red } ) { Text(text = "Test dinamic", color = LocalMainColor.current) } CompositionLocalProvider( LocalMainColor provides Color.Green ){ Text(text = "Test green", color = LocalMainColor.current) } } } ... val LocalMainColor = compositionLocalOf<Color> { error("No root controller provider") }
Обсуждают сегодня