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. bool barrierDismissible = true,
  9. AdaptiveStyle style = AdaptiveStyle.adaptive,
  10. bool useRootNavigator = true,
  11. VerticalDirection actionsOverflowDirection = VerticalDirection.up,
  12. bool fullyCapitalizedForMaterial = true,
})

Implementation

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