showTextInputDialog function

Future<List<String>> showTextInputDialog (
  1. {@required BuildContext context,
  2. @required List<DialogTextField> textFields,
  3. String title,
  4. String message,
  5. String okLabel,
  6. String cancelLabel,
  7. bool isDestructiveAction: false,
  8. AdaptiveStyle style: AdaptiveStyle.adaptive,
  9. VerticalDirection actionsOverflowDirection: VerticalDirection.up}
)

Implementation

Future<List<String>> showTextInputDialog({
  @required BuildContext context,
  @required List<DialogTextField> textFields,
  String title,
  String message,
  String okLabel,
  String cancelLabel,
  bool isDestructiveAction = false,
  AdaptiveStyle style = AdaptiveStyle.adaptive,
  VerticalDirection actionsOverflowDirection = VerticalDirection.up,
}) {
  final theme = Theme.of(context);
  return style.isCupertinoStyle(theme)
      ? showCupertinoDialog(
          context: context,
          builder: (context) => CupertinoTextInputDialog(
            textFields: textFields,
            title: title,
            message: message,
            okLabel: okLabel,
            cancelLabel: cancelLabel,
            isDestructiveAction: isDestructiveAction,
            style: style,
          ),
        )
      : showDialog(
          context: context,
          builder: (context) => MaterialTextInputDialog(
            textFields: textFields,
            title: title,
            message: message,
            okLabel: okLabel,
            cancelLabel: cancelLabel,
            isDestructiveAction: isDestructiveAction,
            style: style,
            actionsOverflowDirection: actionsOverflowDirection,
          ),
        );
}