Last active
December 25, 2021 07:57
-
-
Save tetujin/ec66ba447c0d0dfbf38bc7df06482823 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final _textFieldController = TextEditingController(); | |
Future<String?> _showTextInputDialog(BuildContext context) async { | |
return showDialog( | |
context: context, | |
builder: (context) { | |
return AlertDialog( | |
title: const Text('タイトル'), | |
content: TextField( | |
controller: _textFieldController, | |
decoration: const InputDecoration(hintText: "文字列を入力してください。"), | |
), | |
actions: <Widget>[ | |
ElevatedButton( | |
child: const Text("キャンセル"), | |
onPressed: () => Navigator.pop(context), | |
), | |
ElevatedButton( | |
child: const Text('OK'), | |
onPressed: () => Navigator.pop(context, _textFieldController.text), | |
), | |
], | |
); | |
}, | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment