buildDefaultTransition method
Builds a simple transition where a child screen is faded and scaled in with a colored scrim.
The color of the scrim is defined by settings.scrimColor
.
Implementation
Widget buildDefaultTransition() {
// Controls the color of the scrim, from fully transparent to
// [settings.scrimColor].
final Animation<Color?> scrimAnimation = ColorTween(
begin: settings.scrimColor.withOpacity(0.0),
end: settings.scrimColor,
).animate(CurvedAnimation(
parent: animation,
curve: Curves.fastOutSlowIn,
));
// Controls the scale of the child screen.
final Animation<double> scaleChildAnimation = Tween<double>(
begin: 0.9,
end: 1.0,
).animate(CurvedAnimation(
parent: animation,
curve: Curves.fastOutSlowIn,
));
// Controls the opacity of the child screen.
final Animation<double> fadeInAnimation = Tween<double>(
begin: 0.0,
end: 1.0,
).animate(CurvedAnimation(
parent: animation,
curve: Curves.fastOutSlowIn,
));
return Container(
color: scrimAnimation.value,
child: FadeTransition(
opacity: fadeInAnimation,
child: ScaleTransition(
scale: scaleChildAnimation,
child: child,
),
),
);
}