title: How to check if Flutter Text widget was overflowed
body: <p>I have a Text widget which can be truncated if it exceeds a certain size:</p>
  
  <pre class="lang-dart prettyprint-override"><code>ConstrainedBox(
    constraints: BoxConstraints(maxHeight: 50.0),
    child: Text(
      widget.review,
      overflow: TextOverflow.ellipsis,
    )
  );
  </code></pre>
  <p>Or max number of lines:</p>
  <pre class="lang-dart prettyprint-override"><code>RichText(
    maxLines: 2,
    overflow: TextOverflow.ellipsis,
    text: TextSpan(
      style: TextStyle(color: Colors.black),
      text: widget.review,
    ));
  </code></pre>
  <p>My goal is to have the text expandable <strong>only if</strong> an overflow occurred. Is there a proper way of checking if the text overflowed?</p>
  <h2>What I've tried</h2>
  <p>I have found that in RichText, there is a <code>RenderParagraph renderObject</code> , which has a private property <code>TextPainter _textPainter</code> which has a <code>bool didExceedMaxLines</code>.</p>
  <p>In short, I just need to access <code>richText.renderObject._textPainter.didExceedMaxLines</code> but as you can see, it is made private with the underscore.</p>