animateToPage method
navigate to another page
Implementation
Future<void> animateToPage(
int page, {
required Duration duration,
required Curve curve,
}) {
//find the nearest value greater/little than realIndex
int offset = page - this.page;
if (offset == 0) {
return new Future<void>.value(null);
}
int destPage = offset + realIndex!;
return pageController.animateToPage(destPage,
duration: duration, curve: curve);
}