How do I center text vertically and horizontally in Flutter?

后端 未结 8 1313
不思量自难忘°
不思量自难忘° 2020-12-13 05:34

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

8条回答
  •  感情败类
    2020-12-13 05:47

    Text alignment center property setting only horizontal alignment.

    I used below code to set text vertically and horizontally center.

    Code:

          child: Center(
            child: Text(
              "Hello World",
              textAlign: TextAlign.center,
            ),
          ),
    

提交回复
热议问题