EditableText constructor

EditableText({Key key, @required TextEditingController controller, @required FocusNode focusNode, bool obscureText: false, bool autocorrect: true, @required TextStyle style, @required Color cursorColor, TextAlign textAlign: TextAlign.start, TextDirection textDirection, Locale locale, double textScaleFactor, int maxLines: 1, bool autofocus: false, Color selectionColor, TextSelectionControls selectionControls, TextInputType keyboardType, TextInputAction textInputAction, TextCapitalization textCapitalization: TextCapitalization.none, ValueChanged<String> onChanged, VoidCallback onEditingComplete, ValueChanged<String> onSubmitted, SelectionChangedCallback onSelectionChanged, List<TextInputFormatter> inputFormatters, bool rendererIgnoresPointer: false, double cursorWidth: 2.0, Radius cursorRadius, EdgeInsets scrollPadding: const EdgeInsets.all(20.0), Brightness keyboardAppearance: Brightness.light, bool enableInteractiveSelection: true })

Creates a basic text input control.

The maxLines property can be set to null to remove the restriction on the number of lines. By default, it is one, meaning this is a single-line text field. maxLines must be null or greater than zero.

If keyboardType is not set or is null, it will default to TextInputType.text unless maxLines is greater than one, when it will default to TextInputType.multiline.

The controller, focusNode, style, cursorColor, textAlign, rendererIgnoresPointer, and enableInteractiveSelection arguments must not be null.

Implementation

EditableText({
  Key key,
  @required this.controller,
  @required this.focusNode,
  this.obscureText = false,
  this.autocorrect = true,
  @required this.style,
  @required this.cursorColor,
  this.textAlign = TextAlign.start,
  this.textDirection,
  this.locale,
  this.textScaleFactor,
  this.maxLines = 1,
  this.autofocus = false,
  this.selectionColor,
  this.selectionControls,
  TextInputType keyboardType,
  this.textInputAction,
  this.textCapitalization = TextCapitalization.none,
  this.onChanged,
  this.onEditingComplete,
  this.onSubmitted,
  this.onSelectionChanged,
  List<TextInputFormatter> inputFormatters,
  this.rendererIgnoresPointer = false,
  this.cursorWidth = 2.0,
  this.cursorRadius,
  this.scrollPadding = const EdgeInsets.all(20.0),
  this.keyboardAppearance = Brightness.light,
  this.enableInteractiveSelection = true,
}) : assert(controller != null),
     assert(focusNode != null),
     assert(obscureText != null),
     assert(autocorrect != null),
     assert(style != null),
     assert(cursorColor != null),
     assert(textAlign != null),
     assert(maxLines == null || maxLines > 0),
     assert(autofocus != null),
     assert(rendererIgnoresPointer != null),
     assert(scrollPadding != null),
     assert(enableInteractiveSelection != null),
     keyboardType = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline),
     inputFormatters = maxLines == 1
         ? (
             <TextInputFormatter>[BlacklistingTextInputFormatter.singleLineFormatter]
               ..addAll(inputFormatters ?? const Iterable<TextInputFormatter>.empty())
           )
         : inputFormatters,
     super(key: key);