fix(scroll): use widget.scrollBehavior and add trackpad support#3
Open
sichang824 wants to merge 3 commits intorobert-luoqing:masterfrom
Open
fix(scroll): use widget.scrollBehavior and add trackpad support#3sichang824 wants to merge 3 commits intorobert-luoqing:masterfrom
sichang824 wants to merge 3 commits intorobert-luoqing:masterfrom
Conversation
- Use widget.scrollBehavior if provided instead of always overriding - Add PointerDeviceKind.trackpad to default dragDevices for better desktop support
- Add unit tests verifying trackpad support in dragDevices - Document the fix behavior in test comments
…t-frame callbacks Prevent "ValueNotifier was used after being disposed" by adding if (!mounted) return in all addPostFrameCallback/SchedulerBinding callbacks that touch ValueNotifier (newMessageCount, showLastUnreadButton, isShowMoveToTop). Also guard _determineShowNewMsgCount() entry. Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On macOS (and desktop platforms in general), mouse wheel scroll events (
PointerScrollEvent) are only delivered to the widget that wins the hit test. In ChatList, the topmost widgets are message bubbles (containingMouseRegion,SelectableText, etc.), not the internalScrollable.The current
ScrollConfigurationin_renderList()only configuresdragDevices(for drag-to-scroll), but this does not affect which widget receives wheel events. As a result, mouse wheel scrolling does not work properly on desktop platforms.Additionally, the
widget.scrollBehaviorparameter is passed toFlutterListViewbut is ignored by the outerScrollConfiguration, making it impossible for users to customize scroll behavior.Solution
Use
widget.scrollBehaviorif provided - This allows users to pass a customScrollBehaviorthat will be applied to the outerScrollConfiguration, giving full control over scroll behavior.Add
PointerDeviceKind.trackpadto defaultdragDevices- This improves trackpad scrolling support on desktop platforms.Changes
Testing
test/scroll_behavior_test.dart