buildCupertinoTextField function

CupertinoTextField buildCupertinoTextField({
  1. int? maxLines = 1,
  2. BoxDecoration? decoration,
  3. EdgeInsetsGeometry padding = const EdgeInsets.all(6),
  4. String? placeholder,
  5. TextStyle placeholderStyle = const TextStyle(fontWeight: FontWeight.w400, color: CupertinoColors.placeholderText),
  6. Widget? prefix,
  7. OverlayVisibilityMode prefixMode = OverlayVisibilityMode.always,
  8. Widget? suffix,
  9. OverlayVisibilityMode suffixMode = OverlayVisibilityMode.always,
  10. OverlayVisibilityMode clearButtonMode = OverlayVisibilityMode.never,
  11. TextInputType? keyboardType,
  12. TextInputAction? textInputAction,
  13. TextCapitalization textCapitalization = TextCapitalization.none,
  14. TextStyle? style,
  15. StrutStyle? strutStyle,
  16. TextAlign textAlign = TextAlign.start,
  17. ToolbarOptions? toolbarOptions,
  18. TextAlignVertical? textAlignVertical,
  19. bool? showCursor,
  20. bool autofocus = false,
  21. String obscuringCharacter = '•',
  22. bool obscureText = false,
  23. bool autocorrect = true,
  24. SmartDashesType? smartDashesType,
  25. SmartQuotesType? smartQuotesType,
  26. bool enableSuggestions = true,
  27. int? minLines,
  28. bool expands = false,
  29. int? maxLength,
  30. MaxLengthEnforcement? maxLengthEnforcement,
  31. VoidCallback? onEditingComplete,
  32. ValueChanged<String>? onSubmitted,
  33. bool? enabled,
  34. double cursorWidth = 2.0,
  35. double? cursorHeight,
  36. Radius cursorRadius = const Radius.circular(2.0),
  37. Color? cursorColor,
  38. BoxHeightStyle selectionHeightStyle = BoxHeightStyle.tight,
  39. BoxWidthStyle selectionWidthStyle = BoxWidthStyle.tight,
  40. Brightness? keyboardAppearance,
  41. EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
  42. bool enableInteractiveSelection = true,
  43. TextSelectionControls? selectionControls,
  44. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  45. ScrollController? scrollController,
  46. ScrollPhysics? scrollPhysics,
  47. Iterable<String>? autofillHints,
  48. bool borderless = false,
  49. FocusNode? focusNode,
  50. TextEditingController? textEditingController,
  51. bool readOnly = false,
  52. GestureTapCallback? onTap,
  53. List<TextInputFormatter>? inputFormatters,
  54. ValueChanged<String>? onChanged,
  55. bool enableIMEPersonalizedLearning = true,
})

Implementation

