Fix RangeSlider renders track when track colors are transparent #162386
Fix RangeSlider renders track when track colors are transparent #162386auto-submit[bot] merged 2 commits intoflutter:masterfrom TahaTesser:fix_range_slider_thumbs_padding
RangeSlider renders track when track colors are transparent #162386Conversation
| sliderTheme.inactiveTrackColor ?? | ||
| theme.colorScheme.primary.withOpacity(0.24); | ||
| final double effectiveTrackHeight = | ||
| effectiveActiveTrackColor != Colors.transparent && |
There was a problem hiding this comment.
In the other Slider fix PR(#161814), it seems only when both track colors are transparent, we set the height to 0. But here it looks like as long as one of the track colors is transparent, we set the height to 0?
There was a problem hiding this comment.
it checks if both active and inactive colors are transparent.
I moved the check into BaseRangeSliderTrackShape to match with #161814. That's why I conditional look slightly different now. It was returning height when colors isn't transparent but in the base shape, we don't need to return regular height :)
RangeSlider thumbs cannot reach extreme endsRangeSlider renders track when track colors are transparent
|
|
||
| // If the track colors are transparent, then override only the track height | ||
| // to maintain overall Slider width. | ||
| if (sliderTheme.activeTrackColor == Colors.transparent && |
There was a problem hiding this comment.
Thanks so much for your patience!
I tested this change locally, but seems if we only set one of the track color to transparent, we still cannot reach the 2 ends and somehow when I ran the sample app on macOS, the thumb is really hard to get focused and dragged.
Screen.Recording.2025-02-12.at.12.27.35.AM.mov
There was a problem hiding this comment.
Can you please share the code sample from this video? It could be the default thumb padding, which cannot be customized without setting the overlay radius to zero in RangeSlider, as shown in the PR sample. A few months ago, I added a new Slider.padding property so we don't have to override the overlay size to get rid default thumb padding. This isn't available in RangeSlider yet.
The reason it could be difficult to focus and drag the thumb is that, as the issue author uses a SizedBox to constrain the track heigh as a result the track height constrained and is much smaller than the thumbs. This is a sample issue, can be tested without this PR.
However, constrained SizedBox isn't required to reproduce this bug so I've updated the PR description with new sample.
|
Rebased to resolve commit conflict. |
QuncCccccc
left a comment
There was a problem hiding this comment.
LGTM:) Sorry for the late response.
Description
Fixes
Sliderwith transparent track colors and customtrackHeightcannot reach the extreme ends but forRangeSlider.Code Sample
expand to view the code sample
Before
After
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.