getRouteTransitionsBuilder method

RouteTransitionsBuilder? getRouteTransitionsBuilder(
  1. String? value
)

Implementation

RouteTransitionsBuilder? getRouteTransitionsBuilder(String? value) {
  if (value == null || value.isEmpty) {
    return null;
  }

  return (context, animation, secondaryAnimation, child) {
    switch (value) {
      case "fade":
        return FadeTransition(opacity: animation, child: child);
      case "scale":
        return ScaleTransition(scale: animation, child: child);
      case "size":
        return SizeTransition(sizeFactor: animation, child: child);
      case "slideUp":
        return SlideTransition(
          position: animation
              .drive(Tween(begin: const Offset(0.0, 1.0), end: Offset.zero)),
          child: child,
        );
      case "slideLeft":
        return SlideTransition(
          position: animation
              .drive(Tween(begin: const Offset(1.0, 0.0), end: Offset.zero)),
          child: child,
        );
      case "slideRight":
        return SlideTransition(
          position: animation
              .drive(Tween(begin: const Offset(-1.0, 0.0), end: Offset.zero)),
          child: child,
        );
      default:
        return child;
    }
  };
}