Why is Animation Tween always running from 0.0 to 1.0?


I want to make an animation in flutter using

  late AnimationController controller1;
  late Animation<double> animation1;

  void initState() {

   controller1 = AnimationController(
      duration: const Duration(milliseconds: 700),
      vsync: this,
    animation1 = Tween(begin: 50.0, end: 0.0).animate(controller1)
      ..addListener(() {
        setState(() {});


No matter which values I put in as "begin" and "end" – the


always goes from 0.0 to 1.0. What is my mistake here?



I think you want to use the animation1.value, not the controller1.value and you can verify it using the following code 🙂 :

 void initState() {
  controller =
      AnimationController(duration: const Duration(seconds: 2), vsync: this);

  animation = Tween<double>(begin: 50.0, end: 0.0).animate(controller)
    ..addListener(() {
      // #enddocregion addListener
      setState(() {
        print("Animation value: ${animation.value}");

        //TODO: you can uncomment this print to see the value of the controller
        //print("Controller value: ${controller.value}");

Console logs

Check out the official tutorial for more info 🙂

Animations tutorial

By the way, since controller.value goes from 0.0 to 1.0, you can consider it as a sort of completion percentage 🙂

Answered By – Mirko Raimo

Answer Checked By – Mildred Charles (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *