在使用TextField想做出微信发送消息的那个框的效果的时候,发现他的hintText和输入后的文字都不能居中,在设置了InputDecoration的contentPadding也没用,最后我是通过设置TextField的maxLine和minLine解决的
TextField(
controller: _textController,
keyboardType: TextInputType.text,
textAlign: TextAlign.left,
textAlignVertical: TextAlignVertical.center,
minLines: 1,
maxLines: 4,
cursorColor: green_ff7ed321,
decoration: InputDecoration(
isDense: true,
counterText: '',
alignLabelWithHint: true,
contentPadding: EdgeInsets.only(left: 24,right: 24,top: 6,bottom: 6),
hintStyle: TextStyleMs.gray_999999_16,
//hintText: "请输入信息",
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.transparent,
width: 1,
),
borderRadius: BorderRadius.circular(37),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.transparent,
width: 1,
),
borderRadius: BorderRadius.circular(37),
),
),
),