I\'d like to know how to center the contents of a Text widget vertically and horizontally in Flutter. I only know how to center the widget itself using Center(child: T
Center(child: T
You can use TextAlign property of Text constructor.
TextAlign
Text
Text("text", textAlign: TextAlign.center,)
Put the Text in a Center:
Container( height: 45, color: Colors.black, child: Center( child: Text( 'test', style: TextStyle(color: Colors.white), ), ), );