我正在尝试为应用程序中的某些加载器使用AnimateContainer。
我尝试将setstate方法放在initState中,但仍然没有结果
class MainLoaderState extends State<MainLoader> {
bool _expanded = true;
Timer _timer;
@override
void initState() {
_timer = new Timer.periodic(new Duration(seconds: 1), (timer) {
setState(() {
_expanded = !_expanded;
debugPrint("_expanded: $_expanded");
});
});
}
...
}
我希望能够每2秒更改一次状态,以便为应用创建某种预加载器。