我正在创建一个多行文本字段,但是由于某种原因,我的文本被输入修饰所阻挡。它本来是单行的,但是多行破坏了它。我的代码看起来像这样:
TextField(
style: Theme.of(context)
.textTheme
.headline4,
onChanged: (value) {
if (value != '') {
setState(() {
hasText = true;
});
} else {
setState(() {
hasText = false;
});
}
},
onSubmitted: (value) {
//clear the text controller and the image and un focus the text field and set is typing to false
_textEditingController.clear();
_focusNode.unfocus();
setState(() {
isTyping = false;
_image = null;
});
},
//allow the text to be multiline
keyboardType: TextInputType.multiline,
maxLines: null,
focusNode: _focusNode,
controller: _textEditingController,
decoration: InputDecoration(
filled: true,
//circular border
border: OutlineInputBorder(
//no border
borderSide: BorderSide.none,
borderRadius:
BorderRadius.circular(25)),
//light grey color
fillColor: Color(0xffF2F2F2),
hintText:
'Reply to ${widget.waveTile.poster.handle}'),
onTap: () {
setState(() {
isTyping = true;
});
},
),
文本如下所示:
知道这是怎么回事吗?
谢谢你!
1条答案
按热度按时间yhqotfr81#
这是因为装饰中的内容填充,请尝试将其更改为更小的值,或者为水平和垂直填充设置不同的值