title: Wrap text in container without using a fixed width in Flutter
body: <p>I'm trying to create a basic chat application in Flutter and I want to display the conversation in simple containers which will adapt its length to the text inside. Everything works fine until the text does not fit the length of the container, when I get an overflow error.</p>
  
  <p><a href="https://i.stack.imgur.com/Th1xX.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Th1xX.png" alt="enter image description here"></a></p>
  
  <p>The code that I'm using is this one</p>
  
  <pre><code>Widget _buildMessage(Message message) {
      return Row(children: &lt;Widget&gt;[
        message.author == username ? Expanded(child: Container()) : Container(),
        Container(
            padding: EdgeInsets.all(8.0),
            margin: EdgeInsets.all(4.0),
            decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.all(Radius.circular(8.0))),
            child: Row(
              children: &lt;Widget&gt;[
                Text(
                  message.text,
                ),
                SizedBox(
                  width: 8.0,
                ),
                Padding(
                  padding: EdgeInsets.only(top: 6.0),
                  child: Text(
                    message.time,
                    style: TextStyle(fontSize: 10.0, color: Colors.grey),
                  ),
                ),
                SizedBox(
                  width: 8.0,
                ),
                Padding(
                  padding: EdgeInsets.only(top: 6.0),
                  child: Text(
                    message.author,
                    style: TextStyle(fontSize: 10.0, color: Colors.grey),
                  ),
                ),
              ],
            )),
        message.author != username ? Expanded(child: Container()) : Container(),
      ]);
    }
  </code></pre>
  
  <p>I'm using a Row within a Row so that I can get this alignment to the right or to the left depending on the author.
  If I type something with a multiline in my input, the text is rendered properly, with the container expanding vertically as needed. The problem is when I just type beyond the width of the container.</p>
  
  <p>I can fix this by wrapping the Text with a Container and a fixed with, but I don't want that as I want the width to be dynamic and adapt to the text.</p>
  
  <p>I've seen other questions where people suggests using Flexible or Expanded, but I can't figure out how to do it.</p>
  
  <p>Any ideas would be appreciated.</p>