animateToPage method

Future<void> animateToPage(
  1. int page, {
  2. required Duration duration,
  3. required Curve curve,
})

Animates the controlled VxSwiper from the current page to the given page.

The animation lasts for the given duration and follows the given curve. The returned Future resolves when the animation completes.

Implementation

Future<void> animateToPage(int page,
    {required Duration duration, required Curve curve}) {
  final index = _getRealIndex(
      pageController.page!.toInt(), realPage - initialPage as int, itemCount);
  return pageController.animateToPage(
      pageController.page!.toInt() + page - index,
      duration: duration,
      curve: curve);
}