onFocusChange property

TabValueChanged<bool>? onFocusChange
final

An optional callback that's called when a Tab's focus state in the TabBar changes.

Called when the node fo the Tab at index gains or loses focus.

The value passed to the callback is true if the node has gained focus for the Tab at index and false if focus has been lost.

When focus is moved from one tab directly to another, this will be called twice. First to represent focus being lost by the initially focused tab, and then second for the next tab gaining focus.

This sample shows how to customize a Tab based on focus traversal in enclosing TabBar.
link

To create a local project with this code sample, run:
flutter create --sample=material.TabBar.onFocusChange.1 mysample

Implementation

final TabValueChanged<bool>? onFocusChange;