@@ -37,6 +37,7 @@ import androidx.compose.ui.graphics.Color
37
37
import androidx.compose.ui.text.style.TextAlign
38
38
import androidx.compose.ui.tooling.preview.Preview
39
39
import androidx.compose.ui.unit.dp
40
+ import io.monstarlab.mosaic.slider.FragmentedLinearDistribution
40
41
import io.monstarlab.mosaic.slider.Slider
41
42
import io.monstarlab.mosaic.slider.SliderColors
42
43
import io.monstarlab.mosaic.slider.SliderValueDistribution
@@ -66,7 +67,6 @@ fun MosaicSliderDemo() {
66
67
var enabled by remember { mutableStateOf(true ) }
67
68
var isCustom by remember { mutableStateOf(false ) }
68
69
var linearDistribution by remember { mutableStateOf(false ) }
69
-
70
70
var sliderValue by remember { mutableFloatStateOf(500f ) }
71
71
72
72
MaterialSlider (
@@ -83,8 +83,12 @@ fun MosaicSliderDemo() {
83
83
Modifier
84
84
}
85
85
86
- val parabolic: SliderValueDistribution = remember {
87
- SliderValueDistribution .parabolic(a = 0.005f )
86
+ val fragmentedDistribution: SliderValueDistribution = remember {
87
+ FragmentedLinearDistribution .Builder ()
88
+ .sliceAt(0.2f ,0f )
89
+ .sliceAt(2f ,0.3f )
90
+ .sliceAt(0.2f ,0.7f )
91
+ .build()
88
92
}
89
93
90
94
Slider (
@@ -94,10 +98,11 @@ fun MosaicSliderDemo() {
94
98
enabled = enabled,
95
99
colors = colors,
96
100
range = 0f .. 1000f ,
101
+ disabledRange = 50f .. 300f ,
97
102
valueDistribution = if (linearDistribution) {
98
103
SliderValueDistribution .Linear
99
104
} else {
100
- parabolic
105
+ fragmentedDistribution
101
106
},
102
107
thumb = {
103
108
if (isCustom) {
0 commit comments