首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >不建议使用“‘vsync”,不应使用

不建议使用“‘vsync”,不应使用
EN

Stack Overflow用户
提问于 2022-07-01 09:01:23
回答 2查看 318关注 0票数 0

更新到颤振版本3.0.3后,我在尝试使用AnimatedSize小部件时收到此警告:

代码语言:javascript
复制
'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.
代码语言:javascript
复制
child: AnimatedSize(
   vsync: this,
   curve: Curves.easeIn,
   duration: Duration(seconds: 1),
   child: Text("test"),
),

那么替代者是什么呢?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2022-07-01 09:15:22

代码语言:javascript
复制
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

票数 0
EN

Stack Overflow用户

发布于 2022-07-01 09:03:44

只要移开场地,就不需要了,

更新后的文档示例还删除了AnimatedSize类

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72826831

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档