AutoSizeTextField constructor

const AutoSizeTextField({
  1. Key? key,
  2. bool fullwidth = true,
  3. Key? textFieldKey,
  4. TextStyle? style,
  5. StrutStyle? strutStyle,
  6. double minFontSize = 12,
  7. double maxFontSize = double.infinity,
  8. double stepGranularity = 1,
  9. List<double>? presetFontSizes,
  10. TextAlign textAlign = TextAlign.start,
  11. TextDirection? textDirection,
  12. Locale? locale,
  13. bool wrapWords = true,
  14. Widget? overflowReplacement,
  15. String? semanticsLabel,
  16. TextEditingController? controller,
  17. FocusNode? focusNode,
  18. InputDecoration decoration = const InputDecoration(),
  19. TextInputType? keyboardType,
  20. TextInputAction? textInputAction,
  21. TextCapitalization textCapitalization = TextCapitalization.none,
  22. TextAlignVertical? textAlignVertical,
  23. Iterable<String>? autofillHints,
  24. bool autofocus = false,
  25. bool obscureText = false,
  26. bool autocorrect = true,
  27. SmartDashesType? smartDashesType,
  28. SmartQuotesType? smartQuotesType,
  29. bool enableSuggestions = true,
  30. int? maxLines = 1,
  31. bool expands = false,
  32. bool readOnly = false,
  33. EditableTextContextMenuBuilder? contextMenuBuilder = _defaultContextMenuBuilder,
  34. bool? showCursor,
  35. int? maxLength,
  36. MaxLengthEnforcement? maxLengthEnforcement,
  37. ValueChanged<String>? onChanged,
  38. VoidCallback? onEditingComplete,
  39. ValueChanged<String>? onSubmitted,
  40. List<TextInputFormatter>? inputFormatters,
  41. bool? enabled,
  42. double? cursorHeight,
  43. double cursorWidth = 2.0,
  44. Radius? cursorRadius,
  45. Color? cursorColor,
  46. BoxHeightStyle selectionHeightStyle = ui.BoxHeightStyle.tight,
  47. BoxWidthStyle selectionWidthStyle = ui.BoxWidthStyle.tight,
  48. Brightness? keyboardAppearance,
  49. EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
  50. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  51. bool enableInteractiveSelection = true,
  52. GestureTapCallback? onTap,
  53. InputCounterWidgetBuilder? buildCounter,
  54. ScrollPhysics? scrollPhysics,
  55. ScrollController? scrollController,
  56. int? minLines,
  57. double? minWidth,
  58. 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);