AutoSizeTextField constructor
const
AutoSizeTextField({
- Key? key,
- bool fullwidth = true,
- Key? textFieldKey,
- TextStyle? style,
- StrutStyle? strutStyle,
- double minFontSize = 12,
- double maxFontSize = double.infinity,
- double stepGranularity = 1,
- List<
double> ? presetFontSizes, - TextAlign textAlign = TextAlign.start,
- TextDirection? textDirection,
- Locale? locale,
- bool wrapWords = true,
- Widget? overflowReplacement,
- String? semanticsLabel,
- TextEditingController? controller,
- FocusNode? focusNode,
- InputDecoration decoration = const InputDecoration(),
- TextInputType? keyboardType,
- TextInputAction? textInputAction,
- TextCapitalization textCapitalization = TextCapitalization.none,
- TextAlignVertical? textAlignVertical,
- Iterable<
String> ? autofillHints, - bool autofocus = false,
- bool obscureText = false,
- bool autocorrect = true,
- SmartDashesType? smartDashesType,
- SmartQuotesType? smartQuotesType,
- bool enableSuggestions = true,
- int? maxLines = 1,
- bool expands = false,
- bool readOnly = false,
- EditableTextContextMenuBuilder? contextMenuBuilder = _defaultContextMenuBuilder,
- bool? showCursor,
- int? maxLength,
- MaxLengthEnforcement? maxLengthEnforcement,
- ValueChanged<
String> ? onChanged, - VoidCallback? onEditingComplete,
- ValueChanged<
String> ? onSubmitted, - List<
TextInputFormatter> ? inputFormatters, - bool? enabled,
- double? cursorHeight,
- double cursorWidth = 2.0,
- Radius? cursorRadius,
- Color? cursorColor,
- BoxHeightStyle selectionHeightStyle = ui.BoxHeightStyle.tight,
- BoxWidthStyle selectionWidthStyle = ui.BoxWidthStyle.tight,
- Brightness? keyboardAppearance,
- EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
- bool enableInteractiveSelection = true,
- GestureTapCallback? onTap,
- InputCounterWidgetBuilder? buildCounter,
- ScrollPhysics? scrollPhysics,
- ScrollController? scrollController,
- int? minLines,
- double? minWidth,
- TextSelectionControls? selectionControls,
Creates a AutoSizeTextField widget.
If the style argument is null, the text will use the style from the closest enclosing DefaultTextStyle.
Implementation
const AutoSizeTextField({
Key? key,
this.fullwidth = true,
this.textFieldKey,
this.style,
this.strutStyle,
this.minFontSize = 12,
this.maxFontSize = double.infinity,
this.stepGranularity = 1,
this.presetFontSizes,
this.textAlign = TextAlign.start,
this.textDirection,
this.locale,
this.wrapWords = true,
this.overflowReplacement,
this.semanticsLabel,
this.controller,
this.focusNode,
this.decoration = const InputDecoration(),
TextInputType? keyboardType,
this.textInputAction,
this.textCapitalization = TextCapitalization.none,
this.textAlignVertical,
this.autofillHints,
this.autofocus = false,
this.obscureText = false,
this.autocorrect = true,
SmartDashesType? smartDashesType,
SmartQuotesType? smartQuotesType,
this.enableSuggestions = true,
this.maxLines = 1,
this.expands = false,
this.readOnly = false,
this.contextMenuBuilder = _defaultContextMenuBuilder,
this.showCursor,
this.maxLength,
this.maxLengthEnforcement,
this.onChanged,
this.onEditingComplete,
this.onSubmitted,
this.inputFormatters,
this.enabled,
this.cursorHeight,
this.cursorWidth = 2.0,
this.cursorRadius,
this.cursorColor,
this.selectionHeightStyle = ui.BoxHeightStyle.tight,
this.selectionWidthStyle = ui.BoxWidthStyle.tight,
this.keyboardAppearance,
this.scrollPadding = const EdgeInsets.all(20.0),
this.dragStartBehavior = DragStartBehavior.start,
this.enableInteractiveSelection = true,
this.onTap,
this.buildCounter,
this.scrollPhysics,
this.scrollController,
this.minLines,
this.minWidth,
this.selectionControls,
}) : textSpan = null,
smartDashesType = smartDashesType ??
(obscureText ? SmartDashesType.disabled : SmartDashesType.enabled),
smartQuotesType = smartQuotesType ??
(obscureText ? SmartQuotesType.disabled : SmartQuotesType.enabled),
assert(minLines == null || minLines > 0),
assert((minWidth == null && fullwidth == true) || fullwidth == false),
assert(!obscureText || maxLines == 1,
'Obscured fields cannot be multiline.'),
assert(maxLength == null ||
maxLength == TextField.noMaxLength ||
maxLength > 0),
keyboardType = keyboardType ??
(maxLines == 1 ? TextInputType.text : TextInputType.multiline),
super(key: key);