'Flutter - Wrap: do not wrap with text and container

i have this code:

import 'package:flutter/material.dart';

void main() => runApp(mainApp());

class mainApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Chat(),
    );
  }
}

class Chat extends StatefulWidget {
  const Chat({Key? key}) : super(key: key);

  @override
  _ChatState createState() => _ChatState();
}

class _ChatState extends State<Chat> {
  List<Container> myList = [
    Container(
      child: Text(
        'Hello, my name ',
        style: TextStyle(fontSize: 25.0),
      ),
    ),
    Container(
      color: Colors.orange,
      child: Text(
        'is',
        style: TextStyle(fontSize: 25.0),
      ),
    ),
    Container(
      child: Text(
        ' Gabriele, and i am 21 years old!',
        style: TextStyle(fontSize: 25.0),
      ),
    ),
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Wrap(
          children: myList,
        ),
      ),
    );
  }
}

this is my current output:

enter image description here

and this is the output I would like to get: (I would like the last container of myList not to wrap right away). Anyone know how I can do? (without using the RichText widget)

enter image description here

I hope you can help me.

Thank you :)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source