美文网首页
Flutter Column中包 row 中有TextField

Flutter Column中包 row 中有TextField

作者: Superman168 | 来源:发表于2023-12-20 14:37 被阅读0次

column中包 row 中有TextField报错


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 950 pos 7: 'layoutConstraints.maxWidth < double.infinity'
报错信息.png

字面意思就是需要添加约束,要加 constraints

Pasted Graphic 1.png

这样就好了

相关文章

网友评论

      本文标题:Flutter Column中包 row 中有TextField

      本文链接:https://www.haomeiwen.com/subject/jkntndtx.html