setBoxAnimation static method
Animation<Offset> ?
setBoxAnimation({
- required SlideStyle slideStyle,
- required AnimationController animationController,
- required Tween<
Offset> ? slideTweenOffset, - required Curve slideCurve,
Implementation
static Animation<Offset>? setBoxAnimation({
required SlideStyle slideStyle,
required AnimationController animationController,
required Tween<Offset>? slideTweenOffset,
required Curve slideCurve,
}) {
// Tween offsets appropriate to [SlideAnimationStyle].
final slideAnimationValues = <SlideStyle, Tween<Offset>>{
SlideStyle.RTL: Tween<Offset>(begin: Offset(5, 0), end: Offset.zero),
SlideStyle.LTR: Tween<Offset>(begin: Offset(-5, 0), end: Offset.zero),
SlideStyle.BTU: Tween<Offset>(begin: Offset(0, 5), end: Offset.zero),
SlideStyle.UTD: Tween<Offset>(begin: Offset(0, -5), end: Offset.zero),
};
late Tween<Offset> _offsetTween;
if (slideTweenOffset != null) {
_offsetTween = slideTweenOffset;
} else {
_offsetTween = slideAnimationValues[slideStyle]!;
}
return _offsetTween.animate(CurvedAnimation(
parent: animationController,
curve: slideCurve,
));
}