【发布时间】:2020-04-05 08:52:22
【问题描述】:
使用AnimationController时,那个vsync参数的作用是什么?
class Example extends StatefulWidget {
@override
_ExampleState createState() => _ExampleState();
}
class _ExampleState extends State<Example> with SingleTickerProviderStateMixin {
AnimationController controller;
@override
void initState() {
super.initState();
controller = AnimationController(
duration: const Duration(seconds: 2),
vsync: this, // Why do we need this?
);
}
// ...
}
【问题讨论】: