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.

35 lines
834 B

import 'package:flutter/material.dart';
class AnimatedScale extends ImplicitlyAnimatedWidget {
4 years ago
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> {
4 years ago
Tween<double?>? scaleTween;
@override
Widget build(BuildContext context) {
return Transform.scale(
4 years ago
scale: scaleTween!.evaluate(animation)!,
child: widget.child,
);
}
@override
void forEachTween(visitor) {
scaleTween = visitor(
scaleTween,
widget.scale,
(value) => Tween<double>(begin: value),
4 years ago
) as Tween<double?>?;
}
}