I made a function that pops up a dialog with a TextField.
I want to know how to input the text received as a parameter into a TextField.
Future<String?> openDialog(String title, String text) => showDialog<String>(
context: context,
builder: (context) => AlertDialog(
title: Text(title),
content: TextField(
autofocus: true,
decoration: InputDecoration(
labelText: '~~',
),
controller: controller,
onSubmitted: (_) => ok(),
),
actions: [
TextButton(
onPressed: ok,
child: Text('ok')
)
],
)
);