nextPage method

Future<void> nextPage({
  1. Duration? duration = const Duration(milliseconds: 300),
  2. Curve? curve = Curves.linear,
})

Animates the controlled CarouselSlider to the next page.

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

Implementation

Future<void> nextPage({Duration? duration = const Duration(milliseconds: 300), Curve? curve = Curves.linear}) async {
  final bool isNeedResetTimer = _state!.options.pauseAutoPlayOnManualNavigate;
  if (isNeedResetTimer) {
    _state!.onResetTimer();
  }
  _setModeController();
  await _state!.pageController!.nextPage(duration: duration!, curve: curve!);
  if (isNeedResetTimer) {
    _state!.onResumeTimer();
  }
}