问题描述
当我选择下面列表中的项目时,它不会改变。如果我点击其他人,那么什么都不会发生。
如何更改 firestore 和 UI 的此值?
我知道,我需要更新 value: constantValue,
这段代码,但我如何通过提供程序来做到这一点?
这里,按钮:
Widget dropdownButton(BuildContext context) {
String constantValue = "League Of Legends";
return DropdownButton(
value: constantValue,onChanged: (newValue) {
context.read<PostProvider>().postCategory = newValue;
},items: <String>["League Of Legends","Steam","Csgo"]
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,child: Text(value),);
}).toList());
}
还有提供者:
String _postCategory;
String get postCategory => _postCategory;
set postCategory(String value) {
_postCategory = value;
notifyListeners();
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)