【发布时间】:2021-06-15 05:48:56
【问题描述】:
我正在尝试将多行支持放在应用的评论部分之一,但它不接受它。
我输入的是
Hi
Hello
Hello
显示这个错误
这是我为输入框编写的代码
ListTile(
leading: CircleAvatar(
backgroundImage: AssetImage(UIData.pkImage),
),
title: Container(
constraints: BoxConstraints(
maxHeight: double.infinity,
minHeight: 20,
),
child: TextField(
keyboardType: TextInputType.multiline,
minLines: 1,//Normal textInputField will be displayed
maxLines: 10,// when user presses enter it will adapt to it
decoration: InputDecoration(
suffix: IconButton(
color: Colors.grey,
icon: Icon(Icons.send),
onPressed: () {
createComment();
},
),
hintText: 'Leave a Comment....',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(20.0),
borderSide: BorderSide(color: Colors.teal))),
controller: commentController,
),
),
),
问题在于更新 graphQL 查询并使用字符串块对其进行初始化
String createComments(String postId, var text) {
return """
mutation{
createComment(postId: "$postId",
data:{
text: ""$text"",
}
){
_id
}
}
"""
;
}
【问题讨论】:
-
您能否编辑您的代码以添加您提供该字符串的位置?
-
确定我要添加它@MikiMints
-
你也可以提供一个样本
comments对象吗? -
它是字符串类型
-
您可以使用 AutoSize 文本小部件并设置最大行数
标签: javascript flutter dart graphql