gecko/lib/widgets/commons/fader_transition.dart

28 lines
775 B
Dart
Raw Normal View History

2022-12-10 08:16:38 +01:00
import 'package:flutter/material.dart';
class FaderTransition extends PageRouteBuilder {
final Widget page;
final bool isFast;
FaderTransition({required this.page, required this.isFast})
: super(
pageBuilder: (
BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
) =>
page,
transitionsBuilder: (
BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
Widget child,
) =>
FadeTransition(
opacity:
Tween(begin: 0.0, end: isFast ? 3.0 : 1.0).animate(animation),
child: child,
),
);
2022-12-14 20:00:20 +01:00
}