getDefaultTransaction static method

Page getDefaultTransaction(
  1. LocalKey key,
  2. Widget widget
)

Implementation

static Page<dynamic> getDefaultTransaction(LocalKey key, Widget widget) {
  return CustomTransitionPage<void>(
    key: key,
    child: Builder(
      // BuildContext'i almak için Builder kullanıyoruz
      builder: (context) => GestureDetector(
        onHorizontalDragEnd: (DragEndDetails details) {
          if (details.localPosition.dx > 200) {
            return;
          }
          Navigator.of(context).pop();
        },
        child: widget,
      ),
    ),
    barrierDismissible: false,
    barrierColor: Colors.black45,
    opaque: false,
    transitionDuration: const Duration(milliseconds: 700),
    reverseTransitionDuration: const Duration(milliseconds: 400),
    transitionsBuilder: (BuildContext context, Animation<double> animation,
        Animation<double> secondaryAnimation, Widget child) {
      final reverseAnimation = Tween<double>(begin: 1.0, end: 1.2).animate(
        CurvedAnimation(
          parent: secondaryAnimation,
          curve: Curves.easeOutQuart,
        ),
      );

      final slideAnimation = Tween<Offset>(
        begin: const Offset(1.0, 0.0),
        end: Offset.zero,
      ).animate(
        CurvedAnimation(
          parent: animation,
          curve: Curves.easeOutCirc,
          reverseCurve: Curves.easeIn,
        ),
      );

      return SlideTransition(
        position: slideAnimation,
        child: ScaleTransition(
          scale: reverseAnimation,
          child: child,
        ),
      );
    },
  );
}