-
Notifications
You must be signed in to change notification settings - Fork 29.7k
[Material] Create a themable Range Slider (continuous and discrete) #31681
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
rami-a
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.
Comments from reviewing range_slider.dart only so far. Will continue to review the rest of the change.
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.
Usually we try to stick to theming variables being overridable on the individual widgets, should we consider adding Color thumbStrokeColor as a field on this class, then doing thumbStrokeColor ?? sliderTheme.thumbStrokeColor here?
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.
Slider is a bit different on the way it handles this. This slider theme these painters get is actually a copy where it already resolved any widget specific inputs (see line 511 in range_slider.dart)
rami-a
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.
Just a review of slider_theme.dart
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
rami-a
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.
Review of test file
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 think it may be beneficial to avoid duplication and extract a buildApp function
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 was done for all of the tests that did not need values, but there is not much value in doing it for the test that depend on setting the state of values (no pun intended)
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 test is quite large, consider splitting it into smaller tests.
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.
Good idea. I was able to split this up quite a bit.
|
A Googler has manually verified that the CLAs look good. (Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.) ℹ️ Googlers: Go here for more info. |
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
31872d3 to
6aca6ac
Compare
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
|
Most comments resolved, PTAL |
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
In places that test boolean values, either verify that we're ensuring that the value will be non-null or test == true or == false.
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.
That was my mistake. Using an AnimatedBuilder fails because the subtree doesn't change when the AnimatedBuilder's builder runs, since the subtree is just the same RenderWidget.
* master: (25 commits) Increase daemon protocol version for getSupportedPlatforms (flutter#33980) skip web test on crazy import (flutter#34017) Compatibility pass on flutter/foundation tests for JavaScript compilation. (1) (flutter#33349) 0602dbb Roll src/third_party/dart 9dcb026b26..6e0d978505 (72 commits) (flutter#34027) Add chrome stable to dockerfile and web shard (flutter#33787) Codegen an entrypoint for flutter web applications (flutter#33956) Revert "Reland "Text inline widgets, TextSpan rework" (flutter#33946)" (flutter#34002) Revert "Re-add deprecated method for plugin migration compatibility. (flutter#34006)" (flutter#34022) Remove print (flutter#34004) Manual roll the engine to land the timing API (flutter#33989) Make plugins Swift-first on macOS (flutter#33997) Re-add deprecated method for plugin migration compatibility. (flutter#34006) make sure version check includes hotfixes (flutter#33459) Respond to AndroidView focus events. (flutter#33901) Add 'doctor' support for Windows (flutter#33872) Add use_frameworks to macOS Podfile template (flutter#33987) [Material] Create a themable Range Slider (continuous and discrete) (flutter#31681) Updating names to correct versioning convention (flutter#33865) Whitelist adb.exe heap corruption exit code. (flutter#33951) [flutter_tool] Fix 'q' for Fuchsia profile/debug mode (flutter#33846) ...
The slider track shape for the onPrimaryColors constructor should be rounded, but it was accidentally changed to rectangular in #31681. This change restores the original behavior. This only affects sliders that are themed with SliderThemeData.onPrimaryColors().
| expect(description, <String>[ | ||
| 'trackHeight: 7.0', | ||
| 'activeTrackColor: Color(0xff000001)', | ||
| 'activeTrackColor: Color(0xff000001)', |
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 am assuming it's not intentional that activeTrackColor is printed twice? I am removing it in #34012.
Description
Creates a Material Design range slider.
The range slider is based off the updated slider, with the main difference being that it has 2 thumbs.
By default, the thumbs cannot pass each other and both the thumb and the value indicator create a stroke when they are overlapping for better visibility.
Related Issues
#18083
Tests
I added the following tests:
Behavior tests for range slider have been added in range_slider_test.dart. Appearence tests will be updated with goldens.
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
Does your PR require Flutter developers to manually update their apps to accommodate your change?