Fix RangeSlider dragged cursor handling.#179988
Conversation
There was a problem hiding this comment.
Code Review
This pull request addresses an issue with dragged cursor handling in RangeSlider. The _handleDragStart and _handleDragEnd methods now call setState to update the _dragging flag, ensuring the widget rebuilds and reflects the correct cursor state. The implementation also replaces MaterialState with WidgetState, including MaterialStatePropertyAll with WidgetStatePropertyAll. Additionally, the test for WidgetStateMouseCursor has been rewritten to be more comprehensive, covering various states like disabled, hovered, and dragged, and using more direct gesture controls.
| ); | ||
| } | ||
|
|
||
| await tester.pumpWidget(buildApp(divisions: 3)); |
There was a problem hiding this comment.
The code change above makes sense to me, but why the test will fail when the divisions stays 3?
dkwingsmt
left a comment
There was a problem hiding this comment.
LGTM except for Qun's question.
|
Hi @QuncCccccc and @dkwingsmt. Thanks a lot for your reviews! Regarding the change from When
Once the snap occurs, the thumbs overlap at the same value, and the top thumb receives a white border. Previously, The expect(
valueIndicatorBox,
paints
// Represents the raised button wth next text.
..path(color: Colors.black)
..paragraph()
// Represents the range slider.
..path(color: fillColor)
..paragraph()
..path(color: fillColor)
..paragraph(),
);Because of the white border, the actual paint sequence includes an extra Expected sequence (with expect(
valueIndicatorBox,
paints
..path(color: Colors.black) // Button
..paragraph()
..path(color: fillColor) // Thumb Path 1
..paragraph()
..path(color: Colors.white) // <--- The white border path causing the mismatch
..path(color: fillColor) // Thumb Path 2
..paragraph(),
);By switching to |
QuncCccccc
left a comment
There was a problem hiding this comment.
Thanks for the detailed explanation! LGTM:)
|
@QuncCccccc thanks a lot for your review! |


Fixes #179987
Description
RangeSliderMaterialStateoccurrences withWidgetStatebefore.mov
after.mov
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.