Skip to content

Commit 9364e25

Browse files
committed
update Demo
1 parent 68ec963 commit 9364e25

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

demo/src/main/java/io/monstarlab/mosaic/features/SliderDemo.kt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import androidx.compose.ui.graphics.Color
3737
import androidx.compose.ui.text.style.TextAlign
3838
import androidx.compose.ui.tooling.preview.Preview
3939
import androidx.compose.ui.unit.dp
40+
import io.monstarlab.mosaic.slider.FragmentedLinearDistribution
4041
import io.monstarlab.mosaic.slider.Slider
4142
import io.monstarlab.mosaic.slider.SliderColors
4243
import io.monstarlab.mosaic.slider.SliderValueDistribution
@@ -66,7 +67,6 @@ fun MosaicSliderDemo() {
6667
var enabled by remember { mutableStateOf(true) }
6768
var isCustom by remember { mutableStateOf(false) }
6869
var linearDistribution by remember { mutableStateOf(false) }
69-
7070
var sliderValue by remember { mutableFloatStateOf(500f) }
7171

7272
MaterialSlider(
@@ -83,8 +83,12 @@ fun MosaicSliderDemo() {
8383
Modifier
8484
}
8585

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()
8892
}
8993

9094
Slider(
@@ -94,10 +98,11 @@ fun MosaicSliderDemo() {
9498
enabled = enabled,
9599
colors = colors,
96100
range = 0f..1000f,
101+
disabledRange = 50f..300f,
97102
valueDistribution = if (linearDistribution) {
98103
SliderValueDistribution.Linear
99104
} else {
100-
parabolic
105+
fragmentedDistribution
101106
},
102107
thumb = {
103108
if (isCustom) {

0 commit comments

Comments
 (0)