animateTo method

void animateTo(
  1. int value, {
  2. Duration duration = kTabScrollDuration,
  3. Curve curve = Curves.ease,
})

Immediately sets index and previousIndex and then plays the animation from its current value to index.

Implementation

void animateTo(
  int value, {
  Duration duration = kTabScrollDuration,
  Curve curve = Curves.ease,
}) {
  if (_tabController != null) {
    _tabController!.animateTo(
      value,
      duration: duration,
      curve: curve,
    );
  } else {
    assert(_pageController != null);
    if (duration == Duration.zero) {
      _pageController?.jumpToPage(value);
    } else {
      _pageController?.animateToPage(
        value,
        duration: duration,
        curve: curve,
      );
    }
  }
}