Suppose we have created a simple DropdownButton ABCPageState
in an ABC stateful widget.
class ABCPageState extends State<ABCPage> {
@override
Widget build(BuildContext context) {
return new Scaffold(
body: new Container(
child:
new DropdownButton(
hint: new Text("Please select value"),
items: <String>['Value 1', 'Value2'].map((String value) {
return new DropdownMenuItem<String>(
value: value,
child: new Text(value),
);
}).toList(),
onChanged: (_) {},
)
)
);
}
}
but NO VALUE is selected after we click on one of the options. In other words - DropdownButton is empty even though we clicked an item. How can we fix that?