The initial value in the dialog box doesn't change when I select an item. Here is the code for the dropdown list:
void _buildStatusDialog(String documentID) {
String _selectedText = "SDD";
showDialog<void>(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text("Status Update"),
content: new DropdownButton<String>(
hint: Text("Status"),
value: _selectedText,
items: <String>['SDD', 'Meeting', 'Home', 'Space']
.map((String value) {
return new DropdownMenuItem<String>(
value: value,
child: new Text(value),
);
}).toList(),
onChanged: (String val) {
_selectedText = val;
setState(() {
_selectedText = val;
});
},
),
actions: <Widget>[
FlatButton(
child: Text("UPDATE"),
onPressed: () {
.....
},
),
],
);
});
}
How do I update the "hint" or display the selected item?

setStatecall is updating the widget that built the dialog, not the dialog. Note thatshowDialogdoesn't get called again. You need to replace your dialog with your own StatefulWidget