当用户选择他们选择的位置时,我希望添加一个订阅主题,任何可以帮助我将其放入我的项目的人都可以添加到我的项目中,但是当我转到firebase时,它不会订阅确定我做错了
SizedBox(height: 8.0),
StreamBuilder<QuerySnapshot>(
stream: locationValue(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return Text('Loading...');
} else {
List<DropdownMenuItem> clubLocations = [];
for (int i = 0; i < snapshot.data.documents.length; i++) {
DocumentSnapshot ds = snapshot.data.documents[i];
clubLocations.add(DropdownMenuItem(
child: Text(
ds.documentID,
style: TextStyle(color: Colors.black),
),
value: '${ds.documentID}',
));
}
return Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
DropdownButton(
items: clubLocations,
onChanged: (locationValue) {
final snackBar = SnackBar(
content: Text(
'Selected Location is $locationValue',
style: TextStyle(color: Colors.black),
),
);
Scaffold.of(context).showSnackBar(snackBar);
this.setState(() {
print(locationValue);
_selectedLocation = locationValue;
});
},
value: _selectedLocation,
isExpanded: false,
hint: new Text(
'Choose Location',
style: TextStyle(color: Colors.black),
),
),
],
);
}
},
),
SizedBox(height: 8.0),