KeyedTabController<K> class

A drop-in replacement to TabController that can also use keys instead of indexes.

Inheritance
Implemented types

Constructors

KeyedTabController({required K? initialKey, required List<K> keys, Duration? animationDuration, required TickerProvider vsync})
KeyedTabController.fromUnanimated({required UnanimatedKeyedTabController<K> controller, Duration? animationDuration, required TickerProvider vsync})
Creates the controller from the given UnanimatedKeyedTabController controller and links the two.

Properties

animation Animation<double>?
An animation whose value represents the current position of the TabBar's selected tab indicator as well as the scrollOffsets of the TabBar and TabBarView.
no setteroverride
animationDuration Duration
Controls the duration of TabController and TabBarView animations.
getter/setter pairoverride-getter
currentKey ↔ K?
The key of the currently selected tab.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
index int
The index of the currently selected tab.
getter/setter pairoverride
indexedController TabController
Returns the internal TabController.
no setter
indexIsChanging bool
True while we're animating from previousIndex to index as a consequence of calling animateTo.
no setteroverride
keys List<K>
Keys of the tabs.
getter/setter pair
length int
The total number of tabs.
no setteroverride
offset double
The difference between the animation's value and index.
getter/setter pairoverride
previousIndex int
The index of the previously selected tab.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
unanimated UnanimatedKeyedTabController<K>?
The linked UnanimatedKeyedTabController, if any.
getter/setter pair

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
animateTo(int value, {Duration? duration, Curve curve = Curves.ease}) → void
Immediately sets index and previousIndex and then plays the animation from its current value to index.
override
animateToKey(K key, {Duration duration = kTabScrollDuration, Curve curve = Curves.ease}) → void
Keyed equivalent to TabController.animateTo.
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
override
mapToList<V>(Map<K, V> map) List<V>
Returns a list picked from map using keys in the keys order.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
override
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
setKeysAndCurrentKey(List<K> keys, K? currentKey) → void
Sets keys and currentKey in one take to only notify listeners once.
toString() String
A string representation of this object.
inherited
updateFromStatic(KeyedStaticTabController<K> staticController) → void
See KeyedStaticTabController.

Operators

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