flutter/dev/manual_tests/lib
Greg Spencer 8c03ff8c1d
Mark keys that match a shortcut, but have no action defined as "not handled". (#67359)
- - 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.
2020-10-19 11:26:50 -07:00
..
actions.dart Mark keys that match a shortcut, but have no action defined as "not handled". (#67359) 2020-10-19 11:26:50 -07:00
animated_icons.dart Add Linux and Windows target platforms (#51519) 2020-03-03 04:38:04 -08:00
card_collection.dart Migrate TextTheme to 2018 APIs (#48547) 2020-01-24 19:03:01 -08:00
color_testing_demo.dart License update (#45373) 2019-11-27 15:04:02 -08:00
density.dart Remove unused 'dart:async' imports. (#65568) 2020-09-16 14:14:06 -07:00
drag_and_drop.dart Add Linux and Windows target platforms (#51519) 2020-03-03 04:38:04 -08:00
focus.dart Mark keys that match a shortcut, but have no action defined as "not handled". (#67359) 2020-10-19 11:26:50 -07:00
hover.dart Removed old button widget references from dev/manual_tests (#62816) 2020-08-05 14:51:27 -07:00
main.dart Add Linux and Windows target platforms (#51519) 2020-03-03 04:38:04 -08:00
material_arc.dart Remove unused 'dart:async' imports. (#65568) 2020-09-16 14:14:06 -07:00
overlay_geometry.dart Add Linux and Windows target platforms (#51519) 2020-03-03 04:38:04 -08:00
page_view.dart Add Linux and Windows target platforms (#51519) 2020-03-03 04:38:04 -08:00
raw_keyboard.dart Mark keys that match a shortcut, but have no action defined as "not handled". (#67359) 2020-10-19 11:26:50 -07:00
text.dart Removed old button widget references from dev/manual_tests (#62816) 2020-08-05 14:51:27 -07:00