animateToPage method

  1. @override
Future<void> animateToPage(
  1. int page, {
  2. Duration duration = const Duration(milliseconds: 400),
  3. Curve curve = Curves.linear,
})
override

Animates the controlled PageView 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

@override
Future<void> animateToPage(
  int page, {
  Duration duration = const Duration(milliseconds: 400),
  Curve curve = Curves.linear,
}) async {
  final future = super.animateToPage(page, duration: duration, curve: curve);

  for (final indicator in _indicators) {
    indicator.onAnimateToPage(page, future);
  }
}