void showDialogWithFields() {
showDialog(
context: context,
builder: (_) {
var emailController = TextEditingController();
var messageController = TextEditingController();
return AlertDialog(
title: Text('Contact Us'),
content: ListView(
shrinkWrap: true,
children: [
TextFormField(
controller: emailController,
decoration: InputDecoration(hintText: 'Email'),
),
TextFormField(
controller: messageController,
decoration: InputDecoration(hintText: 'Message'),
),
],
),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: Text('Cancel'),
),
TextButton(
onPressed: () {
// Send them to your email maybe?
var email = emailController.text;
var message = messageController.text;
Navigator.pop(context);
},
child: Text('Send'),
),
],
);
},
);
}