Search code examples
flutterdarttext-alignment

How to align Text properly in flutter?


I actually want to find out how I can center text in a button correctly. I am using a custom font and with this font, it won't center my text inside of the button no matter what I am doing.

I already have found out, that with the standard Font (I guess its Roboto) it's not aligning perfectly in the center too but this isn't very annoying at that point.

Here is my code:

RaisedButton(
   onPressed: () {},
   child: Text("LOG IN"),
),

Here what it produces with my custom font:

enter image description here

And here with standard Roboto:

enter image description here

Thank you very much!


Solution

  • Try to add padding 0

    RaisedButton(
       padding: EdgeInsets.all(0), //<- try add this
       onPressed: () {},
       child: Text("LOG IN"),
    ),