I want to show a loading button until it loads all the list items from firestore.
return StreamBuilder(
stream: Firestore.instance.collection(uid).snapshots(),
builder: (context, snapshot) {
if (snapshot.hasData) {
return ListView.builder(
itemBuilder: (ctx, index) {
return FavItem(
uid: snapshot.data.documents[index]['uid'],
id: snapshot.data.documents[index]['id'],
,
);
},
itemCount: snapshot.data.documents.length,
最佳答案
CircularProgressIndicator可能就是您想要的。
StreamBuilder(
stream: Firestore.instance.collection(uid).snapshots(),
builder: (context, snapshot) {
if (snapshot.hasData) {
return ...;
}
if (snapshot.hasError) {
return Text(snapshot.error.toString());
}
return CircularProgressIndicator();
},
);
关于firebase - 我如何添加加载圆形图标,因为从Firestore提取数据需要时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62579251/