• Greg Spencer's avatar
    Add key event handlers that happen before or after the focus traversal (#136280) · 7e1d366a
    Greg Spencer authored
    ## Description
    
    This adds a mechanism for listening to key events before or after focus traversal occurs.
    
    It adds four methods to the public `FocusManager` API:
    
    - `addEarlyKeyEventHandler` - Adds a handler that can handle events before they are given to the focus tree for handling.
    - `removeEarlyKeyEventHandler` - Removes an early event handler.
    - `addLateKeyEventHandler` - Adds a handler that can handle events if they have not been handled by anything in the focus tree.
    - `removeLateKeyEventHandler` - Removes a late event handler.
    
    This allows an app to get notified for a key anywhere, and prevent the focus tree from seeing that event if it handles it.
    
    For the menu system, this allows it to eat an escape key press and close all the open menus.
    
    ## Related Issues
     - https://github.com/flutter/flutter/issues/135334
    
    ## Tests
     - Added tests for new functionality.
    7e1d366a
Name
Last commit
Last update
.github Loading commit data...
.vscode Loading commit data...
bin Loading commit data...
dev Loading commit data...
examples Loading commit data...
packages Loading commit data...
.ci.yaml Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CODEOWNERS Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
CONTRIBUTING.md Loading commit data...
LICENSE Loading commit data...
PATENT_GRANT Loading commit data...
README.md Loading commit data...
TESTOWNERS Loading commit data...
analysis_options.yaml Loading commit data...
dartdoc_options.yaml Loading commit data...
flutter_console.bat Loading commit data...