import 'package:flutter/material.dart'; class UIDialogs { static Future showTextInput(BuildContext context, String title, String hintText) { var _textFieldController = TextEditingController(); return showDialog( context: context, builder: (context) => AlertDialog( title: Text(title), content: TextField( autofocus: true, controller: _textFieldController, decoration: InputDecoration(hintText: hintText), ), actions: [ TextButton( onPressed: () => Navigator.of(context).pop(), child: Text('Cancel'), ), TextButton( onPressed: () => Navigator.of(context).pop(_textFieldController.text), child: Text('OK'), ), ], ), ); } }