以下のリストの項目を選択しても変化しません。他のものをクリックしても、何も起こりません。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();
}