FocusTraversalGroup class

A widget that describes the inherited focus policy for focus traversal for its descendants, grouping them into a separate traversal group.

A traversal group is treated as one entity when sorted by the traversal algorithm, so it can be used to segregate different parts of the widget tree that need to be sorted using different algorithms and/or sort orders when using an OrderedTraversalPolicy.

Within the group, it will use the given policy to order the elements. The group itself will be ordered using the parent group's policy.

By default, traverses in reading order using ReadingOrderTraversalPolicy.

To prevent the members of the group from being focused, set the descendantsAreFocusable attribute to true.

This sample shows three rows of buttons, each grouped by a FocusTraversalGroup, each with different traversal order policies. Use tab traversal to see the order they are traversed in. The first row follows a numerical order, the second follows a lexical order (ordered to traverse right to left), and the third ignores the numerical order assigned to it and traverses in widget order.
To create a local project with this code sample, run:
flutter create --sample=widgets.FocusTraversalGroup.1 mysample

See also:



FocusTraversalGroup({Key key, FocusTraversalPolicy policy, bool descendantsAreFocusable: true, @required Widget child})
Creates a FocusTraversalGroup object. [...]


child Widget
The child widget of this FocusTraversalGroup. [...]
descendantsAreFocusable bool
If false, will make this widget's descendants unfocusable. [...]
hashCode int
The hash code for this object. [...]
@nonVirtual, read-only, inherited
key Key
Controls how one widget replaces another widget in the tree. [...]
final, inherited
policy FocusTraversalPolicy
The policy used to move the focus from one focus node to another when traversing them using a keyboard. [...]
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree. [...]
createState() → _FocusTraversalGroupState
Creates the mutable state for this widget at a given location in the tree. [...]
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children. [...]
@protected, inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toDiagnosticsNode({String name, DiagnosticsTreeStyle style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep. [...]
toString({DiagnosticLevel minLevel:}) String
Returns a string representation of this object.
toStringDeep({String prefixLineOne: '', String prefixOtherLines, DiagnosticLevel minLevel: DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants. [...]
toStringShallow({String joiner: ', ', DiagnosticLevel minLevel: DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object. [...]
toStringShort() String
A short, textual description of this widget.


operator ==(Object other) bool
The equality operator. [...]
@nonVirtual, inherited

Static Methods

of(BuildContext context, {bool nullOk: false}) FocusTraversalPolicy
Returns the focus policy set by the FocusTraversalGroup that most tightly encloses the given BuildContext. [...]