Se7eN
12/30/2020, 1:49 PMval colors = remember {
mutableStateListOf(
mutableStateListOf(Color.Magenta, Color.Blue, Color.Yellow)
)
}
val activeRowIndex = remember { mutableStateOf(0) }
val activeColumnIndex = remember { mutableStateOf(0) }
...
Sliders(
colors[activeRowIndex.value][activeColumnIndex.value],
onColorChange = { colors[activeRowIndex.value][activeColumnIndex.value] = it }
)
@Composable
fun Sliders(color: Color, onColorChange: (Color) -> Unit) {
Column {
Row(verticalAlignment = Alignment.CenterVertically) {
Text(text = "R - ${color.red * 255}")
Slider(
value = color.red,
onValueChange = { onColorChange(color.copy(red = it)) }
)
}
Row(verticalAlignment = Alignment.CenterVertically) {
Text(text = "G - ${color.green * 255}")
Slider(
value = color.green,
onValueChange = { onColorChange(color.copy(green = it)) }
)
}
Row(verticalAlignment = Alignment.CenterVertically) {
Text(text = "B - ${color.blue * 255}")
Slider(
value = color.blue,
onValueChange = { onColorChange(color.copy(blue = it)) }
)
}
}
}
tylerwilson
12/30/2020, 2:24 PMSe7eN
12/30/2020, 3:53 PMThomas
12/30/2020, 4:05 PMSe7eN
12/30/2020, 4:12 PM