title: Is there a way to detect that a widget is making the layout overflow?
body: <p>I'm trying to handle gracefully the multiple sizes of phones and devices on which my app will be able to run.</p>
  
  <p>On iPhone SE, the screen is not really wide, so I would like to hide some labels (leaving only the icons) when the layout overflows.</p>
  
  <p><img src="https://i.stack.imgur.com/SDyjT.png" alt="Screenshot that shows the problem"></p>
  
  <p>Here are the code used:</p>
  
  <pre><code>  Widget likeDislikeLine() {
      return Padding(
        padding: EdgeInsets.only(top: 0.0, bottom: 0.0),
        child: ButtonBar(
          mainAxisSize: MainAxisSize.min,
          children: &lt;Widget&gt;[
            OutlineButton.icon(
              textColor: Colors.black,
              icon: Icon(Icons.favorite_border, size: 18.0),
              label: Text('J’aime'),
              onPressed: () {
                // Follow segment
              },
            ),
            OutlineButton.icon(
              textColor: Colors.black,
              icon: Icon(Icons.not_interested, size: 18.0),
              label: LayoutBuilder(
                  builder: (BuildContext context, BoxConstraints constraints) {
                String label = 'Je n’aime pas';
                TextPainter tp = TextPainter(
                  text: TextSpan(text: label),
                  textDirection: TextDirection.ltr,
                );
                tp.layout(maxWidth: double.infinity);
                print("${tp.width}, ${constraints.maxWidth}");
  
                return tp.width &lt; constraints.maxWidth
                    ? Text(label)
                    : const SizedBox();
              }),
              onPressed: () {
                // Ignore segment
              },
            )
          ],
        ),
      );
    }
  </code></pre>
  
  <p>How can I detect that the current Row is "overflowing", so I could hide some label? I tried to use <code>LayoutBuilder</code> for that, without success: it always returns constraints with an <code>maxWidth</code> that equals to <code>double.Infinity</code>.</p>