CustomInput constructor

const CustomInput({
  1. Key? key,
  2. String? initialValue,
  3. Widget? placeholder,
  4. TextEditingController? controller,
  5. FocusNode? focusNode,
  6. BoxDecoration? decoration,
  7. UndoHistoryController? undoController,
  8. TextInputType? keyboardType,
  9. TextInputAction? textInputAction,
  10. TextCapitalization textCapitalization = TextCapitalization.none,
  11. TextStyle? style,
  12. StrutStyle? strutStyle,
  13. TextAlign textAlign = TextAlign.start,
  14. TextDirection? textDirection,
  15. bool readOnly = false,
  16. bool? showCursor,
  17. bool autofocus = false,
  18. String obscuringCharacter = '•',
  19. bool obscureText = false,
  20. bool autocorrect = true,
  21. SmartDashesType? smartDashesType,
  22. SmartQuotesType? smartQuotesType,
  23. bool enableSuggestions = true,
  24. int? maxLines = 1,
  25. int? minLines,
  26. bool expands = false,
  27. int? maxLength,
  28. MaxLengthEnforcement? maxLengthEnforcement,
  29. ValueChanged<String>? onChanged,
  30. VoidCallback? onEditingComplete,
  31. ValueChanged<String>? onSubmitted,
  32. AppPrivateCommandCallback? onAppPrivateCommand,
  33. List<TextInputFormatter>? inputFormatters,
  34. bool enabled = true,
  35. double? cursorWidth,
  36. double? cursorHeight,
  37. Radius? cursorRadius,
  38. bool? cursorOpacityAnimates,
  39. Color? cursorColor,
  40. BoxHeightStyle selectionHeightStyle = ui.BoxHeightStyle.tight,
  41. BoxWidthStyle selectionWidthStyle = ui.BoxWidthStyle.tight,
  42. Brightness? keyboardAppearance,
  43. EdgeInsets scrollPadding = const EdgeInsets.all(20),
  44. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  45. bool? enableInteractiveSelection,
  46. TextSelectionControls? selectionControls,
  47. GestureTapCallback? onPressed,
  48. bool onPressedAlwaysCalled = false,
  49. TapRegionCallback? onPressedOutside,
  50. MouseCursor? mouseCursor,
  51. ScrollController? scrollController,
  52. ScrollPhysics? scrollPhysics,
  53. Iterable<String>? autofillHints = const <String>[],
  54. ContentInsertionConfiguration? contentInsertionConfiguration,
  55. Clip clipBehavior = Clip.hardEdge,
  56. String? restorationId,
  57. bool scribbleEnabled = true,
  58. bool enableIMEPersonalizedLearning = true,
  59. EditableTextContextMenuBuilder? contextMenuBuilder,
  60. SpellCheckConfiguration? spellCheckConfiguration,
  61. TextMagnifierConfiguration magnifierConfiguration = TextMagnifierConfiguration.disabled,
  62. Color? selectionColor,
  63. EdgeInsetsGeometry? padding,
  64. Widget? leading,
  65. Widget? trailing,
  66. MainAxisAlignment? mainAxisAlignment,
  67. CrossAxisAlignment? crossAxisAlignment,
  68. TextStyle? placeholderStyle,
  69. AlignmentGeometry? alignment,
  70. AlignmentGeometry? placeholderAlignment,
  71. EdgeInsetsGeometry? inputPadding,
  72. double? gap,
  73. BoxConstraints? constraints,
  74. bool stylusHandwritingEnabled = EditableText.defaultStylusHandwritingEnabled,
  75. Object? groupId,
  76. EdgeInsetsGeometry? scrollbarPadding,
  77. WidgetBuilder? keyboardToolbarBuilder,
  78. Widget? top,
  79. Widget? bottom,
  80. ValueChanged<int>? onLineCountChange,
  81. Size? editableTextSize,
  82. double? verticalGap,
  83. CustomInputTheme? theme,
})

Creates a CustomInput widget.

Either initialValue or controller must be specified, but not both.

Implementation

const CustomInput({
  super.key,
  this.initialValue,
  this.placeholder,
  this.controller,
  this.focusNode,
  this.decoration,
  this.undoController,
  TextInputType? keyboardType,
  this.textInputAction,
  this.textCapitalization = TextCapitalization.none,
  this.style,
  this.strutStyle,
  this.textAlign = TextAlign.start,
  this.textDirection,
  this.readOnly = false,
  this.showCursor,
  this.autofocus = false,
  this.obscuringCharacter = '•',
  this.obscureText = false,
  this.autocorrect = true,
  SmartDashesType? smartDashesType,
  SmartQuotesType? smartQuotesType,
  this.enableSuggestions = true,
  this.maxLines = 1,
  this.minLines,
  this.expands = false,
  this.maxLength,
  this.maxLengthEnforcement,
  this.onChanged,
  this.onEditingComplete,
  this.onSubmitted,
  this.onAppPrivateCommand,
  this.inputFormatters,
  this.enabled = true,
  this.cursorWidth,
  this.cursorHeight,
  this.cursorRadius,
  this.cursorOpacityAnimates,
  this.cursorColor,
  this.selectionHeightStyle = ui.BoxHeightStyle.tight,
  this.selectionWidthStyle = ui.BoxWidthStyle.tight,
  this.keyboardAppearance,
  this.scrollPadding = const EdgeInsets.all(20),
  this.dragStartBehavior = DragStartBehavior.start,
  bool? enableInteractiveSelection,
  this.selectionControls,
  this.onPressed,
  this.onPressedAlwaysCalled = false,
  this.onPressedOutside,
  this.mouseCursor,
  this.scrollController,
  this.scrollPhysics,
  this.autofillHints = const <String>[],
  this.contentInsertionConfiguration,
  this.clipBehavior = Clip.hardEdge,
  this.restorationId,
  this.scribbleEnabled = true,
  this.enableIMEPersonalizedLearning = true,
  this.contextMenuBuilder,
  this.spellCheckConfiguration,
  this.magnifierConfiguration = TextMagnifierConfiguration.disabled,
  this.selectionColor,
  this.padding,
  this.leading,
  this.trailing,
  this.mainAxisAlignment,
  this.crossAxisAlignment,
  this.placeholderStyle,
  this.alignment,
  this.placeholderAlignment,
  this.inputPadding,
  this.gap,
  this.constraints,
  this.stylusHandwritingEnabled =
      EditableText.defaultStylusHandwritingEnabled,
  this.groupId,
  this.scrollbarPadding,
  this.keyboardToolbarBuilder,
  this.top,
  this.bottom,
  this.onLineCountChange,
  this.editableTextSize,
  this.verticalGap,
  this.theme,
}) : smartDashesType =
         smartDashesType ??
         (obscureText ? SmartDashesType.disabled : SmartDashesType.enabled),
     smartQuotesType =
         smartQuotesType ??
         (obscureText ? SmartQuotesType.disabled : SmartQuotesType.enabled),
     keyboardType =
         keyboardType ??
         (maxLines == 1 ? TextInputType.text : TextInputType.multiline),
     enableInteractiveSelection =
         enableInteractiveSelection ?? (!readOnly || !obscureText),
     assert(
       initialValue == null || controller == null,
       'Either initialValue or controller must be specified',
     );