I need help I should need remove to white color ar...
# compose
n
I need help I should need remove to white color around circular .
Copy code
Slider(
    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.
    }
)
m
I suspect that gap is deliberately coded into the component. Here's the default (top) and custom thumb in the preview. So unless you see a parameter to lessen that gap, I think you might be out of luck.
I suspect it's this value if you look at the source code:
Copy code
private val ThumbTrackGapSize: Dp = SliderTokens.ActiveHandleLeadingSpace
which evaluates to 6dp
n
how i will use that code in my code ?
m
Well, unless you want to write something from the ground up, you're going to have to copy the existing control to your code and make tweaks to it. I will however, caution you that I, personally, never like doing this, because you sacrifice maintainability this way. Every upgrade to the original library means you may have to go back and re-create what you've done, or you could have lingering bugs or whatever. Plus sometimes it's not as simple as a single file copy. A lot of times, this is spread out amongst different files, many times with some support functions being either file private or library internal. If you have any leeway to go back to your UX team and accept the look and feel of the built in control I would try to do that first.