getTransition method

Widget getTransition(
  1. BuildContext context,
  2. Animation<double> animation,
  3. Animation<double> secondaryAnimation,
  4. Widget child,
)

Implementation

Widget getTransition(
  BuildContext context,
  Animation<double> animation,
  Animation<double> secondaryAnimation,
  Widget child,
) {
  return switch (this) {
    PageFadeTransition _ => FadeTransition(
        opacity: animation,
        child: child,
      ),
    PageFadeScaleTransition _ => FadeScaleTransition(
        animation: animation,
        child: child,
      ),
    PageFadeThroughTransition transition => FadeThroughTransition(
        animation: animation,
        secondaryAnimation: secondaryAnimation,
        fillColor: transition.fillColor,
        child: child,
      ),
    PageSlideTransition _ => SlideTransition(
        position: Tween<Offset>(
          begin: const Offset(0, 1),
          end: Offset.zero,
        ).animate(animation),
        child: child,
      ),
    PageSharedAxisTransition transition => SharedAxisTransition(
        animation: animation,
        secondaryAnimation: secondaryAnimation,
        transitionType: transition.type,
        fillColor: transition.fillColor,
        child: child,
      ),
  };
}