currentPageNumber property

int currentPageNumber

Get the current page number by obtaining the page that has the largest area from visiblePages.

If no pages are visible, it returns 1. If the controller is not ready(isReady), the property throws some exception.

Implementation

int get currentPageNumber {
  MapEntry<int, double>? max;
  for (final v in visiblePages.entries) {
    if (max == null || max.value < v.value) {
      max = v;
    }
  }
  return max?.key ?? 1;
}