navigate static method

void navigate(
  1. BuildContext context,
  2. Widget page, {
  3. Widget? current,
  4. bool? route,
})

Implementation

static void navigate(BuildContext context, Widget page,
    {Widget? current, bool? route}) {
  final p = PageTransition(
      type: current is Widget
          ? PageTransitionType.leftToRightJoined
          : PageTransitionType.leftToRight,
      duration: const Duration(milliseconds: 400),
      alignment: Alignment.bottomCenter,
      childCurrent: current,
      curve: Curves.easeInOutQuart,
      child: page);
  if (route is bool) {
    Navigator.pushAndRemoveUntil(context, p, (route) => !route.isFirst);
  } else {
    Navigator.push(context, p);
  }
}