# Q: Row直接包裹TextField异常:BoxConstraints forces an infinite width

 A: Row中默认每个子控件都尽可能大。而TextField需要父组件给定。故解决方案是使用Expanded包裹。在Row组件下的Expanded组件最大宽度是设备的宽度。

 Example:

 ```

Row(
  children:[
    Expanded(
      child: TextField(),
     )
  ]
)

```

相关文章:

  • 2021-08-25
  • 2021-06-27
  • 2022-01-01
  • 2022-12-23
  • 2021-10-21
  • 2021-08-11
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-04
  • 2021-12-25
  • 2021-06-10
  • 2022-12-23
  • 2022-12-23
  • 2021-05-31
相关资源
相似解决方案