CupertinoTextField buildCupertinoTextField({
  int? maxLines = 1,
  BoxDecoration? decoration,
  EdgeInsetsGeometry padding = const EdgeInsets.all(6),
  String? placeholder,
  TextStyle placeholderStyle = const TextStyle(
    fontWeight: FontWeight.w400,
    color: CupertinoColors.placeholderText,
  ),
  Widget? prefix,
  OverlayVisibilityMode prefixMode = OverlayVisibilityMode.always,
  Widget? suffix,
  OverlayVisibilityMode suffixMode = OverlayVisibilityMode.always,
  OverlayVisibilityMode clearButtonMode = OverlayVisibilityMode.never,
  TextInputType? keyboardType,
  TextInputAction? textInputAction,
  TextCapitalization textCapitalization = TextCapitalization.none,
  TextStyle? style,
  StrutStyle? strutStyle,
  TextAlign textAlign = TextAlign.start,
  ToolbarOptions? toolbarOptions,
  TextAlignVertical? textAlignVertical,
  bool? showCursor,
  bool autofocus = false,
  String obscuringCharacter = '•',
  bool obscureText = false,
  bool autocorrect = true,
  SmartDashesType? smartDashesType,
  SmartQuotesType? smartQuotesType,
  bool enableSuggestions = true,
  int? minLines,
  bool expands = false,
  int? maxLength,
  MaxLengthEnforcement? maxLengthEnforcement,
  VoidCallback? onEditingComplete,
  ValueChanged<String>? onSubmitted,
  bool? enabled,
  double cursorWidth = 2.0,
  double? cursorHeight,
  Radius cursorRadius = const Radius.circular(2.0),
  Color? cursorColor,
  BoxHeightStyle selectionHeightStyle = BoxHeightStyle.tight,
  BoxWidthStyle selectionWidthStyle = BoxWidthStyle.tight,
  Brightness? keyboardAppearance,
  EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
  bool enableInteractiveSelection = true,
  TextSelectionControls? selectionControls,
  DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  ScrollController? scrollController,
  ScrollPhysics? scrollPhysics,
  Iterable<String>? autofillHints,
  bool borderless = false,
  FocusNode? focusNode,
  TextEditingController? textEditingController,
  bool readOnly = false,
  GestureTapCallback? onTap,
  List<TextInputFormatter>? inputFormatters,
  ValueChanged<String>? onChanged,
  bool enableIMEPersonalizedLearning = true,
}) {
  if (borderless) {
    return CupertinoTextField.borderless(
      enabled: enabled,
      enableIMEPersonalizedLearning: enableIMEPersonalizedLearning,
      focusNode: focusNode,
      controller: textEditingController,
      decoration: decoration,
      padding: padding,
      placeholder: placeholder,
      placeholderStyle: placeholderStyle,
      prefix: prefix,
      prefixMode: prefixMode,
      suffix: suffix,
      suffixMode: suffixMode,
      clearButtonMode: clearButtonMode,
      keyboardType: keyboardType,
      textInputAction: textInputAction,
      textCapitalization: textCapitalization,
      style: style,
      strutStyle: strutStyle,
      textAlign: textAlign,
      textAlignVertical: textAlignVertical,
      readOnly: readOnly,
      toolbarOptions: toolbarOptions,
      showCursor: showCursor,
      autofocus: autofocus,
      obscuringCharacter: obscuringCharacter,
      obscureText: obscureText,
      autocorrect: autocorrect,
      smartDashesType: smartDashesType,
      smartQuotesType: smartQuotesType,
      enableSuggestions: enableSuggestions,
      maxLines: maxLines,
      minLines: minLines,
      expands: expands,
      maxLength: maxLength,
      maxLengthEnforcement: maxLengthEnforcement,
      onEditingComplete: onEditingComplete,
      onSubmitted: onSubmitted,
      cursorWidth: cursorWidth,
      cursorHeight: cursorHeight,
      cursorRadius: cursorRadius,
      cursorColor: cursorColor,
      selectionHeightStyle: selectionHeightStyle,
      selectionWidthStyle: selectionWidthStyle,
      keyboardAppearance: keyboardAppearance,
      scrollPadding: scrollPadding,
      dragStartBehavior: dragStartBehavior,
      enableInteractiveSelection: enableInteractiveSelection,
      selectionControls: selectionControls,
      onTap: onTap,
      scrollController: scrollController,
      scrollPhysics: scrollPhysics,
      autofillHints: readOnly ? null : autofillHints,
      onChanged: onChanged,
      inputFormatters: inputFormatters,
    );
  }
  return CupertinoTextField(
    enabled: enabled,
    enableIMEPersonalizedLearning: enableIMEPersonalizedLearning,
    focusNode: focusNode,
    controller: textEditingController,
    decoration: decoration,
    padding: padding,
    placeholder: placeholder,
    placeholderStyle: placeholderStyle,
    prefix: prefix,
    prefixMode: prefixMode,
    suffix: suffix,
    suffixMode: suffixMode,
    clearButtonMode: clearButtonMode,
    keyboardType: keyboardType,
    textInputAction: textInputAction,
    textCapitalization: textCapitalization,
    style: style,
    strutStyle: strutStyle,
    textAlign: textAlign,
    textAlignVertical: textAlignVertical,
    readOnly: readOnly,
    toolbarOptions: toolbarOptions,
    showCursor: showCursor,
    autofocus: autofocus,
    obscuringCharacter: obscuringCharacter,
    obscureText: obscureText,
    autocorrect: autocorrect,
    smartDashesType: smartDashesType,
    smartQuotesType: smartQuotesType,
    enableSuggestions: enableSuggestions,
    maxLines: maxLines,
    minLines: minLines,
    expands: expands,
    maxLength: maxLength,
    maxLengthEnforcement: maxLengthEnforcement,
    onEditingComplete: onEditingComplete,
    onSubmitted: onSubmitted,
    cursorWidth: cursorWidth,
    cursorHeight: cursorHeight,
    cursorRadius: cursorRadius,
    cursorColor: cursorColor,
    selectionHeightStyle: selectionHeightStyle,
    selectionWidthStyle: selectionWidthStyle,
    keyboardAppearance: keyboardAppearance,
    scrollPadding: scrollPadding,
    dragStartBehavior: dragStartBehavior,
    enableInteractiveSelection: enableInteractiveSelection,
    selectionControls: selectionControls,
    onTap: onTap,
    scrollController: scrollController,
    scrollPhysics: scrollPhysics,
    autofillHints: readOnly ? null : autofillHints,
    onChanged: onChanged,
    inputFormatters: inputFormatters,
  );
}