Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Firebase 使用cloud Firestore时,其他条件不在颤振中工作_Firebase_Flutter_Google Cloud Firestore - Fatal编程技术网

Firebase 使用cloud Firestore时,其他条件不在颤振中工作

Firebase 使用cloud Firestore时,其他条件不在颤振中工作,firebase,flutter,google-cloud-firestore,Firebase,Flutter,Google Cloud Firestore,如果条件成功运行且正在检索数据,则为My。但当数据为null时,我希望在Center()中显示一个文本。尚未添加任何报价的文本。但当数据为空时,它不会显示任何内容。我什么都试过了。但是执行永远不会转到else和else if条件。有人能告诉我我错过了什么吗 child: StreamBuilder( stream: Firestore.instance.collection('BidList').where('PostID'

如果条件成功运行且正在检索数据,则为My。但当数据为null时,我希望在Center()中显示一个文本。尚未添加任何报价的文本。但当数据为空时,它不会显示任何内容。我什么都试过了。但是执行永远不会转到elseelse if条件。有人能告诉我我错过了什么吗

    child: StreamBuilder(
                                stream: Firestore.instance.collection('BidList').where('PostID',isEqualTo:args.PostId).snapshots(),
                                // ignore: missing_return
                                builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot){

                                  if(snapshot.hasData){
                                    return ListView.builder(
                                        itemCount: snapshot.data.documents.length,
                    itemBuilder: (BuildContext context, int index) {
                      return Container(

                        child: Column(
                          children: <Widget>[
                            Container(
                              // margin: EdgeInsets.only(top: 30),
                              child: Row(
                                mainAxisAlignment:
                                MainAxisAlignment.center,
                                children: <Widget>[
                                  Container(
                                    //color: Colors.grey[500],
                                    color: Colors.teal[700],
                                    width: 300,
                                    height: 25,
                                    child: Center(
                                      child: Text(
                                        'Offers List',
                                        style: TextStyle(
                                            fontSize: 18,
                                            fontWeight:
                                            FontWeight.bold,
                                            color: Colors.white),
                                      ),
                                    ),
                                  )
                                ],
                              ),
                            ),
                            ListTile(
                              title: Text(
                                snapshot.data.documents[index].data['Name']
                                    .toString()
                                    .toUpperCase(),
                                style: TextStyle(fontSize: 14, color: Colors
                                    .black, fontWeight: FontWeight.bold),
                              ),
                              leading: CircleAvatar(
                                //backgroundImage: NetworkImage(w),
                                // backgroundColor: Colors.blueGrey,
                                backgroundImage: CachedNetworkImageProvider(data
                                    .toString()),
                              ),
                              // subtitle: Text(username),
                              //subtitle: Text(accountCreated.toString()),
                              subtitle: Row(
                                children: [
                                  Text('Number: ', style: TextStyle(
                                      fontWeight: FontWeight.bold,
                                      fontSize: 10),),
                                  Text(
                                    snapshot.data.documents[index]
                                        .data['Number']
                                        .toString()
                                        .toUpperCase(),
                                    style: TextStyle(
                                        fontSize: 12, color: Colors.black45),
                                  ),
                                ],
                              ),
                              //trailing: Text(timeago.format(timestamp.toDate())),
                              trailing: Container(
                                margin: EdgeInsets.all(10),
                                child: Column(
                                  children: [
                                    Text('Bid', style: TextStyle(
                                        fontWeight: FontWeight.bold),),
                                    Text(
                                      snapshot.data.documents[index].data['Bid']
                                          .toString()
                                          .toUpperCase(),
                                      style: TextStyle(fontSize: 12),),
                                  ],
                                ),
                              ),
                            ),
                            Divider(),
                          ],
                        ),
                      );
                    }
                                    );
                                  }
                                  else if(snapshot.hasError || snapshot == null) {
                                    return Container(
                                      child: Column(
                                        children: <Widget>[
                                          Container(
                                            // margin: EdgeInsets.only(top: 30),
                                            child: Row(
                                              mainAxisAlignment:
                                              MainAxisAlignment.center,
                                              children: <Widget>[
                                                Container(
                                                  //color: Colors.grey[500],
                                                  color: Colors.teal[700],
                                                  width: 300,
                                                  height: 25,
                                                  child: Center(
                                                    child: Text(
                                                      'Offers List',
                                                      style: TextStyle(
                                                          fontSize: 18,
                                                          fontWeight:
                                                          FontWeight.bold,
                                                          color: Colors.white),
                                                    ),
                                                  ),
                                                )
                                              ],
                                            ),
                                          ),
                                          Center(child: Text('No Reviews Yet'),),
                                          Divider(),
                                        ],
                                      ),
                                    );
//
                                  }
                                  else{
                                    return Container(
                                      child: Column(
                                        children: <Widget>[
                                          Container(
                                            // margin: EdgeInsets.only(top: 30),
                                            child: Row(
                                              mainAxisAlignment:
                                              MainAxisAlignment.center,
                                              children: <Widget>[
                                                Container(
                                                  //color: Colors.grey[500],
                                                  color: Colors.teal[700],
                                                  width: 300,
                                                  height: 25,
                                                  child: Center(
                                                    child: Text(
                                                      'Offers List',
                                                      style: TextStyle(
                                                          fontSize: 18,
                                                          fontWeight:
                                                          FontWeight.bold,
                                                          color: Colors.white),
                                                    ),
                                                  ),
                                                )
                                              ],
                                            ),
                                          ),
                                          Center(child: Text('No Reviews Yet'),),
                                          Divider(),
                                        ],
                                      ),
                                    );
                                  }
                                },
                              ),
child:StreamBuilder(
流:Firestore.instance.collection('BidList')。其中('PostID',isEqualTo:args.PostID。)快照(),
//忽略:缺少返回
生成器:(BuildContext上下文,异步快照){
if(snapshot.hasData){
返回ListView.builder(
itemCount:snapshot.data.documents.length,
itemBuilder:(构建上下文,int索引){
返回容器(
子:列(
儿童:[
容器(
//页边空白:仅限边集(前30页),
孩子:排(
主轴对准:
main.center,
儿童:[
容器(
//颜色:颜色。灰色[500],
颜色:Colors.teal[700],
宽度:300,
身高:25,
儿童:中心(
子:文本(
"优惠名单",,
样式:TextStyle(
尺码:18,
容重:
FontWeight.bold,
颜色:颜色。白色),
),
),
)
],
),
),
列表砖(
标题:正文(
snapshot.data.documents[index].data['Name']
.toString()
.toUpperCase(),
样式:TextStyle(字体大小:14,颜色:颜色)
.黑色,fontWeight:fontWeight.bold),
),
领先:CircleAvatar(
//背景图片:NetworkImage(w),
//背景颜色:颜色。蓝灰色,
背景图像:CachedNetworkImageProvider(数据
.toString()),
),
//字幕:文本(用户名),
//字幕:文本(accountCreated.toString()),
字幕:世界其他地区(
儿童:[
文本('编号:',样式:TextStyle(
fontWeight:fontWeight.bold,
尺寸:10),,
正文(
快照.数据.文档[索引]
.数据['Number']
.toString()
.toUpperCase(),
样式:TextStyle(
字体大小:12,颜色:颜色。黑色45),
),
],
),
//尾随:文本(timeago.format(timestamp.toDate()),
拖尾:集装箱(
保证金:所有(10),
子:列(
儿童:[
Text('Bid',style:TextStyle(
fontWeight:fontWeight.bold),
正文(
snapshot.data.documents[index].data['Bid']
.toString()
.toUpperCase(),
样式:TextStyle(字体大小:12),),
],
),
),
),
分隔符(),
],
),
);
}
);
}
else if(snapshot.hasError | | snapshot==null){
返回容器(
子:列(
儿童:[
容器(
//页边空白:仅限边集(前30页),
孩子:排(
主轴对准:
main.center,
儿童:[
容器(
//颜色:颜色。灰色[500],
if(snapshot.hasData){
   if (snapshot.data.docs.length != 0) {
        return ListView.builder();
      } else {
        return Text("EMPTY DOCUMENTS");
      } 
}
if(snapshot.hasError || snapshot.data == null)