更新到颤振版本3.0.3后,我在尝试使用AnimatedSize小部件时收到此警告:
'vsync' is deprecated and shouldn't be used. This field is now ignored. This feature was deprecated after v2.2.0-10.1.pre..
Try replacing the use of the deprecated member with the replacement.child: AnimatedSize(
vsync: this,
curve: Curves.easeIn,
duration: Duration(seconds: 1),
child: Text("test"),
),那么替代者是什么呢?
发布于 2022-07-01 09:15:22
double _size = 50.0;
bool _large = false;
void _updateSize() {
setState(() {
_size = _large ? 250.0 : 100.0;
_large = !_large;
});
}
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () => _updateSize(),
child: Container(
color: Colors.amberAccent,
child: AnimatedSize(
curve: Curves.easeIn,
duration: const Duration(seconds: 1),
child: FlutterLogo(size: _size),
),
),
);
}更多信息AnimatedSize
发布于 2022-07-01 09:03:44
只要移开场地,就不需要了,
更新后的文档示例还删除了AnimatedSize类。
https://stackoverflow.com/questions/72826831
复制相似问题