Limit max width of Container in Flutter : <pre><code>  Widget build(context) {
    return Row(
      mainAxisSize: MainAxisSize.min,
      children: [
        Container(
          width: 300,
          padding: EdgeInsets.all(10),
          decoration: BoxDecoration(
            color: color ?? Colors.blue,
            borderRadius: BorderRadius.circular(10)
          ),
          child: msg
        )
      ],  
    );
  }
</code></pre>

<p>This is build method of my widget and It renders this UI depending on what I pass as <code>msg</code> paramter</p>

<ol>
<li>Loading text
<a href="https://i.stack.imgur.com/JggN2.png" rel="noreferrer"><img src="https://i.stack.imgur.com/JggN2.png" alt="enter image description here"></a></li>
<li>Some very long text
<a href="https://i.stack.imgur.com/Pu2Yp.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Pu2Yp.png" alt="enter image description here"></a></li>
</ol>

<p>Now the issue I am facing is that I am not able to wrap the text inside this container/blue box without setting it's width but If I set width of container/blue box then it will always stay that wide no matter how short the text is.</p>

<p>Now is there a way to set maxWidth (like let's say 500) of container/blue box? So that the blue box will become as wide as required for small text like "Loading" and for long text it will expand till it reaches width of 500 units and then will wrap the text ?</p>

<p><strong>Required output for long text:</strong></p>

<p>For small text like loading I dont want any change in UI but for long text I want it to look like this.
<a href="https://i.stack.imgur.com/yH6hw.png" rel="noreferrer"><img src="https://i.stack.imgur.com/yH6hw.png" alt="enter image description here"></a></p>
