Fix pointer scroll for nested NeverScrollables#70953
Fix pointer scroll for nested NeverScrollables#70953fluttergithubbot merged 5 commits intoflutter:masterfrom
Conversation
|
When I saw the code I understood completely. It was an oversight on my part. |
|
LGTM~ |
| final double targetScrollOffset = _targetScrollOffsetForPointerScroll(event); | ||
| // Only express interest in the event if it would actually result in a scroll. | ||
| if (targetScrollOffset != 0) { | ||
| if (targetScrollOffset != position.pixels) { |
There was a problem hiding this comment.
Should we be checking _physics != null && !_physics!.shouldAcceptUserOffset(position)) before calling pointerSignalResolver.register?
There was a problem hiding this comment.
That was part of another change, but I moved it to precede pointerSignalResolver.register and all the tests passed. Makes sense to me!
There was a problem hiding this comment.
Stack(
children: [
Positioned.fill(
child: someList(),
),
someList(
physics: NeverScrollableScrollPhysics,
),
],
);If my pointer signal scrolls on the second list, should the expected behavior be to scroll nothing at all?
If you moved, then the first list is scrolled.
I believe this is a bit counterintuitive?
There was a problem hiding this comment.
This is actually a common design pattern I've seen before. In the repro provided in the bug, it creates two parallel scroll views that scroll as one. Another similar use case was reported in #70902
|
Is this PR related to https://stackoverflow.com/questions/67706136/nested-listviews-scrolling-behavior-different-when-scrolled-using-drag-vs-scroll? I'd really like to know as the solution I have is to use Listener and MouseRegion combination to control scrollbehavior but my nested list rebuild is expensive. |
Description
This fixes a regression introduced in #66039
While initiating a pointerScroll for a Scrollable with the computed delta is correct, determining the scrollable that receives the pointer scroll event should still go through the targetScrollOffset evaluation first, otherwise in the case of the nested NeverScrollable, the event is claimed by the wrong scroll view.
Related Issues
Fixes #70948
Tests
PointerScroll on nested NeverScrollable ListView goes to outer Scrollable.
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.