InputDecoration constructor

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