在这儿跳起舞。我用的是吐温和AnimationController。我正在尝试使用动画片()方法。
错误说明如下
参数类型为“AnimationController?”不能分配给参数类型'Listenable‘
我用过的代码
Animation<double>? containerSize;
AnimationController? animationController;
Duration animationDuration = Duration(microseconds: 270);initState方法:
void initState(){
super.initState();
SystemChrome.setEnabledSystemUIOverlays([]);
animationController = AnimationController(vsync: this, duration: animationDuration);
}在Widget中声明的吐温方法:
containerSize = Tween<double>(begin: size.height * 0.1, end: defaultRegisterSize).animate(CurvedAnimation(parent: animationController!, curve: Curves.linear));AnimateBuiler里面的脚手架->身体->堆栈->孩子
//Register container
AnimatedBuilder(
animation: animationController,
builder: (context, child){
return buildRegisterContainer();
},
)呼叫Inkwell->GestureDetector
GestureDetector(
onTap: (){
animationController?.forward();
setState(() {
isLogin = !isLogin;
});
}如何将AnimationController赋值给AnimateBuilder的动画参数?
发布于 2022-02-05 15:30:06
添加!使其非空,如下所示:
AnimatedBuilder(
animation: animationController!,
builder: (context, child){
return buildRegisterContainer();
},
)https://stackoverflow.com/questions/70999400
复制相似问题