1) 对于textformfield中的padding,你应该编辑装饰中的contentPadding,例如,在 "装饰 "中的 "padding"。
TextField(
maxLines: 8,
decoration: InputDecoration(
contentPadding: EdgeInsets.fromLTRB(0,0,0,0), <--
labelText: 'Description',
labelStyle: txtHintStyle,
)
)
然后放上你想要的任何东西,比如把它覆盖为0。
2) 如果你已经定义了标签文本,请删除提示文本,当你选择textformfield时,标签文本会自动覆盖在标签上。
3) TextFormField提供了textAlign参数,例如:。
TextFormField(
textAlign: TextAlign.center, <--
controller: _username,
),