Skip to content

Instantly share code, notes, and snippets.

@MansuriYamin
Created July 16, 2023 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MansuriYamin/907cb669c98b768b893d3a68d933d975 to your computer and use it in GitHub Desktop.
Save MansuriYamin/907cb669c98b768b893d3a68d933d975 to your computer and use it in GitHub Desktop.
Box(modifier = modifier) {
Layout(
measurePolicy = customSliderMeasurePolicy(
itemCount = itemCount,
gap = gap,
value = value,
startValue = valueRange.start
),
content = {
if (showLabel)
Label(
modifier = Modifier.layoutId(CustomSliderComponents.LABEL),
value = value,
label = label
)
Box(modifier = Modifier.layoutId(CustomSliderComponents.THUMB)) {
thumb(value.roundToInt())
}
Slider(
modifier = Modifier
.fillMaxWidth()
.layoutId(CustomSliderComponents.SLIDER),
value = value,
valueRange = valueRange,
steps = steps,
onValueChange = { onValueChange(it) },
thumb = {
thumb(value.roundToInt())
},
track = { track(it) },
enabled = enabled
)
if (showIndicator)
Indicator(
modifier = Modifier.layoutId(CustomSliderComponents.INDICATOR),
valueRange = valueRange,
gap = gap,
indicator = indicator
)
}
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment