onPageChanged property
Called when the current page index changes.
The pageNumber parameter is the new page index.
This is the primary callback for reacting to page transitions. See also onPageFlipped which fires at the same point.
Implementation
final void Function(int pageNumber)? onPageChanged;