首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用AlertDialog和TextField理解Jank发生的DropdownButton

用AlertDialog和TextField理解Jank发生的DropdownButton
EN

Stack Overflow用户
提问于 2021-07-30 03:31:10
回答 1查看 170关注 0票数 2

我有AlertDilaog和TextField和DropDownButton。

问题:

一旦启动对话框并单击textfield,警报对话框就会向上移动,textfield中的标签动画就会发生。但是在发生这个的时候,我看到了jank,和我做了分析,我仍然在试图理解为什么会发生这种情况。

这是截图

下面是分析文件:https://filebin.net/7wulbm9j88m6jjt3

能帮助我理解这个VsyncProcessCallback是什么,以及所选部分(括号)中发生的事情吗?

我只是想找出Jank的根本原因并移除它。

提前谢谢你。

TextField代码:

代码语言:javascript
复制
Widget _addProtocolTextField(BuildContext context) {
    return Container(
      height: 7.h,
      width: 70.w,
      child: TextField(
        controller: _protocolNameController,
        style: TextStyle(
          color: Theme.of(context).textColor,
          fontSize: 13.sp,
        ),
        textAlign: TextAlign.left,
        maxLines: 1,
        decoration: InputDecoration(
          labelText: Strings.protocol_name_lable,
          labelStyle: TextStyle(color: ColorConstants.primaryColor),
          enabledBorder: _getBorder(),
          disabledBorder: _getBorder(),
          focusedBorder: _getBorder(),
          border: _getBorder(),
        ),
      ),
    );
  }

  OutlineInputBorder _getBorder() {
    return OutlineInputBorder(
      borderSide: BorderSide(color: ColorConstants.primaryColor),
    );
  }
EN

回答 1

Stack Overflow用户

发布于 2021-07-30 07:44:51

由于这些代码不足以提供真正的解决方案,因此您可以参考以下技巧:

不使用函数制作Widget,更喜欢制作一个单独的无状态或有状态的小部件,因为requirement

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

https://stackoverflow.com/questions/68585134

复制
相关文章

相似问题

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