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 rippleColor =
(params['color'] as Color?) ?? const Color(0x44FFFFFF);
final maxScale = (params['maxScale'] as double?) ?? 3.0;
final fadeOut = (params['fadeOut'] as bool?) ?? true;
return AnimatedBuilder(
animation: animation,
builder: (_, c) {
final t = animation.value;
final scale = 1.0 + t * (maxScale - 1.0);
final opacity = fadeOut ? (1.0 - t).clamp(0.0, 1.0) : 1.0;
return Stack(
alignment: Alignment.center,
children: [
c!,
IgnorePointer(
child: Opacity(
opacity: opacity,
child: Transform.scale(
scale: scale,
child: DecoratedBox(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: rippleColor,
),
child: const SizedBox.expand(),
),
),
),
),
],
);
},
child: child,
);
}