今天遇到了一個關于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,
),
),