CustomInput constructor
const
CustomInput({
- Key? key,
- String? initialValue,
- Widget? placeholder,
- TextEditingController? controller,
- FocusNode? focusNode,
- BoxDecoration? decoration,
- UndoHistoryController? undoController,
- TextInputType? keyboardType,
- TextInputAction? textInputAction,
- TextCapitalization textCapitalization = TextCapitalization.none,
- TextStyle? style,
- StrutStyle? strutStyle,
- TextAlign textAlign = TextAlign.start,
- TextDirection? textDirection,
- bool readOnly = false,
- bool? showCursor,
- bool autofocus = false,
- String obscuringCharacter = '•',
- bool obscureText = false,
- bool autocorrect = true,
- SmartDashesType? smartDashesType,
- SmartQuotesType? smartQuotesType,
- bool enableSuggestions = true,
- int? maxLines = 1,
- int? minLines,
- bool expands = false,
- int? maxLength,
- MaxLengthEnforcement? maxLengthEnforcement,
- ValueChanged<
String> ? onChanged, - VoidCallback? onEditingComplete,
- ValueChanged<
String> ? onSubmitted, - AppPrivateCommandCallback? onAppPrivateCommand,
- List<
TextInputFormatter> ? inputFormatters, - bool enabled = true,
- double? cursorWidth,
- double? cursorHeight,
- Radius? cursorRadius,
- bool? cursorOpacityAnimates,
- Color? cursorColor,
- BoxHeightStyle selectionHeightStyle = ui.BoxHeightStyle.tight,
- BoxWidthStyle selectionWidthStyle = ui.BoxWidthStyle.tight,
- Brightness? keyboardAppearance,
- EdgeInsets scrollPadding = const EdgeInsets.all(20),
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
- bool? enableInteractiveSelection,
- TextSelectionControls? selectionControls,
- GestureTapCallback? onPressed,
- bool onPressedAlwaysCalled = false,
- TapRegionCallback? onPressedOutside,
- MouseCursor? mouseCursor,
- ScrollController? scrollController,
- ScrollPhysics? scrollPhysics,
- Iterable<
String> ? autofillHints = const <String>[], - ContentInsertionConfiguration? contentInsertionConfiguration,
- Clip clipBehavior = Clip.hardEdge,
- String? restorationId,
- bool scribbleEnabled = true,
- bool enableIMEPersonalizedLearning = true,
- EditableTextContextMenuBuilder? contextMenuBuilder,
- SpellCheckConfiguration? spellCheckConfiguration,
- TextMagnifierConfiguration magnifierConfiguration = TextMagnifierConfiguration.disabled,
- Color? selectionColor,
- EdgeInsetsGeometry? padding,
- Widget? leading,
- Widget? trailing,
- MainAxisAlignment? mainAxisAlignment,
- CrossAxisAlignment? crossAxisAlignment,
- TextStyle? placeholderStyle,
- AlignmentGeometry? alignment,
- AlignmentGeometry? placeholderAlignment,
- EdgeInsetsGeometry? inputPadding,
- double? gap,
- BoxConstraints? constraints,
- bool stylusHandwritingEnabled = EditableText.defaultStylusHandwritingEnabled,
- Object? groupId,
- EdgeInsetsGeometry? scrollbarPadding,
- WidgetBuilder? keyboardToolbarBuilder,
- Widget? top,
- Widget? bottom,
- ValueChanged<
int> ? onLineCountChange, - Size? editableTextSize,
- double? verticalGap,
- 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',
);