build method
Widget
build({
- required Animation<
double> animation, - required Widget child,
- Map<
String, Object?> params = const {},
override
Builds the animated widget for the forward direction.
animation — 0.0 → 1.0 where 0.0 = invisible/start, 1.0 = visible/end.
child — the widget being animated.
params — optional configuration map (typed by each plugin).
Concrete subclasses must override this method.
Implementation
@override
Widget build({
required Animation<double> animation,
required Widget child,
Map<String, Object?> params = const {},
}) {
final from = (params['from'] as double?) ?? 0.0;
final to = (params['to'] as double?) ?? 1.0;
final alignment =
(params['alignment'] as Alignment?) ?? Alignment.center;
// Fast path: 0→1 with center alignment
if (from == 0.0 && to == 1.0 && alignment == Alignment.center) {
return ScaleTransition(scale: animation, child: child);
}
final tween = Tween<double>(begin: from, end: to);
return ScaleTransition(
scale: tween.animate(animation),
alignment: alignment,
child: child,
);
}