how to use the animate to method in flutter code example

Example: Animation Flutter

class _WelcomeScreenState extends State<WelcomeScreen>
  with SingleTickerProviderStateMixin {
  AnimationController controller;
  Animation animation;

  @override
  void initState() {
  super.initState();
  controller = AnimationController(
  duration: Duration(seconds: 1),
  vsync: this,
  );

  animation = ColorTween(begin: Colors.blueGrey, end: Colors.white)
      .animate(controller);

  controller.forward();

  controller.addListener(() {
  setState(() {});
  print(animation.value);
  });
  }

Tags:

Misc Example