InputDecoration class

The border, labels, icons, and styles used to decorate a Material Design text field.

The TextField and InputDecorator classes use InputDecoration objects to describe their decoration. (In fact, this class is merely the configuration of an InputDecorator, which does all the heavy lifting.)

See also:

Annotations
  • @immutable

Constructors

InputDecoration({Widget icon, String labelText, TextStyle labelStyle, String helperText, TextStyle helperStyle, String hintText, TextStyle hintStyle, String errorText, TextStyle errorStyle, bool isDense, EdgeInsets contentPadding, Widget prefixIcon, String prefixText, TextStyle prefixStyle, String suffixText, Widget suffixIcon, TextStyle suffixStyle, String counterText, TextStyle counterStyle, bool filled, Color fillColor, InputBorder border, bool enabled: true })
Creates a bundle of the border, labels, icons, and styles used to decorate a Material Design text field. [...]
const
InputDecoration.collapsed({@required String hintText, TextStyle hintStyle, bool filled: false, Color fillColor, InputBorder border: InputBorder.none, bool enabled: true })
Defines an InputDecorator that is the same size as the input field. [...]
const

Properties

border InputBorder
The border to draw around the decoration's container. [...]
final
contentPadding EdgeInsets
The padding for the input decoration's container. [...]
final
counterStyle TextStyle
The style to use for the counterText. [...]
final
counterText String
Optional text to place below the line as a character count. [...]
final
enabled bool
If false helperText,errorText, and counterText are not displayed, and the opacity of the remaining visual elements is reduced. [...]
final
errorStyle TextStyle
The style to use for the errorText. [...]
final
errorText String
Text that appears below the input child and the border. [...]
final
fillColor Color
The color to fill the decoration's container with, if filled is true. [...]
final
filled bool
If true the decoration's container is filled with fillColor. [...]
final
hashCode int
The hash code for this object. [...]
read-only
helperStyle TextStyle
The style to use for the helperText.
final
helperText String
Text that provides context about the input child's value, such as how the value will be used. [...]
final
hintStyle TextStyle
The style to use for the hintText. [...]
final
hintText String
Text that suggests what sort of input the field accepts. [...]
final
icon Widget
An icon to show before the input field and outside of the decoration's container. [...]
final
isCollapsed bool
Whether the decoration is the same size as the input field. [...]
final
isDense bool
Whether the input child is part of a dense form (i.e., uses less vertical space). [...]
final
labelStyle TextStyle
The style to use for the labelText when the label is above (i.e., vertically adjacent to) the input field. [...]
final
labelText String
Text that describes the input field. [...]
final
prefixIcon Widget
An icon that that appears before the prefixText and the input and within the decoration's container. [...]
final
prefixStyle TextStyle
The style to use for the prefixText. [...]
final
prefixText String
Optional text prefix to place on the line before the input. [...]
final
suffixIcon Widget
An icon that that appears after the input and suffixText and within the decoration's container. [...]
final
suffixStyle TextStyle
The style to use for the suffixText. [...]
final
suffixText String
Optional text suffix to place on the line after the input. [...]
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

applyDefaults(InputDecorationTheme theme) InputDecoration
Used by widgets like TextField and InputDecorator to create a new InputDecoration with default values taken from the theme. [...]
copyWith({Widget icon, String labelText, TextStyle labelStyle, String helperText, TextStyle helperStyle, String hintText, TextStyle hintStyle, String errorText, TextStyle errorStyle, bool isDense, EdgeInsets contentPadding, Widget prefixIcon, String prefixText, TextStyle prefixStyle, Widget suffixIcon, String suffixText, TextStyle suffixStyle, String counterText, TextStyle counterStyle, bool filled, Color fillColor, InputBorder border, bool enabled }) InputDecoration
Creates a copy of this input decoration with the given fields replaced by the new values. [...]
toString() String
Returns a string representation of this object.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]