![](/img/trans.png)
[英]How to import bulk data in firebase firestore database from excel or google spreadsheet or CSV using flutter
[英]How do I Group and List data according to date using Flutter, Firebase - Firestore Database?
我需要一份按可用日期分組的酒店列表(分組依據 - 添加日期)。 請讓我知道可以做什么。 以下是我的代碼。 提前致謝。
StreamBuilder(
stream: FirebaseFirestore.instance
.collection('hotels')
.snapshots(),
builder:
(context, AsyncSnapshot<QuerySnapshot> snapshot) {
if (!snapshot.hasData) {
return Center(child: CircularProgressIndicator());
}
return ListView.builder(
itemCount: snapshot.data?.docs.length,
itemBuilder: (context, index) {
return Stack(
children: [
我想在每個分組列表上方指定日期
//the date captured from the group by condition
Text("${example date}", style: TextStyle(
color: Colors.white
),),
Container(
child: Column(
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
Padding(
padding: const EdgeInsets.only(
right: 10.0),
child: Text(
"${snapshot.data!.docs[index]['name']
.toString()}",
style: TextStyle(
fontSize: 14,
color: Colors.white,
),
),
),
],
),
], ), ), ],);}); }, ),
這已經在這里得到回答: Flutter/Dart how to groupBy list of maps
package集合通過function實現分組。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.