onKeyEvent property

FocusOnKeyEventCallback? onKeyEvent
getter/setter pair

Called if this focus node receives a key event while focused (i.e. when hasFocus returns true).

Key Event Propagation

The FocusManager receives key events from HardwareKeyboard and will pass them to the focused nodes. It starts with the node with the primary focus, and will call the onKeyEvent callback for that node. If the callback returns KeyEventResult.ignored, indicating that it did not handle the event, the FocusManager will move to the parent of that node and call its onKeyEvent. If that onKeyEvent returns KeyEventResult.handled, then it will stop propagating the event. If it reaches the root FocusScopeNode, FocusManager.rootScope, the event is discarded.


FocusOnKeyEventCallback? onKeyEvent;