jumpToPage method

  1. @override
void jumpToPage(
  1. int page
)
override

Changes which page is displayed in the controlled CarouselSlider.

Jumps the page position from its current value to the given value, without animation, and without checking if the new value is in range.

Implementation

@override
void jumpToPage(int page) {
  final index = getRealIndex(_state!.pageController!.page!.toInt(), _state!.realPage - _state!.initialPage, _state!.itemCount);

  _setModeController();
  final int pageToJump = _state!.pageController!.page!.toInt() + page - index;
  return _state!.pageController!.jumpToPage(pageToJump);
}