TextField inside of Row causes layout exception: Unable to calculate size

后端 未结 8 1634
后悔当初
后悔当初 2020-11-28 04:08

I’m getting a rendering exception that I don’t understand how to fix. I’m attempting to create a column that has 3 rows.

Row [Image]

Row [TextField ]

<
8条回答
  •  时光取名叫无心
    2020-11-28 04:43

    The solution is to wrap your Text() inside one of the following widgets: Either Expanded or Flexible. So, your code using Expanded will be like:

    Expanded(
               child: TextField(
                 decoration: InputDecoration(
                   hintText: "Demo Text",
                   hintStyle: TextStyle(fontWeight: FontWeight.w300, color: Colors.red)
                  ),
               ),
            ),
    

提交回复
热议问题