FocusScope
A boundary for focus memory and optional focus trapping.
Learn more: Focus management
Import: package:fleury/fleury.dart, or package:fleury/fleury_core.dart in browser code.
// Keep focus inside a custom overlay: Tab, clicks, and focus requests// can't move it out.FocusScope( trapFocus: true, // Stop unmatched keys from reaching the app behind it too. child: KeyBindings(modal: true, bindings: const [], child: child),)Details
Section titled “Details”Every scope remembers its most recently focused descendant. With
trapFocus enabled, programmatic focus, pointer focus, and traversal are
confined to this subtree. Key events may still propagate to ancestors; use
KeyBindings(modal: true) when unmatched keys must also stop here.
Navigator routes install their own scope and traversal policy. Presented
dialogs enable trapFocus and a key-binding boundary automatically.
Constructors
Section titled “Constructors”FocusScope()
Section titled “FocusScope()”| Parameter | Type | Default | Description |
|---|---|---|---|
trapFocus: | bool | false | Whether focus must stay inside this scope. More |
child: | Widget | required | The subtree that shares this focus scope. |
trapFocus: When true, Tab and arrow traversal, pointer focus, and directFocusNode.requestFocuscalls cannot move focus outside this subtree. This does not stop key events from propagating to ancestor handlers.
Source
Section titled “Source”FocusScope is defined in packages/fleury/lib/src/widgets/focus.dart.
Category: Input handling & focus · All widgets