AnimateBuilder 的可听参数动画不接受 AnimationController

Listenable Parameter Animation of AnimateBuilder not accepting AnimationController

这里是 Flutter 初学者。我将 Tween 与 AnimationController 一起使用。我正在尝试使用 animate() 方法。

错误如下

The argument type 'AnimationController?' can't be assigned to the parameter type 'Listenable'

我用过的代码

Animation<double>? containerSize;
AnimationController? animationController;
Duration animationDuration = Duration(microseconds: 270);

初始化状态方法:

    void initState(){
       super.initState();
       SystemChrome.setEnabledSystemUIOverlays([]);
       animationController = AnimationController(vsync: this, duration: animationDuration);
   }

Widget 内部声明的 Tween 方法:

containerSize = Tween<double>(begin: size.height * 0.1, end: defaultRegisterSize).animate(CurvedAnimation(parent: animationController!, curve: Curves.linear));

AnimateBuiler里面Scaffold->Body->stack->children

//Register container
          AnimatedBuilder(
            animation: animationController,
            builder: (context, child){
              return buildRegisterContainer();
            },
          )

调用 Inkwell->GestureDetector

GestureDetector(
          onTap: (){
            animationController?.forward();

            setState(() {
              isLogin = !isLogin;  
            });
          }

如何将AnimationController赋值给AnimateBuilder的动画参数?

添加 ! 使其 non-null 像这样:

  AnimatedBuilder(
    animation: animationController!,
    builder: (context, child){
       return buildRegisterContainer();
    },
  )