-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Support trackpad gestures in framework #89944
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
Conversation
79d08f3
to
2449c4b
Compare
2449c4b
to
9387f14
Compare
9387f14
to
93ca3d0
Compare
1dd37a9
to
7489668
Compare
7489668
to
0f679c4
Compare
0f679c4
to
3db475f
Compare
3db475f
to
ea2ddf7
Compare
be93d39
to
a9268a7
Compare
I'm removing the tool label, as the only tool change is a single key in an XML config template. |
27bf470
to
c845637
Compare
f70655e
to
20a63c0
Compare
2bed953
to
f1c56e2
Compare
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.
Sorry for taking so long. Only minor changes requested.
Thanks for preparing this huge PR!
@@ -6108,6 +6111,15 @@ class Listener extends SingleChildRenderObjectWidget { | |||
/// no longer directed towards this receiver. | |||
final PointerCancelEventListener? onPointerCancel; | |||
|
|||
/// Called when a pan/zoom begins such as from a trackpad gesture |
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.
I don't feel like using "/" in official names. I'm thinking if we can use pan-zoom
. But let's see what others think before making the change.
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.
Also, I mentioned this elsewhere, but this also includes rotation, right?
Otherwise to me, pan/zoom seems like pan or zoom, and pan-zoom seems like pan and zoom. In my testing on my Macbook, it seems like a 2 finder pan gesture is treated separately from a pinch-to-zoom, so maybe pan/zoom is most accurate? See my discussion about combining gestures like this in my main review comment.
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.
Also, add periods at the end of these 3 comments.
f1c56e2
to
5701063
Compare
a4302fe
to
248c3ae
Compare
248c3ae
to
a379831
Compare
The list scroll should stop on a tap. Now this is especially inconvenient, if you push the list a little, it will scroll for several seconds and at this time you can’t click anything in the list + you can’t stop it. |
@alexeylopukh can you file a new issue describing what you're seeing and what should happen instead? |
This PR introduces a breaking change @dkwingsmt Listener(
onPointerSignal: (sig) {
if (sig is PointerScrollEvent) { /* this is no longer triggered on trackpad scroll*/ }
},
) |
…163898) [ScrollBehavior.dragDevices](https://api.flutter.dev/flutter/widgets/ScrollBehavior/dragDevices.html) docs say > By default only PointerDeviceKind.touch, PointerDeviceKind.stylus, and PointerDeviceKind.invertedStylus are configured to create drag gestures. However, `PointerDeviceKind.trackpad` is also included by default #89944 https://github.com/flutter/flutter/blob/401ab831ee56bb31b8beceb0a08bc3293f1a9788/packages/flutter/lib/src/widgets/scroll_configuration.dart#L115-L119 https://github.com/flutter/flutter/blob/401ab831ee56bb31b8beceb0a08bc3293f1a9788/packages/flutter/lib/src/widgets/scroll_configuration.dart#L33 Update the comment to include `trackpad`: > By default only PointerDeviceKind.touch, PointerDeviceKind.stylus, PointerDeviceKind.invertedStylus, **and PointerDeviceKind.trackpad** are configured to create drag gestures. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
This commit adds support for new pointer events to convey trackpad gesture information. These new events will trigger existing widgets that expect scale or pan gestures.
PointerPanZoomStartEvent
,PointerPanZoomUpdateEvent
,PointerPanZoomEndEvent
) to convey the states of a trackpad gestureDragGestureRecognizer
andScaleGestureRecognizer
have been updated)GestureDetector
has been updated so thatonScale
,onPan
,onVerticalDrag
, andonHorizontalDrag
will trigger from trackpad gesturesDesign Document
Engine PR: flutter/engine#28571
Addresses #23604
Closes #63084
Widgets that use
GestureRecognizers
directly instead ofGestureDetector
will need to handle theonPointerPanZoomStart
callback ofListener
with theirGestureRecognizers
to receive trackpad gesture events.Pre-launch Checklist
///
).