[英]ListTile Flutter
is there any way I can add more value to the ListTile in the code as I am trying to use ListTile to call the value of data in FireCloud.当我尝试使用 ListTile 调用 FireCloud 中的数据值时,有什么方法可以为代码中的 ListTile 添加更多值。 As for now, I can only call 2 of the data that is in the document.
至于现在,我只能调用文档中的 2 个数据。 Any help would be much appreciated on how to call multiple data in FireCloud and display it.
关于如何在 FireCloud 中调用多个数据并显示它的任何帮助将不胜感激。
return Container(
child: Card(
child: ListTile(
title: Text(widget.post.data["Address"]),
subtitle: Image.network(widget.post.data["Picture"],
),
),
),
);
Use ListView.builder constructor , this will help you fetch the total data from the FireCloud
.使用ListView.builder 构造函数,这将帮助您从
FireCloud
获取总数据。 You can use it like this:你可以这样使用它:
Two major things required, these are:需要做的两个主要事情,它们是:
FireCloud
. FireCloud
获取的数据的计数。 Store the coming data into a list, and then pass it into this keyitemCount
itemCount
传递的项目的itemCount
Reference:参考:
ListView.builder(
itemCount: listItems.length,
itemBuilder: (BuildContext ctxt, int index){
// your_view
}
)
For more reference, please refer to this Medium Article on how to get started: Flutter: Displaying Content using ListView.builder如需更多参考,请参阅这篇关于如何开始的 Medium 文章: Flutter: Displaying Content using ListView.builder
Check out this example that will work for you :看看这个对你有用的例子:
ListView.builder(
itemCount: /* snapshot.data.length */,
itemBuilder: (_, index) {
return GestureDetector(
onTap: (){
//navigateToDetail(snapshot.data[index]),
},
child: Card(
child: Column(
children: <Widget>[
Text('your address'),
Text('you and another data')
],
),
),
);
}),
You ca align it in the way you want.你可以按照你想要的方式对齐它。
Let me know if it works让我知道它是否有效
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.