Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upUnexpected behaviour of SliverAppBar in NestedScrollView on Mouse Scroll #55362
Comments
|
This may need more triage. It is not clear if this is a web-only issue or if it affects desktop as well. |
|
Seems unlikely to be Web-specific so I'm removing that label for now; let's add it back if it doesn't repro on other platforms. |
|
may be related: #64266 |
|
Hi @RoyARG02
This has been fixed with NestedScrollview.floatHeaderSlivers, I don't believe this was specific to mouse scrolling
Also should be fixed outside the scope of the mouse scroll.
I have a theory about this, though I am still familiarizing myself with PointerEvents. It looks like pointer events are being received by the individual inner/outer scroll views rather than the NestedScrollView's scroll position coordinator. When running your reproduction, if you mouse scroll on the outer scroll view, the content in the NestedScrollView.headerSliverBuilder, it will scroll as expected, until it reaches its full extent. Additional mouse scroll is not passed on to the inner scroll view. The header glitch you mentioned happens when you mouse scroll while hovering over the inner scroll view, or the NestedScrollView.body. When handling a pointer event, the event is sent to every HitTestTarget in the entries of the given HitTestResult. I think the inner scroll view is receiving the event and, rather than the event being handled by the nested scroll coordinator, the inner position is affected directly. According to the NestedScrollView, if the inner position's offset is > 0, then the outer position must be at its full extent, or in this case collapsed. NestedScrollView does this in order to make sure the scroll views stay in proper alignment/sync in case the scroll offset of either position is manipulated directly (rather than using the nested scroll coordinator). Basically, the inner scroll position changes, which the NestedScrollView then tries to correct in order to match expected alignment - thus the instant change in the header. I'm going to keep looking into this and see what kind of special handling we can do for pointer events and the nested scroll view. |
@Piinks now that you've mentioned, the glitch happens the other way round too. Case in point, scrolling while hovering on the header to expand it makes the inner scroll jump to the beginning. |
I'm attempting to build a webpage using
NestedScrollView. But I'm encountering various issues when scrolling by mouse wheel:pinned: true) or disappears (floating: true) on single mouse scroll tick.floating: truedoes not "float" the SliverAppBar, even after settingsnap: true, unlike #17518.pinnedandfloatingare both set totrue(Removing it fixes this issue).Except for the last issue and #17518, the above-mentioned issues are not exhibited when mouse hold-and-drag is used to scroll the NestedScrollView.
Steps to Reproduce
flutter create bug.Logs