我希望表单文本垂直居中并与后缀对齐,因为这让我很烦,不是。
在我的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: () => {},
)),
),
],
),
),
);