Skip to content

Commit 953684e

Browse files
add optional param to Slider for drawing grid
1 parent 9456988 commit 953684e

File tree

1 file changed

+20
-10
lines changed
  • colorpicker/src/main/java/com/smarttoolfactory/colorpicker/slider

1 file changed

+20
-10
lines changed

colorpicker/src/main/java/com/smarttoolfactory/colorpicker/slider/Slider.kt

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ import androidx.compose.ui.graphics.Brush
1313
import androidx.compose.ui.graphics.Color
1414
import androidx.compose.ui.unit.dp
1515
import com.smarttoolfactory.colorpicker.ui.brush.*
16-
import com.smarttoolfactory.extendedcolors.util.roundToTwoDigits
1716
import com.smarttoolfactory.colorpicker.widget.drawChecker
18-
import com.smarttoolfactory.slider.SliderBrushColor
17+
import com.smarttoolfactory.extendedcolors.util.roundToTwoDigits
1918
import com.smarttoolfactory.slider.ColorfulSlider
2019
import com.smarttoolfactory.slider.MaterialSliderDefaults
20+
import com.smarttoolfactory.slider.SliderBrushColor
2121

2222
/*
2323
HSV Sliders
@@ -49,7 +49,8 @@ fun SliderHueHSV(
4949
value = hue,
5050
valueRange = 0f..360f,
5151
onValueChange = onValueChange,
52-
brush = sliderHueSelectionHSLGradient
52+
brush = sliderHueSelectionHSLGradient,
53+
drawChecker = true
5354
)
5455
}
5556

@@ -77,7 +78,8 @@ fun SliderSaturationHSV(
7778
modifier = modifier,
7879
value = saturation,
7980
onValueChange = onValueChange,
80-
brush = sliderHueSelectionHSLGradient
81+
brush = sliderHueSelectionHSLGradient,
82+
drawChecker = true
8183
)
8284
}
8385

@@ -102,7 +104,8 @@ fun SliderValueHSV(
102104
modifier = modifier,
103105
value = value,
104106
onValueChange = onValueChange,
105-
brush = sliderValueGradient
107+
brush = sliderValueGradient,
108+
drawChecker = true
106109
)
107110
}
108111

@@ -160,7 +163,8 @@ fun SliderHueHSL(
160163
value = hue,
161164
valueRange = 0f..360f,
162165
onValueChange = onValueChange,
163-
brush = sliderHueSelectionHSLGradient
166+
brush = sliderHueSelectionHSLGradient,
167+
drawChecker = true
164168
)
165169
}
166170

@@ -189,7 +193,8 @@ fun SliderSaturationHSL(
189193
modifier = modifier,
190194
value = saturation,
191195
onValueChange = onValueChange,
192-
brush = sliderHueSelectionHSLGradient
196+
brush = sliderHueSelectionHSLGradient,
197+
drawChecker = true
193198
)
194199
}
195200

@@ -216,7 +221,8 @@ fun SliderLightnessHSL(
216221
modifier = modifier,
217222
value = lightness,
218223
onValueChange = onValueChange,
219-
brush = sliderLightnessGradient
224+
brush = sliderLightnessGradient,
225+
drawChecker = true
220226
)
221227
}
222228

@@ -359,12 +365,16 @@ fun CheckeredColorfulSlider(
359365
brush: Brush,
360366
drawChecker: Boolean = false
361367
) {
362-
BoxWithConstraints(modifier = modifier, contentAlignment = Alignment.CenterStart) {
368+
BoxWithConstraints(
369+
modifier = modifier,
370+
contentAlignment = Alignment.CenterStart
371+
) {
372+
363373
if (drawChecker) {
364374
Box(
365375
modifier = Modifier
366376
.width(maxWidth)
367-
.height(12.dp)
377+
.height(11.dp)
368378
.drawChecker(shape = RoundedCornerShape(6.dp))
369379
)
370380
}

0 commit comments

Comments
 (0)