Line data Source code
1 : import 'package:flutter/material.dart'; 2 : 3 : class AnimatedScaleWidget extends AnimatedWidget { 4 : final AnimationController animationController; 5 : final Tween<double> scale; 6 : final Curve curve; 7 : final Widget widget; 8 : 9 2 : AnimatedScaleWidget({ 10 : Key key, 11 : @required this.animationController, 12 : @required this.widget, 13 : this.curve = Curves.ease, 14 : this.scale, 15 2 : }) : super(key: key, listenable: animationController); 16 : 17 2 : @override 18 : Widget build(BuildContext context) { 19 2 : return ScaleTransition( 20 6 : scale: ((scale?.begin != null && scale?.end != null) ? scale : Tween<double>(begin: 0.0, end: 1.0)).animate( 21 2 : CurvedAnimation( 22 2 : parent: animationController, 23 : curve: Curves.ease, 24 : ), 25 : ), 26 2 : child: widget, 27 : ); 28 : } 29 : }