onFocus property

VoidCallback? onFocus

The handler for SemanticsAction.focus.

This handler is invoked when the assistive technology requests that the focusable widget corresponding to this semantics node gain input focus. The FocusNode that manages the focus of the widget must gain focus. The widget must begin responding to relevant key events. For example:

  • Buttons must respond to tap/click events produced via keyboard shortcuts.
  • Text fields must become focused and editable, showing an on-screen keyboard, if necessary.
  • Checkboxes, switches, and radio buttons must become togglable using keyboard shortcuts.

Focus behavior is specific to the platform and to the assistive technology used. See the documentation of SemanticsAction.focus for more detail.

See also:

Implementation

VoidCallback? get onFocus => _onFocus;
void onFocus=(VoidCallback? value)

Implementation

set onFocus(VoidCallback? value) {
  _addArgumentlessAction(SemanticsAction.focus, value!);
  _onFocus = value;
}