我正在尝试更改下拉菜单的文本颜色,但我失败了,这是我尝试过的
StreamBuilder(
stream: Firestore.instance.collection("country").snapshots(),
builder: (context, snapshot) {
if (!snapshot.hasData)
const Text("Loading.....");
else {
List<DropdownMenuItem> banks = [];
for (int i = 0; i < snapshot.data.documents.length; i++) {
DocumentSnapshot snap = snapshot.data.documents[i];
banks.add(
DropdownMenuItem(
child: Text(
snap.documentID,
style: TextStyle(color: Colors.blueAccent,fontSize: 20)
),
value: "${snap.documentID}",
),
);
}
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(width:0), Container(
padding: EdgeInsets.all(16),
height: 60,
width: 360,
decoration: BoxDecoration(
border: Border.all(width:2,color: wood_smoke),
borderRadius: BorderRadius.circular(16),
),
child:
DropdownButtonHideUnderline(
child: DropdownButton(
style: TextStyle( fontSize: 20, fontWeight: FontWeight.bold,
color: wood_smoke,
),
items: banks,
onChanged: (newValue) {
setState(() {
selectedBranch = newValue;
});
},
value: selectedBranch,
isExpanded: false,
hint: new Text(
"Choose Bank and Branch",
style: TextStyle(color: Colors.blueAccent, fontSize: 20
),
),
)
),
)
],
);
}
})