-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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
Conversation
Looks good! Could you do the same update for |
@guidezpl Nice catch :) |
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.
_ ___ _____ __ __
| | / __|_ _| \/ |
| |_| (_ | | | | |\/| |
|____\___| |_| |_| |_|
|
||
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) { |
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.
super nit: double space
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.
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` |
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.
Since the regression tests link to this issue, this comment and the one in range_slider.dart
arent' strictly necessary
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.
Removed.
Description
When updating the
divisions
andvalue
of the slider at the same time, the position of the thumb is wrong because the olddivisions
value is used.Related Issues
Fixes #65943
Tests
See files.