InputDecoration constructor

const InputDecoration(
  1. {Widget? icon,
  2. Color? iconColor,
  3. Widget? label,
  4. String? labelText,
  5. TextStyle? labelStyle,
  6. TextStyle? floatingLabelStyle,
  7. String? helperText,
  8. TextStyle? helperStyle,
  9. int? helperMaxLines,
  10. String? hintText,
  11. TextStyle? hintStyle,
  12. TextDirection? hintTextDirection,
  13. int? hintMaxLines,
  14. Duration? hintFadeDuration,
  15. Widget? error,
  16. String? errorText,
  17. TextStyle? errorStyle,
  18. int? errorMaxLines,
  19. FloatingLabelBehavior? floatingLabelBehavior,
  20. FloatingLabelAlignment? floatingLabelAlignment,
  21. bool? isCollapsed,
  22. bool? isDense,
  23. EdgeInsetsGeometry? contentPadding,
  24. Widget? prefixIcon,
  25. BoxConstraints? prefixIconConstraints,
  26. Widget? prefix,
  27. String? prefixText,
  28. TextStyle? prefixStyle,
  29. Color? prefixIconColor,
  30. Widget? suffixIcon,
  31. Widget? suffix,
  32. String? suffixText,
  33. TextStyle? suffixStyle,
  34. Color? suffixIconColor,
  35. BoxConstraints? suffixIconConstraints,
  36. Widget? counter,
  37. String? counterText,
  38. TextStyle? counterStyle,
  39. bool? filled,
  40. Color? fillColor,
  41. Color? focusColor,
  42. Color? hoverColor,
  43. InputBorder? errorBorder,
  44. InputBorder? focusedBorder,
  45. InputBorder? focusedErrorBorder,
  46. InputBorder? disabledBorder,
  47. InputBorder? enabledBorder,
  48. InputBorder? border,
  49. bool enabled = true,
  50. String? semanticCounterText,
  51. bool? alignLabelWithHint,
  52. BoxConstraints? constraints}
)

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.

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.iconColor,
  this.label,
  this.labelText,
  this.labelStyle,
  this.floatingLabelStyle,
  this.helperText,
  this.helperStyle,
  this.helperMaxLines,
  this.hintText,
  this.hintStyle,
  this.hintTextDirection,
  this.hintMaxLines,
  this.hintFadeDuration,
  this.error,
  this.errorText,
  this.errorStyle,
  this.errorMaxLines,
  this.floatingLabelBehavior,
  this.floatingLabelAlignment,
  this.isCollapsed,
  this.isDense,
  this.contentPadding,
  this.prefixIcon,
  this.prefixIconConstraints,
  this.prefix,
  this.prefixText,
  this.prefixStyle,
  this.prefixIconColor,
  this.suffixIcon,
  this.suffix,
  this.suffixText,
  this.suffixStyle,
  this.suffixIconColor,
  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,
  this.constraints,
}) : assert(!(label != null && labelText != null), 'Declaring both label and labelText is not supported.'),
     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.'),
     assert(!(error != null && errorText != null), 'Declaring both error and errorText is not supported.');