getFadeTransaction static method

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

Implementation

static Page<dynamic> getFadeTransaction(LocalKey key, Widget widget) {
  return CustomTransitionPage<void>(
    key: key,
    child: widget,
    barrierDismissible: true,
    barrierColor: Colors.black38,
    opaque: false,
    transitionDuration: const Duration(milliseconds: 1),
    reverseTransitionDuration:
        const Duration(milliseconds: 0), // Kapanış animasyonu yok
    transitionsBuilder: (BuildContext context, Animation<double> animation,
        Animation<double> secondaryAnimation, Widget child) {
      // Açılış animasyonu: opacity artışı (FadeTransition)
      final fadeAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
        CurvedAnimation(
          parent: animation,
          curve: Curves.easeInOut, // Yumuşak geçiş
        ),
      );

      // Sadece FadeTransition uygulanacak
      return FadeTransition(
        opacity: fadeAnimation, // Opacity artışı ile açılış
        child: child,
      );
    },
  );
}