I want to create animation for my logo but it throws an error of The following assertion was thrown BoxConstraints has a negative minimum height

15 views Asked by At
Hero(
                  tag: 'login_hero',
                  child: SizedBox(
                    height: animation.value, //Value is going in -ve
                    child: Image.asset('images/talkup_removebg.png'),
                  ),
                ), //it is also saying that this widget is causing the error

void initState() {
    super.initState();

    controller = AnimationController(duration: const Duration(seconds: 1) ,vsync: this);
    animation = CurvedAnimation(parent: controller, curve: Curves.elasticInOut);

    controller.forward();
    animation.addStatusListener((status) {
      print(status);
    });

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

I tried clamp but it is not doing anything. My image is not even showing on the screen since the value is going in negative.

0

There are 0 answers