show static method

Future<String?> show(
  1. BuildContext context, {
  2. required String title,
  3. Widget? description,
  4. String? placeholder,
  5. String? initialValue,
})

Show a text prompt dialog.

Returns the submitted text, or null if cancelled.

Implementation

static Future<String?> show(
  BuildContext context, {
  required String title,
  Widget? description,
  String? placeholder,
  String? initialValue,
}) {
  return Navigator.of(context).showDialog<String>(
    builder: (ctx) => DialogPrompt(
      title: title,
      description: description,
      placeholder: placeholder,
      initialValue: initialValue,
      onSubmit: (value) {
        Navigator.of(ctx).pop(value);
      },
      onCancel: () {
        Navigator.of(ctx).pop();
        return null;
      },
    ),
  );
}