flutter animate a widget code example

Example: Animation Flutter

class _WelcomeScreenState extends State
  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