close
0

How to solve ' RenderBox was not laid out:' in flutter in a card widget

avatar
asked 04-09-2021

4 Answers


0

TextFormField causes the issue. It needs constraints for width. E.g. wrap it into Expanded widget or Container with width.

avatar
answered 04-09-2021

0

Use Expanded

 Row(
  children: <Widget>[
    Expanded(child: TextField()),
  ],
)
avatar
answered 04-09-2021

0

Use Flexible

Row(
  children: <Widget>[
    Flexible(child: TextField()),
  ],
)
avatar
answered 04-09-2021

0

Wrap it in Container or SizedBox and provide width

Row(
  children: <Widget>[
    SizedBox(width: 100, child: TextField()),
  ],
)   
avatar
answered 04-09-2021