0
点赞
收藏
分享

微信扫一扫

An InputDecorator, which is typically created by a TextField, cannot have an unbounded width

天蓝Sea 2023-03-27 阅读 100

Flutter运行时报如下错误

An InputDecorator, which is typically created by a TextField, cannot have an unbounded width. image.png

原因

TextField 没有被限定大小。

解决方法

使用Container包起来,如果时column或者row可以用Expanded包起来。

                          content: Container(
                            width: 200,
                            child: TextField(
                              controller: _textEditingController,
                              decoration: const InputDecoration(hintText: "请输入数据"),
                            ),
                          ),
举报

相关推荐

0 条评论