ArnaPageTransition constructor

ArnaPageTransition({
  1. Key? key,
  2. required Animation<double> primaryRouteAnimation,
  3. required Animation<double> secondaryRouteAnimation,
  4. required Widget child,
  5. required bool linearTransition,
})

Creates an Arna-styled page transition.

  • primaryRouteAnimation is a linear route animation from 0.0 to 1.0 when this screen is being pushed.
  • secondaryRouteAnimation is a linear route animation from 0.0 to 1.0 when another screen is being pushed on top of this one.
  • linearTransition is whether to perform the transitions linearly. Used to precisely track back gesture drags.

Implementation

ArnaPageTransition({
  super.key,
  required Animation<double> primaryRouteAnimation,
  required Animation<double> secondaryRouteAnimation,
  required this.child,
  required bool linearTransition,
})  : _primaryPositionAnimation = (linearTransition
              ? primaryRouteAnimation
              : CurvedAnimation(
                  parent: primaryRouteAnimation,
                  curve: Curves.linearToEaseOut,
                  reverseCurve: Curves.easeInToLinear,
                ))
          .drive(
        Tween<Offset>(begin: const Offset(1.0, 0.0), end: Offset.zero),
      ),
      _secondaryPositionAnimation = (linearTransition
              ? secondaryRouteAnimation
              : CurvedAnimation(
                  parent: secondaryRouteAnimation,
                  curve: Curves.linearToEaseOut,
                  reverseCurve: Curves.easeInToLinear,
                ))
          .drive(
        Tween<Offset>(
          begin: Offset.zero,
          end: const Offset(-1.0 / 3.0, 0.0),
        ),
      );