FocusScope class

A boundary for focus memory and optional focus trapping.

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.

Inheritance
Available extensions

Constructors

FocusScope({Key? key, bool trapFocus = false, required Widget child})
const

Properties

child → Widget
The subtree that shares this focus scope.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
trapFocus → bool
Whether focus must stay inside this scope.
final

Methods

animate({Duration? duration, Curve? curve, Object? trigger, bool repeat = false}) → Animate

Available on Widget, provided by the AnimateExtension extension

Starts an Animate chain over this widget. duration / curve apply to the whole chain. With no trigger it plays on mount; with a non-null trigger it rests on mount and replays whenever the token changes.
build(BuildContext context) → Widget
Describes the part of the user interface represented by this widget.
override
createElement() → StatelessElement
Creates the Element that will mount this widget into the tree.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited