如何使用uid调用另一个表属性? -火基扑动

时间:2019-09-15 14:07:53

标签: firebase firebase-realtime-database flutter dart

我的问题与此How to compare UID and another child key in Firebase?

类似

我正在尝试从该线程创建类似的代码,但是它不起作用

这是我的火力发源地https://imgur.com/ZpU8ODO

StreamBuilder(
        stream: FirebaseDatabase.instance
            .reference()
            .child("questions")
            .onValue,
        builder: (BuildContext context, AsyncSnapshot<Event> snapshot) {
          if (snapshot.hasData) {
            Map<dynamic, dynamic> map = snapshot.data.snapshot.value;
            return GridView.builder(
              gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                crossAxisCount: 1,
                childAspectRatio: MediaQuery.of(context).size.width / (MediaQuery.of(context).size.height / 4),
                mainAxisSpacing: 16.0,
              ),
              itemCount: map.values.toList().length,
              padding: EdgeInsets.only(left: 16, right: 16, top: 16),
              itemBuilder: (BuildContext context, int index) {
                return Container(
                  color: bgSecondaryColor,
                child: Column(
                  children: <Widget>[
                    Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: <Widget>[
                        Flexible(
                          child: Text(
                            parse(parse(map.values.toList()[index]["question"]).body.text).documentElement.text,
                          ),
                        ),
                        Container(
                          child: Column(
                            children: <Widget>[
                              CircleAvatar(
                                backgroundImage: NetworkImage('https://mdn.mozillademos.org/files/7693/catfront.png'),
                                backgroundColor: Colors.lightGreen,
                                radius: 24.0,
                              ),
                              Text(
                                //I want to call the "name" attribute in users here,
                              ),

                            ],
                          ),
                        ),
                      ],
                    ),

                  ],
                ),
                );
              },

对不起,我是扑扑和火力全开的新手。向我致以亲切的问候。谢谢

0 个答案:

没有答案