focusNode property
Optional focus node for the search text field.
Providing a FocusNode gives you full programmatic control over when the search keyboard appears and disappears — independently of autoFocusOnExpand. Typical use-cases:
- Call
focusNode.requestFocus()to open the keyboard at an arbitrary moment (e.g. after an animation completes or a voice-search result arrives). - Call
focusNode.unfocus()to dismiss the keyboard without collapsing the search bar. - Listen to
focusNode.addListener(...)for focus events in addition to or instead of onSearchFocusChanged.
Lifecycle: the caller is responsible for disposing the node. The widget will never dispose a caller-provided FocusNode.
If null, an internal node is created and disposed automatically.
Implementation
final FocusNode? focusNode;