* Revert "Remove references to BindingBase.window (#122119)"
This reverts commit c7681f00cf1fb1c63bebb27d715f29feb77b78b7.
* Revert "Remove another reference to BindingBase.window (#122341)"
This reverts commit 6ec444506375cfa94535a45c2320e01094c295e0.
* Revert "Reland (2): Removes single window assumptions from `flutter_test` (#122233)"
This reverts commit eb3d317ea06e59fadc379210f5c6e685505d8e0f.
* Revert "Remove single view assumption from TestViewConfiguration (#122352)"
This reverts commit 927289fb4e5b25a71f794bc808a8c31554859a50.
* Revert "Updates `flutter/test/cupertino` to no longer use `TestWindow` (#122325)"
This reverts commit 67e17e45f05271c6c409183c1d33806683cb9e4d.
* Revert "Updates `flutter/test/gestures` to no longer reference `TestWindow` (#122327)"
This reverts commit c2a5111cc0f9bcb104982b38a1a0a9c4210b601f.
* Revert "Updates `flutter/test/rendering` to no longer use `TestWindow` (#122347)"
This reverts commit 28b65e089b3f8e8c21572cd8a73184858b6360c3.
* Revert "Updates `flutter_localizations/test` to stop using `TestWindow` (#122321)"
This reverts commit 01367d52d7886f51a8921c9dc4a8e4c541686e98.
* Use `curly_braces_in_flow_control_structures` for `packages/flutter_driver`
* Use `curly_braces_in_flow_control_structures` for `packages/flutter_goldens`
* Use `curly_braces_in_flow_control_structures` for `packages/flutter_goldens_client`
* Use `curly_braces_in_flow_control_structures` for `packages/flutter_localizations`
* Use `curly_braces_in_flow_control_structures` for `packages/flutter_test`
* Use `curly_braces_in_flow_control_structures` for `packages/flutter_web_plugins`
* fix comments
* Use `curly_braces_in_flow_control_structures` for `packages/integration_test`
* fix indentation
This updates the examples for PhysicalKeyboardKey and LogicalKeyboardKey to use Focus widgets that handle the keys instead of using RawKeyboardListener, since that usually leads people down the wrong path. Updated the See Also and added tests as well. Also exposed the `physicalKey` attribute for `tester.sendKeyEvent`.
This PR introduced a new class, ShortcutActivator, and refactored the the definition and lookup system of shortcuts, in order to solve a few issues of the previous algorithm.
- - When I added notification of key events before processing them as text, it made it so that shortcut key bindings like the spacebar would prevent spaces from being inserted into text fields, which is obviously not desirable (and so that change was reverted). At the same time, we do want to make it possible to override key events so that they can do things like intercept a tab key or arrow keys that change the focus.
This PR changes the behavior of the Shortcuts widget so that if it has a shortcut defined, but no action is bound to the intent, then instead of responding that the key is "handled", it responds as if nothing handled it. This allows the engine to continue to process the key as text entry.
This PR includes:
- Modification of the callback type for key handlers to return a KeyEventResult instead of a bool, so that we can return more information (i.e. the extra state of "stop propagation").
- Modification of the ActionDispatcher.invokeAction contract to require that Action.isEnabled return true before calling it. It will now assert if the action isn't enabled when invokeAction is called. This is to allow optimization of the number of calls to isEnabled, since the shortcuts widget now wants to know if the action was enabled before deciding to either handle the key or to return ignored.
- Modification to ShortcutManager.handleKeypress to return KeyEventResult.ignored for keys which don't have an enabled action associated with them.
- Adds an attribute to DoNothingAction that allows it to mark a key as not handled, even though it does have an action associated with it. This will allow disabling of a shortcut for a subtree.