【flutter bug】which is typically created by a TextField, cannot have an unbounded width
  ZFOee8FeVt8W 2023年12月23日 32 0

报错如下:

The following assertion was thrown during performLayout():

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

This happens when the parent widget does not provide a finite width constraint. For example, if the

InputDecorator is contained by a Row, then its width must be constrained. An Expanded widget or a

SizedBox can be used to constrain the width of the InputDecorator or the TextField that contains it.

'package:flutter/src/material/input_decorator.dart':

Failed assertion: line 945 pos 7: 'layoutConstraints.maxWidth < double.infinity'

Either the assertion indicates an error in the framework itself, or we should provide substantially

more information in this error message to help you determine and fix the underlying cause.

In either case, please report this assertion by filing a bug on GitHub:


说TextField有一个无边界的宽度,必须要指定一个宽度,

方案1

指定固定宽度

方案2(官方文档推荐)

结构 Row->TextField+Container,改成 Row> (Expanded>TextField ) + Container。


比较基础的bug,记录下。



【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年12月23日 0

暂无评论

推荐阅读
  TX6np8f0LW62   2023年12月23日   46   0   0 androidciideciideandroid
  a1POfVYpMOW2   2023年12月23日   130   0   0 flutterciflutterideciide
ZFOee8FeVt8W