How to Center Align Text in TextField

This post contains code and a short tutorial on how to Center Align Text in TextField there are some properties for it in TextField Widget.

Aligning a text at the center of the text field is super simple but if you want to add it to the center vertically then there are some Quick Fix.

First, we need to add some properties in TextField.

TextFIeld(
        textAlign: TextAlign.left,
)
Center Align Text in TextField
Center Align Text in TextField

Next Aligning a text Vertically, Just add the TextField Inside the Column with mainAxisAlignment.center

Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          TextField(
            textAlign: TextAlign.center,
            textAlignVertical: TextAlignVertical.center,
          ),
        ],
      ),

Also, Add textAlignVertical Property.


For more Flutter tutorials, Tips, Tricks, Free code, Questions, and Error Solving.

Remember FlutterDecode.com

Leave a Comment