Se7eN
01/07/2021, 1:17 PM@Composable
fun Main() {
    val state = remember { PaletteState(...) }
    Scaffold(
        topBar = { TopBar(onSave = { viewModel.save(state.toPalette()) } }
    ) {
        ColorWheel(state)
    }
}
@Composable
fun ColorWheel(state: PaletteState) {
    val colorWheel = rememeber { ColorWheel(...) }
    state.colors = colorWheel.getColors()
    Content(colorWheel)
}statesindrenm
01/07/2021, 1:23 PMonColorSelected: (Color) -> UnitLukas Sztefek
01/07/2021, 1:23 PMfun ColorWheel(onPalletteChanged: (PaletteState) -> Unit) {Se7eN
01/07/2021, 1:26 PMSe7eN
01/07/2021, 1:28 PMonPaletteChanged()state.colors = colorWheel.getColors()Lukas Sztefek
01/07/2021, 1:38 PMSe7eN
01/07/2021, 1:39 PMLukas Sztefek
01/07/2021, 1:47 PMI don't really have a way to get the initial colors of the color wheelThe child is responsible for initializing the paletteSe7eN
01/07/2021, 1:52 PMinit { }Se7eN
01/07/2021, 1:52 PMjim
01/07/2021, 2:08 PMColorWheeljim
01/07/2021, 2:17 PMfun ColorWheel(palette: List<Color>, currentColor: Color, onColorSelected: (Color) -> Unit) {
   ...
}fun ColorWheel(palette: List<Color>, onPaletteSelected: (List<Color>) -> Unit) {
   ...
}Se7eN
01/07/2021, 2:20 PMclass ColorWheel(hueDistance, numColors, ...) {
    // Initialize the list of colors using hueDistance and numColors and a few other parameters
}ColorWheelLukas Sztefek
01/07/2021, 2:21 PMclass PaletteState(
    var colors: List<Color>
)
@Composable
fun Main() {
    val paletteState = remember { PaletteState(listOf(Color.Red, Color.Blue)) }
    ColorWheel(
        currentColors = paletteState.colors,
        onColorsChanged = { paletteState.colors = it }
    )
}
@Composable
fun ColorWheel(currentColors: List<Color>, onColorsChanged: (List<Color>) -> Unit) {
    Content(
        currentColors = currentColors,
        onDrag = { selectedColors -> onColorsChanged(selectedColors) }
    )
}Se7eN
01/07/2021, 2:26 PMLukas Sztefek
01/07/2021, 2:33 PMjim
01/07/2021, 2:33 PMColorWheelPaletteStateColorWheelStateSe7eN
01/07/2021, 2:35 PM