FocusVisibility class abstract final

Whether focused widgets should show a focus indicator.

A pointer press hides the indicator until the next keyboard input. Lone modifier and lock keys do not count, nor do Control, Meta, Super, or Hyper shortcuts, nor Alt shortcuts outside macOS. Key repeat does. Focus moved in code keeps the current visibility.

This follows the pointer and keyboard part of CSS :focus-visible. It does not copy the text-input exception: a text field focused by a pointer does not show an indicator. Style any focus, including that case, with onFocused.

FocusHighlightStrategy.alwaysTraditional always shows indicators, and FocusHighlightStrategy.alwaysTouch never does. A FocusHighlightStrategy change that leaves FocusManager.highlightMode unchanged applies on the next rebuild.

Tracking starts on first use. Call ensureInitialized at startup when a pointer press can happen before the first Mix widget builds.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

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

Static Properties

isVisible → bool
Whether a focused widget should currently show its focus indicator.
no setter

Static Methods

ensureInitialized() → void
Starts pointer and keyboard tracking now instead of on first use.
of(BuildContext context) → bool
Returns isVisible, rebuilding context when it changes inside a FocusVisibilityScope.