animateScroll method

Future<void> animateScroll(
  1. int page
)

Implementation

Future<void> animateScroll(int page) async {
  bool isValidToProgress = widget.canProgress(getCurrentPage());
  if (isValidToProgress) {
    _isScrolling = true;
    await _pageController.animateToPage(
      max(min(page, getPagesLength() - 1), 0),
      duration: Duration(milliseconds: widget.animationDuration),
      curve: widget.curve,
    );
    if (mounted) {
      _isScrolling = false;
    }
  }
}