setNewRoute method

dynamic setNewRoute(
  1. PanelKitPage page
)

Implementation

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

  Navigator.push(
    navigatorKey.currentContext!,
    PageRouteBuilder(
      pageBuilder: (context, animation, secondaryAnimation) => _pages.last,
      transitionsBuilder: (context, animation, secondaryAnimation, child) {
        return child;
      },
    ),
  );
  // }
}