43 lines
1003 B
Dart
43 lines
1003 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class FadePageTransitionsBuilder extends PageTransitionsBuilder {
|
|
|
|
const FadePageTransitionsBuilder();
|
|
|
|
@override
|
|
Widget buildTransitions<T>(
|
|
PageRoute<T>? route,
|
|
BuildContext? context,
|
|
Animation<double> animation,
|
|
Animation<double> secondaryAnimation,
|
|
Widget child,
|
|
) {
|
|
return _FadePagePageTransition(
|
|
animation: animation,
|
|
secondaryAnimation: secondaryAnimation,
|
|
child: child,
|
|
);
|
|
}
|
|
}
|
|
|
|
class _FadePagePageTransition extends StatelessWidget {
|
|
|
|
const _FadePagePageTransition({
|
|
required this.animation,
|
|
required this.secondaryAnimation,
|
|
required this.child,
|
|
});
|
|
|
|
final Animation<double> animation;
|
|
final Animation<double> secondaryAnimation;
|
|
final Widget child;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
var curveTween = CurveTween(curve: Curves.easeIn);
|
|
return FadeTransition(
|
|
opacity: animation.drive(curveTween),
|
|
child: child,
|
|
);
|
|
}
|
|
} |