199 Commits

Author SHA1 Message Date
Anis Alibegić
c99ed373b3
Fixed large amount of spelling errors (#83744) 2021-06-02 10:14:06 -07:00
Ian Hickson
5e0cc4cba4
Migrate to ChannelBuffers.push (#82564) 2021-05-21 15:09:03 -07:00
Todd Volkert
1cf492f254
Re-apply "Gesture recognizer cleanup" (#82885)
This is a re-application of https://github.com/flutter/flutter/pull/81884,
but with https://github.com/flutter/flutter/pull/82834 landed first.

Fixes https://github.com/flutter/flutter/issues/81883
2021-05-19 16:32:15 -07:00
Hattomo (TomohiroHattori)
08a70e7ac8
Enable avoid_escaping_inner_quotes lint (#81153) 2021-05-19 09:54:02 -07:00
Tong Mu
4c1709642a
Drag gesture recognizer accepts all pointers when any pointer is accepted (#82786) 2021-05-18 20:39:05 -07:00
Todd Volkert
3fc408200e
Revert "Gesture recognizer cleanup (#81884)" (#82831)
This reverts commit e88a387b26b097d8516c92babe1287edede79206.
2021-05-18 09:50:24 -07:00
Todd Volkert
e88a387b26
Gesture recognizer cleanup (#81884)
* Gesture recognizer cleanup

1) Make OneSequenceGestureRecognizer.addAllowedPointer()
   call startTrackingPointer(), and change subclasses to
   call super.addAllowedPointer() in place of manually
   calling startTrackingPointer().
2) Fix addAllowedPointer overrides to take PointerDownEvent
   where some were taking PointerEvent.
3) Add API documentation to OneSequenceGestureRecognizer
4) Make the following fields in OneSequenceGestureRecognizer
   private with public getters instead of publicly writable:
   `state`, `primaryPointer`, and `initialPosition`.
5) Clean up gesture recognizer state in
   OneSequenceGestureRecognizer.didStopTrackingLastPointer.

Fixes #81883
2021-05-17 16:53:49 -07:00
Ian Hickson
2ae1e39810
Revert "Migrate to ChannelBuffers.push (#82057)" (#82525) 2021-05-14 12:09:03 -07:00
xubaolin
ea09f4ecbc
update the DragStartBehavior documetations (#82327) 2021-05-14 00:09:02 -07:00
Ian Hickson
b86d5c0094
Migrate to ChannelBuffers.push (#82057) 2021-05-13 14:34:04 -07:00
Abhishek Ghaskata
254c9f1755
Enable use_named_constants_lint (#82426) 2021-05-13 13:29:06 -07:00
Kate Lovett
e74c15cac4
Deprecate GestureDetector.kind in favor of new supportedDevices (#81858) 2021-05-07 14:24:03 -07:00
Ren You
7f1d1414cc
Revert "Migrate to ChannelBuffers.push (#81235)" (#81829)
This reverts commit 35ad43f20caa71ec051a97bc8bc8fec552fb4452.
2021-05-04 06:17:19 -07:00
Ian Hickson
35ad43f20c
Migrate to ChannelBuffers.push (#81235) 2021-05-03 17:14:03 -07:00
Jonah Williams
fff8ecfb94
[flutter] reject mouse drags by default in scrollables (#81569) 2021-05-03 16:54:02 -07:00
Todd Volkert
91de4bd3e3
Add onLongPressDown, onLongPressCancel (#81260)
This adds support for GestureDetector.onLongPressDown and
GestureDetector.onLongPressCancel, allowing callers to register
interest in the initial pointer contact that might turn into
a long-press (and the associated cancel event if the gesture
loses).
2021-04-28 12:51:27 -07:00
Todd Volkert
4e7c052b63
Fix bug in LongPressGestureRecognizer (#81340)
It was incorrectly resetting state when it received a
non-allowed pointer but had already accepted a gesture.

https://github.com/flutter/flutter/issues/81339
2021-04-28 09:11:13 -07:00
leo
8ddfc80c7f
fix resampling leads to Hard to tap (#81022)
* fix PointerUpEvent conversion PointerMoveEvent needs to use the default buttons value.(#73286)

* feat PointerMoveEvent conversion adds test cases

* fix event conversion may modify the original buttons value.

* Update packages/flutter/lib/src/gestures/resampler.dart

Co-authored-by: David Reveman <dreveman@gmail.com>
2021-04-28 11:34:28 -04:00
Angjie Li
b74df388e1
Revert "Migrate to ChannelBuffers.push (#76288)" (#81226)
This reverts commit c26ed03c8a77810136cc087ae60048ace062842d.
2021-04-26 12:57:17 -07:00
Ian Hickson
c26ed03c8a
Migrate to ChannelBuffers.push (#76288)
* Migrate to ChannelBuffers.push

* Move TestDefaultBinaryMessenger to its own file

* Apply deprecations and fix usages
2021-04-23 15:39:34 -07:00
Alexandre Ardhuin
c5a3ee7f31
add trailing commas in flutter/test/{foundation,gestures} (#80926) 2021-04-22 22:33:59 +02:00
Phil Quitslund
61c30c41b2
fix sort_directives violations (#80817) 2021-04-21 13:49:03 -07:00
xubaolin
f4a6b21869
Fix a rotation gesture bug (#79035) 2021-04-07 22:29:02 -07:00
Alexandre Ardhuin
e384ca7979
use null aware operators for function invocations (#79049) 2021-03-26 09:34:03 -07:00
Ian Hickson
f3c25fa07a
Align more closely with package:test (#77118) (#78343) 2021-03-16 13:58:02 -07:00
Zachary Anderson
e7e1a04aa3
Revert "Align more closely with package:test (#77118)" (#78329)
This reverts commit 0cbe597540f6b51ab7157ab8747906e9923b79e4.
2021-03-16 09:26:34 -07:00
Ian Hickson
0cbe597540
Align more closely with package:test (#77118) 2021-03-15 16:28:02 -07:00
David Reveman
7a6af0cf2c
Reland: Timer based pointer event resampling (#76195)
This reverts #76179 and relands #73042 with an active timer check fix.

Co-authored-by: David Reveman <reveman@google.com>
2021-02-17 13:09:19 -05:00
Jenn Magder
50897c98fc
Revert "Timer based pointer event resampling (#73042)" (#76179)
This reverts commit 9133deb9a714b0853faeed4892b220ae7a77e5a5.
2021-02-16 20:13:53 -08:00
David Reveman
9133deb9a7
Timer based pointer event resampling (#73042)
Timer based pointer event resampling

This provides two improvements to pointer event resampling:

1. PostFrameCallbacks are used instead of scheduling frames. This
avoids unnecessary rendering work when resampling is used.

2. Resampling continues when frames are not produced. I.e. input
events keep being delivered at a fixed frequency even if frame
production is taking a long time.

This fixes #72924

Co-authored-by: David Reveman <reveman@google.com>
Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2021-02-16 21:29:59 -05:00
Michael Goderbauer
6afbb25a48
Reject unaccepted pointers in Drag recognizer (#75943) 2021-02-16 10:26:03 -08:00
Sam Rawlins
d0d9b80520
Remove "unnecessary" imports in foundation,gestures tests (#75007) 2021-01-29 14:46:06 -08:00
Alexandre Ardhuin
d546e1d311
fix for upcoming lint use_named_constants (#74788) 2021-01-27 20:20:44 +01:00
xubaolin
4bdea117a4
fix a tap gesture exception (#73846) 2021-01-21 17:29:04 -08:00
xubaolin
32dc1b7d00
Add [pointerCount] property to Scale Gesture Details (#73474) 2021-01-11 19:14:04 -08:00
Tong Mu
e1712ccefc
Reland: Fix a multiple pointers bug
This relands #68587
2020-11-05 18:38:15 -08:00
David Reveman
4aad058a49
Improve resampling of up and remove events. (#69096)
* Improve resampling of up and remove events.

This improves resampling of these events by searching
for them until the next approximate sample time.

Co-authored-by: David Reveman <reveman@google.com>
2020-10-28 17:02:37 -04:00
Jonah Williams
b25ce5b16c
Revert "Fix a multiple pointers bug (#68587)" (#68841)
This reverts commit bde85ea3bb3e80c1294c6d084eb5f9804867be8f.
2020-10-22 19:16:08 -07:00
xubaolin
bde85ea3bb
Fix a multiple pointers bug (#68587)
* Fix mutiple pointers bug

* Add unit test case

* Remove unnecessary map clone
2020-10-22 16:09:47 -07:00
Jonah Williams
c606f044d7
[gestures] make stylus pointer types use touch pan/drag slop (#67885) 2020-10-12 15:20:50 -07:00
Michael Goderbauer
42fa4f033b
Migrate some more non-test utils for tests (#67351) 2020-10-05 18:12:04 -07:00
Darren Austin
01e8c39534
Migrate gestures, physics and scheduler tests to null safety. (#62701) 2020-10-05 16:01:34 -07:00
Tong Mu
2cdf2f0059
Treat hover events as normal pointer events, and bring them back to Listener (#63834) 2020-10-05 12:12:04 -07:00
Michael Goderbauer
687121d6da
Migrate some tests to null-safety (#67085) 2020-10-02 21:52:02 -07:00
Tong Mu
74fe6bff84
Lazily compute PointerEvent's transformed positions (#63813)
* PointerEvent.local* properties are calculated lazily; other properties are delegated to original.
* Transformed PointerEvent becomes a subclass of its original class.
* Unnamed constructors no longer accepts transform and origin.
2020-10-02 15:09:23 -07:00
David Reveman
371667ec94
Fix resampling of down, up, and remove events. (#67080)
This adds the neccessary synthetic move/hover events to
resampler, which is needed for position to not change as
part of a down, up, or remove event.

Co-authored-by: David Reveman <reveman@google.com>
2020-10-02 16:16:57 -04:00
Jonah Williams
b1d17c914d
Deprecate VelocityTracker default constructor and added VelocityTracker.withKind constructor (#66043)
We've gotten feedback that the VelocityTracker change was disruptive, though it did not break any of the flutter framework or customer tests. In order to make the change non-breaking, PointerDeviceKind parameter can be made optional.

Nevertheless, this parameter should be provided so that the existing touch handlers can use more accurate gestures on mouse/stylus inputs, so we can encourage this by deprecating the default constructor and pointing users towards the VelocityTracker.withKind constructor that takes a non-optional parameter
2020-09-17 15:18:31 -07:00
Michael R Fairhurst
7f3c9b6bda
Remove unused 'dart:async' imports. (#65568) 2020-09-16 14:14:06 -07:00
Tong Mu
a48e14308e
Expose GestureBinding.handlePointerEvent, replacing dispatchEvent as the preferred way to dispatch events (#64846) 2020-09-15 22:17:06 -07:00
Jonah Williams
29898812d4
[framework] make hit slop based on device pointer kind for drag/pan/scale gestures (#64267)
Currently the framework uses fairly large "hit slop" values to disambiguate taps from drags/pans. This makes sense on touch devices where the interaction is not very precise, on mice however it can feel as if the UI is lagging. This is immediately noticeable on our infra dashboard, where it takes almost half of a grid square of drag before the actual drag kicks in.

One potential solution is to always use smaller constants depending on whether the interaction is mouse or touch based. The only reasonable choice is to use the pointer device kind and not target platform - same platform can have different input sources. This requires exposing the pointer device kind in a few new places in several of the gesture detectors, and using the enum to compute the correct hit slop from an expanded set of constants.

This almost works, however there are a few places (notably ListViews) which uses the touch hit slop as a default value in scroll physics. It does not seem like it will be easy to disambiguate a user provided scroll physics constant from the default and/or adjust it somehow - this might require significant changes to scroll physics which I have left out of this PR.

This PR does not adjust:

kTouchSlop used in scroll_physics.dart's minFlingDistance
kTouchSlop used in PrimaryPointerGestureRecognizer/LongPressGestureRecognizer
2020-09-08 15:53:36 -07:00