|
| 1 | +package com.smarttoolfactory.colorpicker.dialog |
| 2 | + |
| 3 | +import androidx.compose.foundation.background |
| 4 | +import androidx.compose.foundation.layout.Column |
| 5 | +import androidx.compose.foundation.layout.fillMaxWidth |
| 6 | +import androidx.compose.foundation.layout.padding |
| 7 | +import androidx.compose.foundation.shape.RoundedCornerShape |
| 8 | +import androidx.compose.material.FloatingActionButton |
| 9 | +import androidx.compose.material.Icon |
| 10 | +import androidx.compose.material.icons.Icons |
| 11 | +import androidx.compose.material.icons.filled.Close |
| 12 | +import androidx.compose.runtime.* |
| 13 | +import androidx.compose.ui.Alignment |
| 14 | +import androidx.compose.ui.Modifier |
| 15 | +import androidx.compose.ui.graphics.Color |
| 16 | +import androidx.compose.ui.unit.dp |
| 17 | +import androidx.compose.ui.window.Dialog |
| 18 | +import com.smarttoolfactory.colorpicker.picker.ColorPickerRingDiamondHSL |
| 19 | +import com.smarttoolfactory.colorpicker.ui.Blue400 |
| 20 | + |
| 21 | +@Composable |
| 22 | +fun ColorPickerRingDiamondHSLDialog(initialColor: Color, onDismiss: (Color) -> Unit) { |
| 23 | + |
| 24 | + var color by remember { mutableStateOf(initialColor.copy()) } |
| 25 | + Dialog( |
| 26 | + onDismissRequest = { |
| 27 | + onDismiss(color) |
| 28 | + } |
| 29 | + ) { |
| 30 | + Column(horizontalAlignment = Alignment.CenterHorizontally) { |
| 31 | + ColorPickerRingDiamondHSL( |
| 32 | + modifier = Modifier |
| 33 | + .fillMaxWidth() |
| 34 | + .weight(1f) |
| 35 | + .background(Color(0xcc212121), shape = RoundedCornerShape(5.dp)) |
| 36 | + .padding(horizontal = 10.dp, vertical = 2.dp), |
| 37 | + initialColor = initialColor |
| 38 | + ) { |
| 39 | + color = it |
| 40 | + } |
| 41 | + |
| 42 | + FloatingActionButton( |
| 43 | + onClick = { onDismiss(color) }, |
| 44 | + backgroundColor = Color.Black |
| 45 | + ) { |
| 46 | + Icon( |
| 47 | + imageVector = Icons.Filled.Close, |
| 48 | + contentDescription = null, |
| 49 | + tint = Blue400 |
| 50 | + ) |
| 51 | + } |
| 52 | + } |
| 53 | + } |
| 54 | +} |
| 55 | + |
| 56 | + |
0 commit comments