-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Slider and RangeSlider can be painted in a narrower constraint like other Material Wi… #64627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…dget such as Switch
…dget such as Switch
HansMuller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks OK to me. It would be helpful to include a screenshot in the PR's description, to demo what happens when the width gets small.
Deferring to Anthony and Jose...
| return Rect.fromLTWH(trackLeft, trackTop, trackWidth, trackHeight); | ||
| final double trackRight = trackLeft + parentBox.size.width - math.max(thumbWidth, overlayWidth); | ||
| final double trackButtom = trackTop + trackHeight; | ||
| // if the parentBox.size < slider's size, the trackRight will less then trackLeft, we need switch them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the .. will be less.., so switch them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
HansMuller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to fixup the analyzer errors..
Fixed. I update the PR description above. |
| isDiscrete: isDiscrete, | ||
| ); | ||
| final Rect leftTrackSegment = Rect.fromLTRB(trackRect.left, trackRect.top, leftThumbOffset.dx - thumbRadius, trackRect.bottom); | ||
| final Rect leftTrackSegment = Rect.fromLTRB(trackRect.left, trackRect.top, leftThumbOffset.dx, trackRect.bottom); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remove the gap between the inactive track and active track, also see #64534
|
@clocksmith Hi, please review. :) |
HansMuller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The inexplicable extra import of dart:math in slider.dart could be broken out as a separate PR. Should be a quickie.
OK, I will do it right now. |
Done. #65060 |
HansMuller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…ther Material Wi… (flutter#64627)
Description
This PR change
Slidercan not be painted in a narrower constraint like other Material Widgets such asSwitch.If I just remove the assert checks, the fellow demo code paint

Sliderincorrectly below(the active track and inactive track switched mistake), so I modify thegetPreferredRectlogic.After change:

The issue #64629 root cause is that, when minimizing the window the screen size will change to zero and trigger a
flushPaint.This change does make the appearance of the issue disappear, but I am not sure whether the window size change to zero is intended, I think we can track that at a new issue, right?
DEMO
Related Issues
Fixes #64629
Tests
I added the following tests:
See files.
Checklist
Before you create this PR, confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.