TextField设置属性scrollPadding: EdgeInsets.zero
TextField的decoration设置属性contentPadding: EdgeInsets.zero, 设置isDense: true
TextField(
style: TextStyle(fontSize: setFont(28), color: Color(0xff4a4a4a), height: 1, textBaseline: TextBaseline.alphabetic),
scrollPadding: EdgeInsets.zero, // 关键
decoration: InputDecoration(
contentPadding: EdgeInsets.zero, // 关键
isDense: true, // 关键
border: InputBorder.none, // 去除边框
hintText: '搜索问题',
hintStyle: TextStyle(fontSize: setFont(28), color: Color(0xffCCCCCC), height: 58/28, textBaseline: TextBaseline.alphabetic),
counterText: '',
),
controller: _searchInput,
keyboardType: TextInputType.text,
autocorrect: false,
maxLines: 1,
minLines: 1,
maxLength: 20,
textInputAction: TextInputAction.search,
onEditingComplete: () {
_searchQuestion();
},
),