navigator static method

dynamic navigator(
  1. String _route, {
  2. dynamic arguments,
})

Implementation

static navigator(String _route, {arguments}) {
  switch (_route) {
    case DesktopRoutes.DESKTOP_GROUP_RIGHT_INITIAL:
      return () {
        Navigator.of(NavService.groupPckgRightHalfNavKey.currentContext!)
            .pushNamed(DesktopRoutes.DESKTOP_GROUP_RIGHT_INITIAL);
      };
    case DesktopRoutes.DESKTOP_GROUP_LIST:
      return () {
        Navigator.of(NavService.groupPckgLeftHalfNavKey.currentContext!)
            .pushReplacementNamed(DesktopRoutes.DESKTOP_GROUP_LIST,
                arguments: {
              ...arguments,
              'onDone': navigator(DesktopRoutes.DESKTOP_GROUP_RIGHT_INITIAL),
            });
      };
    case DesktopRoutes.DESKTOP_GROUP_DETAIL:
      return () {
        Navigator.of(NavService.groupPckgRightHalfNavKey.currentContext!)
            .pushReplacementNamed(DesktopRoutes.DESKTOP_GROUP_DETAIL,
                arguments: arguments);
      };

    case DesktopRoutes.DESKTOP_NEW_GROUP:
      return () {
        Navigator.of(NavService.groupPckgRightHalfNavKey.currentContext!)
            .pushNamed(DesktopRoutes.DESKTOP_NEW_GROUP, arguments: {
          'onPop': () {
            Navigator.of(NavService.groupPckgRightHalfNavKey.currentContext!)
                .pop();
          },
          'onDone': () {
            Navigator.of(NavService.groupPckgLeftHalfNavKey.currentContext!)
                .pushReplacementNamed(DesktopRoutes.DESKTOP_GROUP_LIST,
                    arguments: {
                  'onDone':
                      navigator(DesktopRoutes.DESKTOP_GROUP_RIGHT_INITIAL),
                });
            Navigator.of(NavService.groupPckgRightHalfNavKey.currentContext!)
                .pushReplacementNamed(DesktopRoutes.DESKTOP_GROUP_DETAIL,
                    arguments: arguments);
          }
        });
      };
  }
}