goToPage method

dynamic goToPage(
  1. int index, {
  2. bool? animated = true,
  3. bool? dontUpdateHistoryTabSelected,
  4. bool? hideBottomNavigationBar,
})

Implementation

goToPage(
  int index, {
  bool? animated = true,
  bool? dontUpdateHistoryTabSelected,
  bool? hideBottomNavigationBar,
}) {
  if (dontUpdateHistoryTabSelected == false ||
      dontUpdateHistoryTabSelected == null) {
    pageHistoryTabSelected.add(index);
  }
  _currentPageIndex = index;
  if (index < initialPages.length &&
      (dontUpdateHistoryTabSelected == null ||
          dontUpdateHistoryTabSelected == false)) {
    this.currentBottomIndex = index;
  }
  pageHistory.add(index);
  if (hideBottomNavigationBar != null) {
    if (hideBottomNavigationBar == true) {
      this._hideBottomNavigationBar = true;
    } else {
      this._hideBottomNavigationBar = false;
    }
  }
  // if (animated == true) {
  //   _animateToPage(index);
  // } else {
  //   _pageViewController!.jumpToPage(index);
  // }
  _pageViewController!.jumpToPage(index);
  this
      ._onBottomNavigationBarChanged
      .forEach((func) => func(this.currentBottomIndex));
  this._onPageChangedListeners.forEach((func) => func(index));
  this._onListener.forEach((func) => func());
}