我希望我的表单文本垂直居中,并与后缀一致,因为它是恼人的我,它不是。
在我的InputDecoration
中,我试着把contentPadding
设置为EdgeInsets.zero
,但是最后还是这样,我希望它能像第一个表单域一样,唯一的区别就是有后缀,下面是代码。
return Form(
key: _addSubjectFormKey,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
TextFormField(
textCapitalization: TextCapitalization.words,
autofocus: true,
decoration: InputDecoration(
filled: true,
hintText: 'Enter subject name',
),
textInputAction: TextInputAction.next,
),
SizedBox(height: 20.0),
TextFormField(
textCapitalization: TextCapitalization.words,
autofocus: false,
keyboardType: TextInputType.text,
textInputAction: TextInputAction.next,
decoration: InputDecoration(
contentPadding: EdgeInsets.zero,
filled: true,
hintText: 'Enter your name',
suffix: IconButton(
icon: Icon(Icons.keyboard),
onPressed: () => {},
)),
),
],
),
),
);
1条答案
按热度按时间c7rzv4ha1#
您可以尝试将
textAlignVertical: TextAlignVertical.center
添加到您的TextFormField: