BoxConstraints强制无限宽度 [英] BoxConstraints forces an infinite width

查看:292
本文介绍了BoxConstraints强制无限宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在列中添加行时出现错误.我收到以下错误消息:

I am getting an error when I add a row in column. I am getting following error:

I/flutter ( 6449): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter ( 6449): The following assertion was thrown during performLayout():
I/flutter ( 6449): BoxConstraints forces an infinite width.
I/flutter ( 6449): These invalid constraints were provided to RenderAnimatedOpacity's layout() function 

这也是我的代码供参考:

Also for reference here is my code:

return new Scaffold(
      backgroundColor: whiteColor,
      body: new Column(
        children: <Widget>[
          imgHeader,
          lblSignUp,
          txtEmail,
          Row(
            mainAxisAlignment: MainAxisAlignment.start,
            children: <Widget>[
              txtFirstName,
              txtLastName
            ],
          ),
        ],
      ),
    );

推荐答案

如果在Row中使用TextField,则需要使用FlexibleExpanded.

If you are using TextField Inside a Row then you need to use Flexible or Expanded.

在此答案中提供了更多详细信息.

More details are given here in this answer.

https://stackoverflow.com/a/45990477/4652688

这篇关于BoxConstraints强制无限宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