【发布时间】:2023-02-04 20:25:58
【问题描述】:
我现在正在使用 flutter,而 StreamBuilder 让我很生气......
我认为 ListView.builder 有问题,我用容器包裹它并改变了高度,还有 Expanded,但它没有用。我使用 firebase 作为数据库。什么问题?????
body: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Container(
color: Color(0xffe9ecef),
height: 2000,
child: StreamBuilder(
stream: content.snapshots(),
builder: (context , snapshot)
{if (snapshot.hasData){return Expanded(child:ListView.builder(
itemCount: snapshot.data!.docs.length,
itemBuilder: (context, index)
{ DocumentSnapshot document = snapshot.data!.docs[index];
return Text(document['text']);}
));}else{return CircularProgressIndicator();}}
)
)
)
【问题讨论】: