首页 > 解决方案 > 这是我的错误如何解决?当我单击文本字段时出现此错误

问题描述

在此处输入图像描述

这是我的代码

appBar: AppBar(
            title: Card(
              shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15.0)),
              margin: EdgeInsets.only(left: 20,top: 20,bottom: 20,),

              child: TextField(
                autofocus: false,
                style: TextStyle(
                    fontSize: 20),
                decoration: InputDecoration(hintText: 'گەڕان',
                    border: InputBorder.none,
                    disabledBorder: InputBorder.none,
                    suffixIcon: IconButton(
                      onPressed: () => _searchInputController.clear(),
                      icon: Icon(Icons.clear),
                    ),
                    contentPadding: EdgeInsets.only(left: 10.0,right: 5.0,top: 10.0)),
                onSubmitted:  (value) {
                  _filterList(value);
                },
                controller: _searchInputController,
              ),
            ),
          ),

标签: flutterdart

解决方案


这个bug我也有一段时间了。这似乎是一个内部 Flutter 错误,我们无能为力。我认为您可以通过更改 TextField 的内部结构来绕过它,但这不值得付出努力,因为该错误不会造成任何不良后果。

由于 Flutter 2 我不再有这个错误,也许尝试更新。


推荐阅读