Skip to content
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

Fix bug when updating the divisions and value of the slider at the same time #65998

Merged
merged 4 commits into from
Sep 18, 2020

Conversation

xu-baolin
Copy link
Member

Description

When updating the divisions and value of the slider at the same time, the position of the thumb is wrong because the old divisions value is used.

Related Issues

Fixes #65943

Tests

See files.

@flutter-dashboard flutter-dashboard bot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Sep 17, 2020
@guidezpl
Copy link
Member

Looks good! Could you do the same update for RangeSlider as well?

@xu-baolin
Copy link
Member Author

xu-baolin commented Sep 17, 2020

Looks good! Could you do the same update for RangeSlider as well?

@guidezpl Nice catch :)

Copy link
Member

@guidezpl guidezpl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  _    ___ _____ __  __ 
 | |  / __|_   _|  \/  |
 | |_| (_ | | | | |\/| |
 |____\___| |_| |_|  |_|
                        


testWidgets('Update the divisions and value at the same time for Slider', (WidgetTester tester) async {
// Regress test for https://github.com/flutter/flutter/issues/65943
Widget buildFrame(double maxValue) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super nit: double space

Copy link
Member Author

@xu-baolin xu-baolin Sep 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.
Move the RangeSlider test case to another file.

@@ -837,8 +837,11 @@ class _SliderRenderObjectWidget extends LeafRenderObjectWidget {
@override
void updateRenderObject(BuildContext context, _RenderSlider renderObject) {
renderObject
..value = value
// We should update the `divisions` ahead of `value`, because the `value`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the regression tests link to this issue, this comment and the one in range_slider.dartarent' strictly necessary

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

@wenxiangjiang
Copy link

Well done. Thanks.

IMG_7471

@fluttergithubbot fluttergithubbot merged commit 73194cd into flutter:master Sep 18, 2020
goderbauer pushed a commit to goderbauer/flutter that referenced this pull request Sep 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
5 participants