[英]How to align text in different Text widgets in Flutter?
When I using Text('00:47')
, the colon in the middle can be centered vertically with the number, as shown below:当我使用Text('00:47')
时,中间的冒号可以与数字垂直居中,如下图:
But when I combine three Text
widgets, the colon loses its alignment.但是当我组合三个Text
小部件时,冒号会丢失它的 alignment。
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('00'),
Text(':'),
Text('47'),
],
)
How can I make the colon and number vertically centered?如何使冒号和数字垂直居中?
You can try this你可以试试这个
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('00'),
Padding(
padding: const EdgeInsets.only(bottom: 10),
child: Text(':'),
),
Text('47'),
],
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.