KeyedTabController<K>.fromUnanimated constructor

KeyedTabController<K>.fromUnanimated({
  1. required UnanimatedKeyedTabController<K> controller,
  2. Duration? animationDuration,
  3. required TickerProvider vsync,
})

Creates the controller from the given UnanimatedKeyedTabController controller and links the two.

Implementation

KeyedTabController.fromUnanimated({
  required UnanimatedKeyedTabController<K> controller,
  Duration? animationDuration,
  required TickerProvider vsync,
})  : _keys = controller.keys,
      _vsync = vsync,
      _unanimated = controller,
      _indexedController = TabController(
        initialIndex: controller.currentKey == null
            ? 0
            : max(controller.keys.indexOf(controller.currentKey as K), 0),
        animationDuration: animationDuration,
        length: controller.keys.length,
        vsync: vsync,
      ) {
  _proxyAnimation.parent = _indexedController.animation;
  _unanimated!.addListener(_onUnanimatedChanged);
  _indexedController.addListener(_onControllerChanged);
}