我想在幕后实现不同的值,例如,如果用户在幕后选择“美国”,我只想要一个值“美国”。我怎样才能做到这一点?
这是我的按钮:
DropdownButton<String>(
isExpanded: true,
underline: SizedBox(),
icon: SvgPicture.asset("assets/icons/dropdown.svg"),
value: dropdownValue,
items: [
'Nepal',
'India',
'United States',
'Denmark',
'UK',
'World Wide'
].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
onChanged: (newValue) {
setState(() {
dropdownValue = newValue;
});
},
),