我正在尝试使用下拉按钮让用户从选项列表中进行选择,但是在做出选择后,下拉按钮仍然显示提示。我认为 setState 的某些内容没有更新下拉按钮。
value: skillChoice,
items: listDrop,
hint: Text("Choose Skill"),
onChanged: (value) {
setState(() {
skillChoice = value;
});
},
),
以下是代码中前面声明的变量:
List<DropdownMenuItem<int>> listDrop = [];
int skillChoice = null;
谁能告诉我为什么不更新?