微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何根据 StreamBuilder 和 Firestore 列表导航到其他页面

如何解决如何根据 StreamBuilder 和 Firestore 列表导航到其他页面

我想将我的患者的流构建器列表导航到另一个页面,该页面显示基于另一个集合表的我的患者信息表。

这是我的 StreamBuilder 患者列表代码

Flexible(
                    child: StreamBuilder<QuerySnapshot>(
                      stream: _useRSStream,builder: (BuildContext context,AsyncSnapshot<QuerySnapshot> snapshot) {
                        if (snapshot.hasError) {
                          return Text('Something went wrong');
                        }

                        if (snapshot.connectionState ==
                            ConnectionState.waiting) {
                          return Text("Loading");
                        }

                        return new ListView(
                          children: snapshot.data.docs
                              .map((DocumentSnapshot document) {
                            //var doc_id = document.documentID;
                            Map<String,dynamic> data = document.data();

                            return Card(
                              elevation: 1.5,child: Padding(
                                  padding: const EdgeInsets.all(10.0),child: ListTile(
                                    title: Row(
                                      children: <Widget>[
                                        //gambar
                                        Container(
                                          width: 60,height: 60,decoration: Boxdecoration(
                                              //color: Color(0xFF5FACC9),borderRadius:
                                                  BorderRadius.circular(
                                                      60 / 2),image: decorationImage(
                                                  fit: BoxFit.cover,image: Assetimage(
                                                      'images/userprofile.png'))),),SizedBox(
                                          width: 15,Column(
                                          crossAxisAlignment:
                                              CrossAxisAlignment.start,children: <Widget>[
                                            SizedBox(
                                              width: MediaQuery.of(context)
                                                      .size
                                                      .width -
                                                  175,child: new Text(
                                                data['name'],style:
                                                    TextStyle(fontSize: 17),//title: Text(snapshot.data[index].data()["timestamp"]),//onTap: () => navigatetoDetail(data['name']),SizedBox(
                                              height: 10,// email
                                            //new Text(data['email']),// passing data
                                            GestureDetector(
                                              //onTap: () => navigatetoDetail(snapshot.data()[index]),onTap: () => {
                                                navigatetoDetail(),//print(snapshot
                                                //  .data.docs[index].id),print(data['name'])
                                              },child: Text(
                                                'Daily Record GERD Symptoms',style:
                                                    TextStyle(fontSize: 15),)
                                          ],)
                                      ],)),);
                          }).toList(),);
                      },

这是导航到另一个页面代码

navigatetoDetail(QuerySnapshot post) {
Navigator.push(
    context,MaterialPageRoute(
        builder: (context) => PatientTable(
            /* post : post,*/
            )));

}

这是我的患者列表应用https://ibb.co/HTfCQM6

如您所见,我希望用户单击导航到另一个集合的文本。 2 个集合 profileInfo 和 gerdScaleOfPain 是同一个 id 用户生成的 我只是想问我将如何应用语法,因为 我是 Flutter 和 firebase 的新手。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。