101 Commits

Author SHA1 Message Date
Nate
17a27358a6
Implementing switch expressions in flutter/test/ (#144580)
Migrates test code to new `switch` syntax.
2024-03-14 14:20:44 -07:00
Ian Hickson
15ceca93a4
Enable contextMenuBuilder in the absence of selectionControls (#141810) 2024-01-23 00:49:05 +00:00
Anis Alibegić
81d80c587d
Fixed a lot of typos (#141431)
Fair amount of typos spotted and fixed. Some of them are in comments, some of them are in code and some of them are in nondart files.

There is no need for issues since it's a typo fix.

I have doubts about [packages/flutter_tools/lib/src/ios/core_devices.dart](https://github.com/flutter/flutter/compare/master...anisalibegic:flutter:master#diff-fdbc1496b4bbe7e2b445a567fd385677af861c0093774e3d8cc460fdd5b794fa), I have a feeling it might broke some things on the other end, even though it's a typo.
2024-01-12 22:10:25 +00:00
Polina Cherkasova
baf739c8e6
Remove usage of testWidgetsWithLeakTracking. (#140239) 2023-12-15 14:13:31 -08:00
Kostia Sokolovskyi
678413542c
SelectionOverlay and TextSelectionOverlay should dispatch creation and disposal events. (#138804) 2023-12-07 13:03:58 -08:00
Kostia Sokolovskyi
2d9a075dfc
Cover text_selection tests with leak tracking. (#137009) 2023-11-06 14:10:50 -08:00
Kate Lovett
90ae98f576
Remove deprecated TextSelectionOverlay.fadeDuration (#134485)
Part of https://github.com/flutter/flutter/issues/133171

This was deprecated in https://github.com/flutter/flutter/pull/100381
Th replacement is to use `SelectionOverlay.fadeDuration` instead.
This migration is supported by dart fix. âœ
2023-09-12 17:14:18 +00:00
Tomasz Gucio
e4e9dde4ed
Move TapAndDragGestureRecognizer code under gestures (#119508) 2023-07-19 11:48:01 +02:00
chunhtai
8a815c1d1d
Remove unecessary reference to ClipboardStatusNotifier (#125255)
fixes https://github.com/flutter/flutter/issues/99360
2023-04-21 22:38:06 +00:00
Camille Simon
52cacd9d1d
[iOS] Add spell check suggestions toolbar on tap (#119189)
[iOS] Add spell check suggestions toolbar on tap
2023-03-31 19:47:22 +00:00
Renzo Olivares
142dd6022f
Match iOS Longpress behavior with native (#123630)
Match iOS Longpress behavior with native
2023-03-29 20:22:03 +00:00
Renzo Olivares
04f6acd881
Add TextField triple tap/click gestures (#119046)
Add TextField triple tap/click gestures
2023-03-27 22:39:52 +00:00
Michael Goderbauer
fda9ecfef7
Remove 1745 decorative breaks (#123259)
Remove 1745 decorative breaks
2023-03-22 21:12:22 +00:00
LongCatIsLooong
f4551e6450
Reland "Update test font (#121306)" (#122068)
Reland "Update test font (#121306)"
2023-03-09 19:05:32 +00:00
LongCatIsLooong
33ffdd704f
Revert "Update test font (#121306)" (#122053)
This reverts commit 9f69a3679bc441d3ff985362e47b80ee2a51c60f.
2023-03-06 14:15:58 -08:00
LongCatIsLooong
9f69a3679b
Update test font (#121306)
Update test font
2023-03-06 21:46:51 +00:00
Bruno Leroux
046d907f53
Fix TextSelectionGestureDetectorBuilder wrong cause for onDoubleTapDown (#121093)
Co-authored-by: Bruno Leroux <bruno.leroux@gmail.com>
2023-02-23 09:24:17 +00:00
Ian Hickson
07c548c698
Apply BindingBase.checkInstance to TestDefaultBinaryMessengerBinding (#116937) 2023-02-13 23:55:58 +00:00
Renzo Olivares
9080d1acc5
Reland "Add support for double tap and drag for text selection #109573" (#117502)
* Revert "Revert "Add support for double tap and drag for text selection (#109573)" (#117497)"

This reverts commit 39fa0117a919bd401c4c8734c97ddb46fbc45cb7.

* Allow TapAndDragGestureRecognizer to accept pointer events from any devices -- the TapGestureRecognizer it replaces was previously doing this

Co-authored-by: Renzo Olivares <roliv@google.com>
2023-01-04 00:54:10 +00:00
Renzo Olivares
39fa0117a9
Revert "Add support for double tap and drag for text selection (#109573)" (#117497)
This reverts commit cd0f15a770992ec41445bd212aac73572c278fd1.

Co-authored-by: Renzo Olivares <roliv@google.com>
2022-12-21 23:29:07 +00:00
Renzo Olivares
cd0f15a770
Add support for double tap and drag for text selection (#109573)
* Replace PanGestureRecognizer in TextSelection with TapAndDragGestureRecognizer

* add tracking of _DragState to new tap_and_drag recognizer and remove some legacy double tap code from text_selection.dart and add logs"

* add dragTapCount, a tap count that is persistent for an entire drag and is set to null on drag end vs the regular tap count which is reset on a timer

* basic double tap to drag functionality and add a local dragTapCount in text_selection.dart to use with the timer callback

* Add offsetFromOrigin and localOffsetFromOrigin to DragUpdateDetails similar to LongPressMoveUpdateDetails, eliminates the need to hold the state of lastDragStartDetails

* make a generic baselongpressgesturerecognizer

* Revert "make a generic baselongpressgesturerecognizer"

This reverts commit aad8f7433bd01e4cd016d527af832c3b1f15fac5.

* rename tap_and_drag to selection_recognizers

* add mixin for consecutivetap

* tap and long press gesture recognizer

* Revert "Revert "make a generic baselongpressgesturerecognizer""

This reverts commit 181350c36718f644eada3e45c1b7b5939f90a340.

* Revert "Revert "Revert "make a generic baselongpressgesturerecognizer"""

This reverts commit 4d69775967858dfd66dd9429e1713da598908a85.

* Add support for secondary button clicks on drag gesture recognizer and separate drag end and tap up callback

* get test running

* rename tapCount to consecutiveTapCount

* dispose timer properly

* add some comments to tests

* Add comments

* Make ConsecutiveTapMixin private and move logic to increment tap count into mixin

* stop tracking pointer when gesture is rejected and detect drags on touch devices

* onCancel for TapAndDrag

* have the TapAndDragGestureRecognizer handle tap downs and tap ups on touch and mouse devices

* add drag to move cursor for android and iOS, and pointer device kind to DragUpdateDetails

* get tests running

* refactor TapAndDragGestureRecognizer moving some logic into _check methods

* Handle cancel properly on TapAndDragGestureRecognizer, having both onTapCancel and onDragCancel, also fix tests

* Fix test mouse drag selects and cannot drag cursor, save _initialPosition based on dragStartBehavior (either on tapDown or dragStart)

* determine if drag has a sufficient global distance to accept and fix some cancel behavior, making _checkCancel clearer

* give up pointer on drag end

* properly stop tracking pointer, fixes test for right click on Apple and non-apple platforms

* clean up some comments from last commit

* remove drag on touch for now

* fix Can select text by dragging with a mouse due to dragStart only being fired on the first PointerMoveEvent, the previous pan gesture recognizer would fire both dragStart and dragUpdate

* Revert "fix Can select text by dragging with a mouse due to dragStart only being fired on the first PointerMoveEvent, the previous pan gesture recognizer would fire both dragStart and dragUpdate"

This reverts commit 124dc79bc3389672c76d7c014ce04edab297abc6.

* correctly use _initialPosition for checkStart and call _checkUpdate after _checkStart if localDelta is not zero

* updates

* fix double tap chains

* Add docs

* Address analyzer

* more analyzer, only issues left are with print statements

* add deadlineTimer to fix conflict with ForcePressGestureRecognizer

* Revert "add deadlineTimer to fix conflict with ForcePressGestureRecognizer"

This reverts commit 3b29ddfff4cde4845edd481ecefb789fea2a0781.

* remove unecessary changes to tests

* secondaryButton should not drag

* Revert "Revert "add deadlineTimer to fix conflict with ForcePressGestureRecognizer""

This reverts commit 0a008f029f5796acd48c17c1897c0b700d5ef3a7.

* updates

* Revert "updates"

This reverts commit 4803b8443a2b67f0b8d29e9a01f712dfcb0f588c.

* Revert "Revert "Revert "add deadlineTimer to fix conflict with ForcePressGestureRecognizer"""

This reverts commit 79251a7af88d5dbb1460a960afc77e65dea18bff.

* fix shift + tap + drag tests, this was happening because a double tap + drag was being registered and not a single tap, added a duration to pumpAndSettle to fix this

* remove TapAndLongPressGestureRecognizer

* fix cupertino text field tests related to shift + tap + drag

* deadline timer try 2

* more logs

* Should reset taps when tap cancel is called, and should wait until gesture is accepted to initiate a drag

* should clear _down and _up when gesture is rejected

* remove erroneous log

* fix selectable text double tap chains test

* dont restart timer until tap up

* reset consecutiveTapCount on drag end

* fix selectableText test

* fix material text field tests

* reject TapAndDragGestureRecognizer when it is neither a tap nor a drag

* remove prints

* clean up

* shift aware

* clean up

* fix cupertino test

* fix text field focus tests

* Add 100ms delay to cupertino test, to prevent a double tap

* clean up test comments

* add comment to test

* uncomment test

* remove longpress changes

* Fix drag on mobile

* remove debug

* Fix drag to move cursor on iOS

* left over from drag fix

* add tests for drag on touch devices

* add test for double tap + drag mouse devices

* add tests

* Fix bug where initialPosition was used before it was set

* Address some review comments and fix issue where if double tap was held too long then long press gesture recognizer would take over

* remove _isDoubleTap flag since it is no longer needed due to previous commit

* Add docs for onTapCancel and onDragCancel

* analyzer fixes

* Do not test selection handles on macOS, since macOS does not support touch

* Add assert for dragStartBehavior

* add double tap + drag tests to cupertino

* use kDoubleTapTimeout instead of const Duration(milliseconds: 300) for readability

* analyzer issues

* update docs

* update more docs

* address comments

* more doc updates

* fix docs

* unused import

* fix docs

* Add more tests

* Add more tests and reject a tap up if we have exceeded the tap tolerance

* updates

* Address comments

* fix test naming

* update documentation

* move selection_recognizers to selection_gestures

* fix analyzer

* fix analyzer

* keysPressedOnDown instead of isShiftPressed

* update docs

* update docs

* Add drag update throttle to TapAndDragGestureRecognizer

* update comments

* missed from merge

* Replace _ConsecutiveTapMixin with _TapStatusTrackerMixin

* updates

* correctly cancel tap when when past tap tolerance with new implementation

* Should call tap and drag cancel if we are giving up a pointer without succesfully tracking a PointerUpEvent

* comments

* move pastTapTolerance to tap tracker

* move pastTapTolerance to tap tracker

* clean up check for nulls and remove use of consecutiveTapCountWhileDragging

* move call to super.acceptGesture to top

* remove print

* clean up

* Fix tests where both PanGestureRecognizer and TapAndDragGestureRecognizer lost

* clean up

* _GestureState -> _DragState

* more docs clean up

* more clean up

* Add onSecondaryTapCancel

* Add docs

* more docs

* Fix broken isPointerAllowed when attempting a right click drag - the _initialButtons is never reset

* revert debug flag

* make primaryPointer private

* Add support for upper count limit in TapAndDragGestureRecognizer, the tap counter should not be allowed to grow infinitely unless that is desired

* fix analyzer

* Use new TapDrag details objects and callbacks

* clean up docs

* clean up and add test for upperLimit

* Add docs for TapAndDragGestureRecognizer and remove some ambiguity of onStart onUpdate and onEnd parameters

* Address review comments

* analyzer fixes

* Call cancel before rejecting the gesture so we can still access _initialButtons

* Recognizer should reject any pointer differing from the original

* Revert "Recognizer should reject any pointer differing from the original"

This reverts commit afd9807480bd11e119bdd2b7d520631511973bab.

* Address reviewer comments

* Correct cancel behavior

* Fix consecutive tap + drag because _dragStart state was not being set when consecutive tap is greater than one

* Add more tests

* Add documentation on behavior with TapGestureRecognizer and DragGestureRecognizer

* more docs

* more docs

* remove comments

* updates

* fix multiple pointer behavior

* only handle the primary pointer

* Clean up dangerous assumptions in gesture details objects

* forgot from rebase

* update docs

* updates

* Clean up some redundant code

* remove whitespace

* fix tests as a result of #115849

* update test docs

* Fix same test from last commit for material variants

* More clean up of redundant code and update docs

* Clean up didStopTrackingLastPointer and untie TapAndDragGestureRecognizer cancel behavior from TapStatusTrackerMixin.currentUp state

* untie pastTapTolerance

* updates

* Add slopTolerance

* update docs

* Have secondary tap handled by TapGestureRecognizer

* update docs

* fix analyzer and address comments

* Add more docs

* Update cancel behavior tol not call on tap cancel when a drag has been accepted

* Change cancel behavior to only cancel if the tap down callback has been sent and merge tapcancel and dragcancel

* update docs;

* Rename selection_gestures to tap_and_drag_gestures

* Address some reviewer comments

* make deadline and slopTolerance private

* updates

* updates

* Address review comments

* remove _initialButtons

* fix docs

* trackTrap -> trackTap

* fix analyzer

* Add test to verify that tap up is called when recognizer accepts before handleEvent is called

* implement Diagnosticable for Details objects;

* sentTapDown == wonArenaForPrimaryPointer, so the implementation now only uses sentTapDown

* Count user tap up immediately and do not wait to win the arena

* Do not need to call super from TapAndDragGestureRecognizer.acceptGesture anymore because mixin implementation is gone

* Do not start selection drag on Android, iOS, and Fuchshsia touch devices if renderEditable does not have focus, this fixes many scubas

* Address reviewer comments

* fix test

* TapAndDragGestureRecognizer should wait for other recognizer to lose before winning the arena

* Address review comments

* Dont check for drag if the start was already found

* Only check for a drag if it has not already been found"

* fix from rebase

Co-authored-by: Renzo Olivares <roliv@google.com>
2022-12-21 01:01:04 +00:00
Camille Simon
e0742ebb24
[Android] Add spell check suggestions toolbar (#114460)
* Add spell check suggestions toolbar

* Fix test and move menu

* Cleanup

* Cleanup and fix bug

* More cleanup

* Make height dynamic and use localized delete

* Begin adding tests

* Create var checking for results

* Add tests

* Fix analyze (sorta)

* Add back hideToolbar call for testing

* Add back hidetoolbar in ts and delete one in et

* Remove unecessary calls to hidToolbar

* Fix analyze and docs

* Test fix

* Fix container issue

* Clean up

* Fix analyze

* Move delegate

* Fix typos

* Start addressing review

* Continue addressing review

* Add assert

* Some refactoring

* Add test for button behavior

* Undo test change

* Make spell check results public

* Rearrange test

* Add comment

* Address review

* Finish addressing review

* remove unused imports

* Address nits

* Address review

* Fix formatting

* Refactor findsuggestionspanatcursorindex and textselectiontoolbar constraints

* Fix analyze:
2022-12-20 19:56:12 +00:00
Renzo Olivares
3c2f500b1b
Fix edge scrolling on platforms that select word by word on long press move (#113128) 2022-10-24 21:14:54 +00:00
Renzo Olivares
4abe6fdafa
Reland "Single tap on the previous selection should toggle the toolbar on iOS #108913" (#111995) 2022-10-17 20:07:21 +00:00
Justin McCandless
d440ee8224
Consider Scrollable location in text selection drag events (#102992)
Fixes scrolling by dragging a selection when the field is in a Scrollable.
2022-10-05 16:27:48 -07:00
Anthony Oleinik
4ceeca0833
Added example for Magnifier and TextMagnifier (#110218) 2022-09-23 20:29:32 +00:00
godofredoc
61db3bc8c5
Revert "Single tap on the previous selection should toggle the toolbar on iOS…" (#111662) 2022-09-15 16:44:17 +00:00
Justin McCandless
8f9a519519
Fix Magnifier crash (#111303) 2022-09-12 21:57:52 +00:00
Renzo Olivares
fe2fc8daae
Single tap on the previous selection should toggle the toolbar on iOS… (#108913) 2022-08-13 02:06:07 +00:00
Casey Hillers
f878bda18c
Revert "Change ClipboardStatusNofifier parameter in buildToolbar to V… (#109388) 2022-08-11 17:36:06 +00:00
chunhtai
98ce4bf7c6
Change ClipboardStatusNofifier parameter in buildToolbar to ValueLise… (#108917) 2022-08-10 23:26:09 +00:00
Renzo Olivares
4c1d887e9c
Set selection on tap down for desktop platforms and tap up for mobile (#105505)
Co-authored-by: Renzo Olivares <roliv@google.com>
2022-06-29 16:35:47 -07:00
Justin McCandless
baf86869b1
Consistently capitalize Endpoint (not EndPoint) (#106706) 2022-06-28 14:02:39 -07:00
Zachary Anderson
d87b0dde05
Revert "Hide text selection toolbar when dragging handles on mobile (#104274)" (#105247)
This reverts commit 4ec4c249ea5d62d6ef06e6d2e6af48c4500decb2.
2022-06-02 12:37:13 -07:00
Markus Aksli
4ec4c249ea
Hide text selection toolbar when dragging handles on mobile (#104274) 2022-06-02 11:18:12 -07:00
Justin McCandless
b7a425f196
Right click on selection when unfocused should re-focus (#104666)
Bug fix for focusing a field with right click on existing selection (Mac and iOS)
2022-05-27 09:41:03 -07:00
Michael Goderbauer
d5fbc3750e
Remove unused code from tests (#104550) 2022-05-25 09:38:09 -07:00
Tong Mu
23bc3d64eb
[Mouse] Remove all pointers at the end of tests (#102694) 2022-05-19 17:48:10 -07:00
Justin McCandless
715fcaac72
Can't drag the cursor with the mouse (#103002) 2022-05-18 17:32:12 -07:00
Phil Quitslund
bca071815f
rename local functions with _s (#102615) 2022-04-27 09:14:57 -07:00
Justin McCandless
916b2aa76b
Linux and Windows right clicking text behavior (#101588) 2022-04-14 17:44:06 -07:00
Michael Goderbauer
51bcdb9407
super parameters for framework (#100905) 2022-04-13 22:38:40 -07:00
chunhtai
c98cb4a450
Add fadeDuration back to TextSelectionOverlay (#100381)
* Add fadeDuration back to TextSelectionOverlay

* fix build and add dart fix

* format

* add test
2022-03-18 13:05:18 -07:00
chunhtai
f7b9d1ce44
Reland clean up clipboard. (#99363) 2022-03-04 09:51:21 -08:00
chunhtai
64d9ea60b1
Revert "Clean up ClipboardStatusNotifier (#98951)" (#99361)
This reverts commit c74a646b7bba1641d0b2b29f6024dc867844e94c.
2022-03-01 15:13:30 -08:00
chunhtai
c74a646b7b
Clean up ClipboardStatusNotifier (#98951)
* Clean up ClipboardStatusNotifier

* fix

* fix test

* more refactaaaaagit add .
2022-02-23 10:02:20 -08:00
chunhtai
d486aa7040
Refactor TextSelectionOverlay (#98153)
* Refactor TextSelectionOverlay

* fix test

* remove print

* fix more tests

* update

* added tests

* fix comments

* fmt

* fix test

* addressing comment

* remove dispose

* remove new line
2022-02-11 13:06:05 -08:00
chunhtai
d522179be3
Unify Text selection API (#98073)
* Unify Text selection API

* fix test

* further simplify

* fix more tests

* styling change
2022-02-09 09:16:07 -08:00
Justin McCandless
2b21c3e163
Shift tap gesture (#93835) 2021-12-10 14:09:10 -08:00
Tomasz Gucio
33e261c0a2
Update clipboard status on cut (#92167)
Cut now explicitly updates the clipboard status.
2021-11-01 12:18:05 -07:00