Json 如何将用户注释容器添加到Listview颤振
我对向ListView添加注释感到困惑,我只能添加没有Json的注释,但当我添加更多条件(如图片、时间和用户名)时,我尝试键入注释并按下按钮添加到ListViewBuilder,请帮助我在按下按钮时下一步该怎么做,让我们看看我向ListView添加了哪些注释:)Json 如何将用户注释容器添加到Listview颤振,json,flutter,listview,Json,Flutter,Listview,我对向ListView添加注释感到困惑,我只能添加没有Json的注释,但当我添加更多条件(如图片、时间和用户名)时,我尝试键入注释并按下按钮添加到ListViewBuilder,请帮助我在按下按钮时下一步该怎么做,让我们看看我向ListView添加了哪些注释:) 列表注释=[ 评论细节( 其他用户名:“b-akused02”, otherUserProfileImageUrl:Utils.getRandomImageUrl(), 评论:“不错”, 日期:“3天”), 评论细节( 其他用户名:“b
列表注释=[
评论细节(
其他用户名:“b-akused02”,
otherUserProfileImageUrl:Utils.getRandomImageUrl(),
评论:“不错”,
日期:“3天”),
评论细节(
其他用户名:“b-akused01”,
otherUserProfileImageUrl:Utils.getRandomImageUrl(),
评论:
“太好了,太长的文字,但它只停留在100高度,无法响应”,
日期:“3天”),
评论细节(
其他用户名:“b-akused03”,
otherUserProfileImageUrl:Utils.getRandomImageUrl(),
评论:“不错”,
日期:“3天”),
];
var txt=TextEditingController();
void\u addOtherUser(otherUsername){
设置状态(){
otherUsername.add();
//评论。添加(评论);
});
}
void\u addProfile(otherUserProfileImageUrl){
设置状态(){
otherUserProfileImageUrl.add();
//评论。添加(评论);
});
}
void\u addComment(注释){
设置状态(){
comment.add(txt.text);
//评论。添加(评论);
});
}
作废_添加日期(日期){
设置状态(){
date.add();
//评论。添加(评论);
});
}
标题:TextFormField(
装饰:输入装饰(
labelText:“在这里写评论…”,
fillColor:Colors.white,
contentPadding:新的EdgeInsets.symmetric(
垂直:15.0,水平:10.0),
边框:新大纲输入边框(
边界半径:新边界半径。圆形(25.0),
),
后缀:大纲按钮(
已按下:(){
_addOtherUser();
_addProfile();
_addComment(txt.text);
_addDate();
},
borderSide:borderSide.none,
子:文本(
“评论”,
样式:TextStyle(
颜色:Colors.blueAccent,
fontWeight:fontWeight.bold),
),
),
),
控制器:txt,
样式:TextStyle(颜色:Colors.black),
),
),
List<CommentDetail> comments = [
CommentDetail(
otherUsername: "b-akused02",
otherUserProfileImageUrl: Utils.getRandomImageUrl(),
comment: "Nice Nice Nice Nice Nice Nice Nice Nice Nice Nice ",
date: "3 days"),
CommentDetail(
otherUsername: "b-akused01",
otherUserProfileImageUrl: Utils.getRandomImageUrl(),
comment:
"So niceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee and so long text but it's only stuck at 100 height can't responsive",
date: "3 days"),
CommentDetail(
otherUsername: "b-akused03",
otherUserProfileImageUrl: Utils.getRandomImageUrl(),
comment: "Nice Nice Nice Nice Nice Nice Nice Nice Nice Nice ",
date: "3 days"),
];
var txt = TextEditingController();
void _addOtherUser(otherUsername) {
setState(() {
otherUsername.add();
// comments.add(comments);
});
}
void _addProfile(otherUserProfileImageUrl) {
setState(() {
otherUserProfileImageUrl.add();
// comments.add(comments);
});
}
void _addComment(comment) {
setState(() {
comment.add(txt.text);
// comments.add(comments);
});
}
void _addDate(date) {
setState(() {
date.add();
// comments.add(comments);
});
}
title: TextFormField(
decoration: InputDecoration(
labelText: "Write comment here...",
fillColor: Colors.white,
contentPadding: new EdgeInsets.symmetric(
vertical: 15.0, horizontal: 10.0),
border: new OutlineInputBorder(
borderRadius: new BorderRadius.circular(25.0),
),
suffixIcon: OutlineButton(
onPressed: () {
_addOtherUser();
_addProfile();
_addComment(txt.text);
_addDate();
},
borderSide: BorderSide.none,
child: Text(
"Comment",
style: TextStyle(
color: Colors.blueAccent,
fontWeight: FontWeight.bold),
),
),
),
controller: txt,
style: TextStyle(color: Colors.black),
),
),