仍在编写的文本范围。...首先我们写一个 「TextField」 的基本用法,为了方便定位文字是否居中,给 「TextField」 加上边框:
TextField(
decoration: InputDecoration(...contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 12),
),
),
),
其实这种方式并没有严格居中对齐...的高度不是150,在 「maxLines = 1」 的情况下,通过设置 「contentPadding」 改变其高度,为了方便验证是否居中,在中间绘制一条对齐线:
Container(
height...child: Divider(
height: 1,
color: Colors.red,
)),
],
),
),
发现其未居中