【发布时间】:2020-07-19 15:43:33
【问题描述】:
我想将我的 TextField 与我的文本对齐。目前它看起来像这样:
我尝试了不同的方式来对齐它,但是我尝试过的任何方式都搞砸了,我可以点击使 TextField 处于活动状态(只能点击文本字段顶部的右侧) 代码如下:
Container(
padding: EdgeInsets.all(5),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10)),
margin: EdgeInsets.all(20),
width: 300,
height: 45,
child: Row(
children: <Widget>[
Text(
'Name: ',
style: TextStyle(
fontSize: 25, fontWeight: FontWeight.bold),
),
Expanded(
child: Container(
child: TextField(
decoration: InputDecoration.collapsed(
// border: InputBorder.none,
hintText: ' ',
hintStyle: TextStyle(fontSize: 23)),
controller:
_nameController ?? TextEditingController()
..text = widget.name,
onChanged: (text) => {},
style: TextStyle(fontSize: 23),
),
),
)
],
),
)
谢谢
【问题讨论】:
-
谢谢,删除填充只是一个愚蠢的错误