InputDecoration constructor

const InputDecoration(
  1. {Widget icon,
  2. String labelText,
  3. TextStyle labelStyle,
  4. String helperText,
  5. TextStyle helperStyle,
  6. int helperMaxLines,
  7. String hintText,
  8. TextStyle hintStyle,
  9. int hintMaxLines,
  10. String errorText,
  11. TextStyle errorStyle,
  12. int errorMaxLines,
  13. @Deprecated('Use floatingLabelBehavior instead. ' 'This feature was deprecated after v1.13.2.') bool hasFloatingPlaceholder: true,
  14. FloatingLabelBehavior floatingLabelBehavior: FloatingLabelBehavior.auto,
  15. bool isCollapsed: false,
  16. bool isDense,
  17. EdgeInsetsGeometry contentPadding,
  18. Widget prefixIcon,
  19. BoxConstraints prefixIconConstraints,
  20. Widget prefix,
  21. String prefixText,
  22. TextStyle prefixStyle,
  23. Widget suffixIcon,
  24. Widget suffix,
  25. String suffixText,
  26. TextStyle suffixStyle,
  27. BoxConstraints suffixIconConstraints,
  28. Widget counter,
  29. String counterText,
  30. TextStyle counterStyle,
  31. bool filled,
  32. Color fillColor,
  33. Color focusColor,
  34. Color hoverColor,
  35. InputBorder errorBorder,
  36. InputBorder focusedBorder,
  37. InputBorder focusedErrorBorder,
  38. InputBorder disabledBorder,
  39. InputBorder enabledBorder,
  40. InputBorder border,
  41. bool enabled: true,
  42. String semanticCounterText,
  43. bool alignLabelWithHint}
)

Creates a bundle of the border, labels, icons, and styles used to decorate a Material Design text field.

Unless specified by ThemeData.inputDecorationTheme, InputDecorator defaults isDense to false and filled to false. The default border is an instance of UnderlineInputBorder. If border is InputBorder.none then no border is drawn.

The enabled argument must not be null.

Only one of prefix and prefixText can be specified.

Similarly, only one of suffix and suffixText can be specified.

Implementation

const InputDecoration({
  this.icon,
  this.labelText,
  this.labelStyle,
  this.helperText,
  this.helperStyle,
  this.helperMaxLines,
  this.hintText,
  this.hintStyle,
  this.hintMaxLines,
  this.errorText,
  this.errorStyle,
  this.errorMaxLines,
  @Deprecated(
    'Use floatingLabelBehavior instead. '
    'This feature was deprecated after v1.13.2.'
  )
  this.hasFloatingPlaceholder = true,
  this.floatingLabelBehavior = FloatingLabelBehavior.auto,
  this.isCollapsed = false,
  this.isDense,
  this.contentPadding,
  this.prefixIcon,
  this.prefixIconConstraints,
  this.prefix,
  this.prefixText,
  this.prefixStyle,
  this.suffixIcon,
  this.suffix,
  this.suffixText,
  this.suffixStyle,
  this.suffixIconConstraints,
  this.counter,
  this.counterText,
  this.counterStyle,
  this.filled,
  this.fillColor,
  this.focusColor,
  this.hoverColor,
  this.errorBorder,
  this.focusedBorder,
  this.focusedErrorBorder,
  this.disabledBorder,
  this.enabledBorder,
  this.border,
  this.enabled = true,
  this.semanticCounterText,
  this.alignLabelWithHint,
}) : assert(enabled != null),
     assert(!(prefix != null && prefixText != null), 'Declaring both prefix and prefixText is not supported.'),
     assert(!(suffix != null && suffixText != null), 'Declaring both suffix and suffixText is not supported.');