1

I have tried the solutions posted here but none of them seemed to work.

        Container(
          child: Center(
            child: Text(
            "Financial Formulas\n",
            textAlign: TextAlign.center,
            style: TextStyle(fontSize: 16),
            ),
          ),
          color: Colors.blue,
          width: 150,
          height: 35,
        ),

2 Answers2

2

When you add a \n to your text, it takes an extra line. Remove it and your text will be in the middle:

Formulas

Sidak
  • 1,213
  • 6
  • 11
0

To break your text into new lines, use the /n.

In your case change your code to the one below:

   Container(
          child: Center(
            child: Text(
            // Financial will be on a line and Formulas on another line
            "Financial\nFormulas",
            // the text align property tells you how to arrange the texts
            textAlign: TextAlign.center,
            style: TextStyle(fontSize: 16),
            ),
          ),
          color: Colors.blue,
          width: 150,
          height: 35,
        ),
halfer
  • 19,824
  • 17
  • 99
  • 186
void
  • 12,787
  • 3
  • 28
  • 42