InputKeyboard<T> constructor

InputKeyboard<T>(
  1. {Key key,
  2. bool autocorrect: true,
  3. bool autofocus: false,
  4. bool autosave,
  5. bool autovalidate,
  6. InputCounterWidgetBuilder buildCounter,
  7. TextEditingController controller,
  8. Color cursorColor,
  9. Radius cursorRadius,
  10. double cursorWidth: 2.0,
  11. InputDecoration decoration,
  12. bool enabled,
  13. bool enableInteractiveSelection: true,
  14. bool enableSuggestions: true,
  15. bool expands: false,
  16. FocusNode focusNode,
  17. T initialValue,
  18. List<TextInputFormatter> inputFormatters,
  19. Brightness keyboardAppearance,
  20. TextInputType keyboardType,
  21. int maxLength,
  22. bool maxLengthEnforced: true,
  23. int maxLines: 1,
  24. int minLines,
  25. bool obscureText: false,
  26. ValueChanged<T> onChanged,
  27. VoidCallback onEditingComplete,
  28. ValueChanged<String> onFieldSubmitted,
  29. InputFieldSetter<T> onSaved,
  30. GestureTapCallback onTap,
  31. String path,
  32. bool showCursor,
  33. EdgeInsets scrollPadding: const EdgeInsets.all(20.0),
  34. StrutStyle strutStyle,
  35. TextStyle style,
  36. TextAlign textAlign: TextAlign.start,
  37. TextAlignVertical textAlignVertical,
  38. TextCapitalization textCapitalization: TextCapitalization.none,
  39. TextDirection textDirection,
  40. TextInputAction textInputAction,
  41. ToolbarOptions toolbarOptions,
  42. List<InputValidator> validators,
  43. bool wantKeepAlive: false}
)

Creates an InputField that contains a TextField.

When a controller is specified, initialValue must be null (the default). If controller is null, then a TextEditingController will be constructed automatically and its text will be initialized to initialValue or the empty string.

For documentation about the various parameters, see the TextField class and new TextField, the constructor.

Implementation

InputKeyboard({
  Key key,
  this.autocorrect = true,
  this.autofocus = false,
  bool autosave,
  bool autovalidate,
  this.buildCounter,
  this.controller,
  this.cursorColor,
  this.cursorRadius,
  this.cursorWidth = 2.0,
  InputDecoration decoration,
  bool enabled,
  this.enableInteractiveSelection = true,
  this.enableSuggestions = true,
  this.expands = false,
  this.focusNode,
  T initialValue,
  this.inputFormatters,
  this.keyboardAppearance,
  this.keyboardType,
  this.maxLength,
  this.maxLengthEnforced = true,
  this.maxLines = 1,
  this.minLines,
  this.obscureText = false,
  ValueChanged<T> onChanged,
  this.onEditingComplete,
  this.onFieldSubmitted,
  InputFieldSetter<T> onSaved,
  this.onTap,
  String path,
  this.showCursor,
  this.scrollPadding = const EdgeInsets.all(20.0),
  this.strutStyle,
  this.style,
  this.textAlign = TextAlign.start,
  this.textAlignVertical,
  this.textCapitalization = TextCapitalization.none,
  this.textDirection,
  this.textInputAction,
  this.toolbarOptions,
  List<InputValidator> validators,
  this.wantKeepAlive = false,
})  : assert(
        T == String || T == int || T == double,
        'Generic must be one of String, int or double',
      ),
      assert(autocorrect != null),
      assert(autofocus != null),
      assert(enableInteractiveSelection != null),
      assert(enableSuggestions != null),
      assert(initialValue == null || controller == null),
      assert(maxLength == null || maxLength > 0),
      assert(maxLengthEnforced != null),
      assert(maxLines == null || maxLines > 0),
      assert(minLines == null || minLines > 0),
      assert(obscureText != null),
      assert(textAlign != null),
      assert(scrollPadding != null),
      assert(
        (maxLines == null) || (minLines == null) || (maxLines >= minLines),
        'minLines can\'t be greater than maxLines',
      ),
      assert(expands != null),
      assert(
        !expands || (maxLines == null && minLines == null),
        'minLines and maxLines must be null when expands is true.',
      ),
      assert(!obscureText || maxLines == 1,
          'Obscured fields cannot be multiline.'),
      super(
        key: key,
        autosave: autosave,
        autovalidate: autovalidate,
        decoration: decoration,
        enabled: enabled,
        initialValue: controller != null ? controller.text : initialValue,
        onChanged: onChanged,
        onSaved: onSaved,
        path: path,
        validators: validators,
      );