skip to Main Content

My Flutter Text widget is not going on a new line in the way that it should following the spaces between words. What I am expecting is something like:

Non tutti possono diventare dei
grandi artisti ma un grande artista può celarsi in chiunque.

But what I’m getting is this:myApp

Here is my problematic code:

class HomePageBodyState extends State<HomePageBody>
{
  @override
  Widget build(BuildContext context)
  {
    return ListView(
      padding: EdgeInsets.all(8),
      children: [
        Column(
          children: [
            Container(
              padding: EdgeInsets.only(left: 20, right: 20, top: 10, bottom: 4),
              child:
                Text(
                  ' Non tutti possono diventare dei grandi artisti ma un grande artista può celarsi in chiunque. ',
                  softWrap: true,
                  textAlign: TextAlign.center,
                  style: TextStyle(
                  fontFamily: "Glass",
                  fontSize: 26,
                  ),
              ),
            ),
          ],
        ),
      );
  }

2

Answers


  1. You center the text with this line:

              textAlign: TextAlign.center,
    

    Remove this, if the text should start on the left.

    Login or Signup to reply.
  2. You can align the text to the start by changing the textAlign property to TextAlign.start
    This will align your text to the start of the container.

               Text(
                    ' Non tutti possono diventare dei grandi artisti ma un grande artista può celarsi in chiunque.',
                    softWrap: true,
                    textAlign: TextAlign.start,
                    style: TextStyle(
                    fontFamily: "Glass",
                    fontSize: 26,
                    ),
                  )
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search