I am showing a dialog to the user and I want to change title of the dialog when dialog's positive button is clicked but how can I do that.
Since the dialog is already visible on the screen and setState() won't be able to do anything.
Code:
String title = "Old Title" // member variable
RaisedButton(onPressed: (){
showDialog(context: context, builder: (context) {
return AlertDialog(title: Text(title), actions: <Widget>[FlatButton(onPressed: () {
setState(() => title = "New Title");
}, child: Text("Change"))],);
});
}, child: Text("Change"),)