withSlide method
Wrap with slide animation on appear.
Implementation
Widget withSlide({
Offset begin = const Offset(0, 0.2),
Offset end = Offset.zero,
Duration duration = const Duration(milliseconds: 300),
Curve curve = Curves.easeOutCubic,
}) {
return TweenAnimationBuilder<Offset>(
tween: Tween(begin: begin, end: end),
duration: duration,
curve: curve,
builder: (context, offset, child) => Transform.translate(
offset: Offset(
offset.dx * 100, // Convert to pixels
offset.dy * 100,
),
child: child,
),
child: this,
);
}