У меня есть коллекция в Firebase
, которая называется cvModels и содержит много документов, чего я хочу добиться - показать 2 документа в каждой строке (все документы).
Каждый документ имеет 2 поля:
- img : ссылка на изображение
- name : строка
Все будет отображаться в ListView
или GridView
.
Пока у меня есть это Function
, которое расширяет только всю строку только для 1 документа.
return StreamBuilder(
stream: Firestore.instance.collection("cvModels").snapshots(),
builder: (BuildContext context,AsyncSnapshot snapshot) {
if (snapshot.hasData) {
return new ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: snapshot.data.documents.length,
padding: const EdgeInsets.only(top: 5.0),
itemBuilder: (context, index) {
DocumentSnapshot ds = snapshot.data.documents[index];
return new Row(
// textDirection: TextDirection.ltr,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Expanded(
child: Container(
height: 120,
width: 40,
margin: EdgeInsets.symmetric(vertical: 20.0),
decoration: BoxDecoration(
color: Colors.black12,
image: DecorationImage(
image: NetworkImage(ds["img"].toString()),
fit: BoxFit.fill,
),
),
),
),
// Expanded (
// child: Container(
// height: 100,
// width: 100,
// child:Text(ds["name"]),
// ),
// ),
// Expanded (child:Text(ds["last-field"].toString()) ),
],
);
}
);
}
},
);
Любой Спасибо за помощь, спасибо.