【发布时间】:2018-06-12 18:16:35
【问题描述】:
在屏幕中,Firebase 列表具有应用于
的逻辑- 被动检测小部件的蓝色
- 隐藏蓝色小部件
- 显示非蓝色小部件
我想数一下蓝色小部件。
最好的方法是什么?
return new StreamBuilder<int>(
stream: subscribeMyThings(thing.id),
builder: (context, thingsSnapshot) {
return new FirebaseAnimatedList(
query: getThings(thing.id),
itemBuilder: (context, snapshot, animation, index) {
return new ReactiveWidget<int>(
reactiveRef: getThingBlueness(snapshot.key),
widgetBuilder: (checkBlueness) {
// code to check blueness here
// if Thing is blue, place empty container
if (thingIsBlue) {
return new Container();
// *** how do I count these??? ***
}
// or, if Thing is NOT blue
return new Thing(thing.id);
);
},
);
);
}
【问题讨论】: