今天遇到了一个关于TextField的问题:
如果给textField设定的布局高度小于它的默认高度,那么它的居中就会有问题.
修改后的效果:
Container(
color: Colors.black12,
constraints: BoxConstraints(maxHeight: 30),
child: TextField(
textAlignVertical: TextAlignVertical.bottom,
focusNode: secondTextFieldNode,
decoration: InputDecoration(
hintText: '请输入',
border: OutlineInputBorder(borderSide: BorderSide.none),
// contentPadding: EdgeInsets.all(0),
),
textCapitalization: TextCapitalization.characters,
),
),