setNewRoute method

dynamic setNewRoute(
  1. BasePanelyContentPage page
)

Implementation

setNewRoute(BasePanelyContentPage page) {
  if (_pages.length > 1) {
    Navigator.popUntil(navigatorKey.currentContext!, ModalRoute.withName(_pages.first.routeId));
  }
  _pages.clear();
  _pages.add(page);

  Navigator.pushAndRemoveUntil(
      navigatorKey.currentContext!,
      PageRouteBuilder(
        pageBuilder: (context, animation1, animation2) => _pages.last,
        transitionDuration: Duration.zero, // No transition effect
        reverseTransitionDuration: Duration.zero, // No reverse transition effect
      ),
      (route) => false);
}