close

How to set center text vertically and horizontally in Flutter?

Hello Guys How are you all? Hope you all are fine. Today in this tutorial we are going to learn How to set center text vertically and horizontally in Flutter? so without wasting your time lets start this tutorial.

How to set center text vertically and horizontally in Flutter?

  1. Using Center Widget
  2. Also Using textAlign Property.
  3. Using Align widget.

How to set Text in center Using Center Widget.

To set text in center Just Use Center() widget. It will set Text to horizontally and vertically Center. Lets have a look of my example.

        Center(
          child: Text(
            "FlutterCorner",
          ),
        ),

Output

How to set Text in center Using Center Widget,
How to set center text vertically and horizontally in Flutter,
How to set Text in center Using textAlign Property,
How to set Text in center Using Align widget,
center text vertically and horizontally

How to set Text in center Using textAlign Property.

Text widget has textAlign property you can give them start, end, center, justify, left, right. Lets have a look of my example.

        Text(
          "FlutterCorner",
          textAlign: TextAlign.center,
        ),

Output

How to set Text in center Using Center Widget,
How to set center text vertically and horizontally in Flutter,
How to set Text in center Using textAlign Property,
How to set Text in center Using Align widget,
center text vertically and horizontally

How to set Text in center Using Align widget.

We can use Align Widget to set text in center align has alignment property. Lets have a look of my example.

        child: Align(
          alignment: Alignment.center,
          child: Text("FlutterCorner"),
        ),

Output

How to set Text in center Using Center Widget,
How to set center text vertically and horizontally in Flutter,
How to set Text in center Using textAlign Property,
How to set Text in center Using Align widget,
center text vertically and horizontally

Faq

  1. How to set center text vertically and horizontally in Flutter?

    to set center text vertically and horizontally in Flutter Just Use Center() widget. It will set Text to horizontally and vertically Center. The text widget has textAlign property you can give them start, end, center, justify, left, right. We can use Align Widget to set text in center align has alignment property.

  2. set center text vertically and horizontally in Flutter

    to set center text vertically and horizontally in Flutter Just Use Center() widget. It will set Text to horizontally and vertically Center. The text widget has textAlign property you can give them start, end, center, justify, left, right. We can use Align Widget to set text in center align has alignment property.

Summery

So, It’s All About this tutorial. I hope this tutorial helps you to solve your error. Please Comment Below if You stucks anywhere with my code.

Also Check Out Below Tutorials

Leave a Comment

%d bloggers like this: