FocusNode
A long-lived focus identity. One per Focus widget; consumers can
also create their own and pass it into a Focus to keep focus
state stable across reparenting.
Learn more: Focus management
Import: package:fleury/fleury.dart, or package:fleury/fleury_core.dart in browser code.
class _WorkspaceState extends State<Workspace> { final _searchFocus = FocusNode(debugLabel: 'search');
void focusSearch() => _searchFocus.requestFocus();
@override Widget build(BuildContext context) => Row( children: [ Button(text: 'Focus search', onPressed: focusSearch), SizedBox( width: 24, child: TextInput(focusNode: _searchFocus, onChanged: search), ), ], );
@override void dispose() { _searchFocus.dispose(); super.dispose(); }}Details
Section titled “Details”A node notifies its listeners when hasFocus flips. A control that shows
a focus cue listens to its own node — context.listen(node) in build —
so a focus move rebuilds the two controls it concerns, not every control
that depends on the FocusManager.
Constructors
Section titled “Constructors”FocusNode()
Section titled “FocusNode()”| Parameter | Type | Default | Description |
|---|---|---|---|
canRequestFocus: | bool | true | Whether this node can receive focus through traversal, pointer input, or requestFocus. |
skipTraversal: | bool | false | Whether Tab and arrow traversal should skip this node while explicit requestFocus and pointer focus remain available. |
debugLabel: | String? | — | Optional human-readable label. Only surfaces in toString. |
Source
Section titled “Source”FocusNode is defined in packages/fleury/lib/src/widgets/focus.dart.
Category: Input handling & focus · All widgets