You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
829 B

// Flutter imports:
import 'package:flutter/material.dart';
class AnimatedScale extends ImplicitlyAnimatedWidget {
final Widget child;
final double scale;
AnimatedScale({this.child, this.scale})
: super(
duration: Duration(milliseconds: 300),
);
@override
ImplicitlyAnimatedWidgetState<ImplicitlyAnimatedWidget> createState() =>
_AnimatedScaleState();
}
class _AnimatedScaleState extends AnimatedWidgetBaseState<AnimatedScale> {
Tween<double> scaleTween;
@override
Widget build(BuildContext context) {
return Transform.scale(
scale: scaleTween.evaluate(animation),
child: widget.child,
);
}
@override
void forEachTween(visitor) {
scaleTween = visitor(
scaleTween,
widget.scale,
(value) => Tween<double>(begin: value),
);
}
}