FocusTraversalPolicy classabstract
Determines how focusable widgets are traversed within aFocusTraversalGroup.
The focus traversal policy is what determines which widget is "next","previous", or in a direction from the widget associated with the currentlyfocusedFocusNode (usually aFocus widget).
One of the pre-defined subclasses may be used, or define a custom policy tocreate a unique focus order.
When defining your own, your subclass should implementsortDescendants toprovide the order in which you would like the descendants to be traversed.
See also:
- FocusNode, for a description of the focus system.
- FocusTraversalGroup, a widget that groups together and imposes atraversal policy on theFocus nodes below it in the widget hierarchy.
- FocusNode, which is affected by the traversal policy.
- WidgetOrderTraversalPolicy, a policy that relies on the widgetcreation order to describe the order of traversal.
- ReadingOrderTraversalPolicy, a policy that describes the order as thenatural "reading order" for the currentDirectionality.
- OrderedTraversalPolicy, a policy that describes the orderexplicitly usingFocusTraversalOrder widgets.
- DirectionalFocusTraversalPolicyMixin a mixin class that implementsfocus traversal in a direction.
- Mixed-in types
- Implementers
- Annotations
Constructors
- FocusTraversalPolicy({TraversalRequestFocusCallback?requestFocusCallback})
- Abstract const constructor. This constructor enables subclasses to provideconst constructors so that they can be used in const expressions.const
Properties
- hashCode→int
- The hash code for this object.no setterinherited
- requestFocusCallback→TraversalRequestFocusCallback
- The callback used to move the focus from one focus node to another whentraversing them using a keyboard. By default it requests focus on the nextnode and ensures the node is visible if it's in a scrollable.final
- runtimeType→Type
- A representation of the runtime type of the object.no setterinherited
Methods
- changedScope(
{FocusNode?node,FocusScopeNode?oldScope})→ void - This is called whenever the given
nodeis re-parented into a new scope,so that the policy has a chance to update or invalidate any cached datathat it maintains per scope about the node. - debugFillProperties(
DiagnosticPropertiesBuilderproperties)→ void - Add additional properties associated with the node.inherited
- findFirstFocus(
FocusNodecurrentNode, {boolignoreCurrentFocus =false})→FocusNode? - Returns the node that should receive focus if focus is traversingforwards, and there is no current focus.
- findFirstFocusInDirection(
FocusNodecurrentNode,TraversalDirectiondirection)→FocusNode? - Returns the first node in the given
directionthat should receive focusif there is no current focus in the scope to which thecurrentNodebelongs. - findLastFocus(
FocusNodecurrentNode, {boolignoreCurrentFocus =false})→FocusNode - Returns the node that should receive focus if focus is traversingbackwards, and there is no current focus.
- inDirection(
FocusNodecurrentNode,TraversalDirectiondirection)→bool - Focuses the next widget in the given
directionin the focus scope thatcontains the givencurrentNode. - invalidateScopeData(
FocusScopeNodenode)→ void - Clears the data associated with the givenFocusScopeNode for this object.
- next(
FocusNodecurrentNode)→bool - Focuses the next widget in the focus scope that contains the given
currentNode. - noSuchMethod(
Invocationinvocation)→ dynamic - Invoked when a nonexistent method or property is accessed.inherited
- previous(
FocusNodecurrentNode)→bool - Focuses the previous widget in the focus scope that contains the given
currentNode. - sortDescendants(
Iterable< FocusNode> descendants,FocusNodecurrentNode)→Iterable<FocusNode> - Sorts the given
descendantsinto focus order. - toDiagnosticsNode(
{String?name,DiagnosticsTreeStyle?style})→DiagnosticsNode - Returns a debug representation of the object that is used by debuggingtools and byDiagnosticsNode.toStringDeep.inherited
- toString(
{DiagnosticLevelminLevel =DiagnosticLevel.info})→String - A string representation of this object.inherited
- toStringShort(
)→String - A brief description of this object, usually just theruntimeType and thehashCode.inherited
Operators
- operator ==(
Objectother)→bool - The equality operator.inherited
Static Methods
- defaultTraversalRequestFocusCallback(
FocusNodenode, {ScrollPositionAlignmentPolicy?alignmentPolicy,double?alignment,Duration?duration,Curve?curve})→ void - The default value forrequestFocusCallback.Requests focus from
nodeand ensures the node is visibleby callingScrollable.ensureVisible.