Nitesh Singh
04/07/2025, 1:37 PMSlider(
value = value,
onValueChange = onValueChange,
modifier = Modifier
.fillMaxWidth()
// Apply horizontal padding to the slider itself
// This ensures the track doesn't go edge-to-edge, matching the offset calculation space
.padding(horizontal = sliderPadding),
valueRange = valueRange,
colors = SliderDefaults.colors(
thumbColor = thumbColor,
activeTrackColor = thumbColor,
inactiveTrackColor = thumbColor
),
// *** CHANGE HERE: Provide custom thumb composable ***
thumb = {
Box(
modifier = Modifier
.size(thumbSize) // Apply desired size
.clip(CircleShape) // Clip to a circle
.background(thumbColor) // Apply the desired color
)
// The Slider component automatically handles placing this thumb
// at the correct position based on the value.
}
)
mattinger
04/07/2025, 1:54 PMmattinger
04/07/2025, 1:59 PMprivate val ThumbTrackGapSize: Dp = SliderTokens.ActiveHandleLeadingSpace
which evaluates to 6dpNitesh Singh
04/08/2025, 11:55 AMmattinger
04/08/2025, 12:50 PM