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

后端 未结 8 1644
后悔当初
后悔当初 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:58

    Row(
          children: [
            Expanded(
              flex: 1,
              child: Padding(
                padding: EdgeInsets.only(left: 5.0,right: 5.0),
                child: TextFormField(
                  controller: commentController,
                  validator: (String value){
                    if(value.isEmpty){
                      // ignore: missing_return
                      return 'Comment cannot be blank.';
                    }
                  },
                  decoration: InputDecoration(
                      labelText: "Comment",
                      labelStyle: TextStyle(
                          fontFamily: 'Montserrat',
                          fontWeight: FontWeight.bold,
                          color: Colors.grey),
                      focusedBorder: UnderlineInputBorder(
                          borderSide: BorderSide(color: Colors.green))),
                ),
              ),
            ),
          ],
        ),
    

提交回复
热议问题