5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[Flutter]BoxConstraints forces an infinite width .の対処法

Posted at

原因

Row/Columnが幅(高さ)無限の子ウィジェットを持つときなど、このエラーが起きます。

Row(
      children: <Widget>[
        Container(
          width: double.infinity,
        ),
      ],
    );

対処法

mainAxis (Rowならwidth)方向でエラーが出ている場合、問題が起きている子ウィジェットをExpandedで囲みます。

Row(
      children: <Widget>[
        Expanded(
          child: Container(
            width: double.infinity,
          ),
        ),
      ],
    );

参考

Flutter Deep Dive Part 1: “RenderFlex children have non-zero flex…

5
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?