Update key examples to use Focus widgets instead of RawKeyboardListener#101537
Merged
gspencergoog merged 3 commits intoflutter:masterfrom Apr 8, 2022
Merged
Update key examples to use Focus widgets instead of RawKeyboardListener#101537gspencergoog merged 3 commits intoflutter:masterfrom
Focus widgets instead of RawKeyboardListener#101537gspencergoog merged 3 commits intoflutter:masterfrom
Conversation
dkwingsmt
reviewed
Apr 7, 2022
Contributor
dkwingsmt
left a comment
There was a problem hiding this comment.
A few comments, see if you'd like to address.
| /// keyboard events. | ||
| /// * [Focus.onKey], the handler on a widget that lets you handle key events. | ||
| /// * [RawKeyboardListener], a widget used to listen to keyboard events (but | ||
| /// not handle them). |
Contributor
There was a problem hiding this comment.
Suggested change
| /// not handle them). | |
| /// can not affect how the event are handled by other widgets). |
| await tester.tap(find.text('Click to focus')); | ||
| await tester.pumpAndSettle(); | ||
| expect(find.text('Press a key'), findsOneWidget); | ||
| // Yes, this is a physical keyboard key test, but we don't have a way to |
Contributor
There was a problem hiding this comment.
We actually do. The global simulateKeyUpEvent supports a physicalKey named parameter, which is not exposed by tester.sendKeyEvent (and probably should.)
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Apr 8, 2022
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/plugins
that referenced
this pull request
Apr 9, 2022
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.
Description
This updates the examples for
PhysicalKeyboardKeyandLogicalKeyboardKeyto useFocuswidgets that handle the keys instead of usingRawKeyboardListener, since that usually leads people down the wrong path. Updated the See Also and added tests as well.Related Issues
Tests