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:
- TextField, which is a text input widget that uses an InputDecoration.
- InputDecorator, which is a widget that draws an InputDecoration around an input child widget.
- Decoration and DecoratedBox, for drawing borders and backgrounds around a child widget.
- Annotations
- @immutable
Constructors
- InputDecoration({Widget icon, String labelText, TextStyle labelStyle, String helperText, TextStyle helperStyle, String hintText, TextStyle hintStyle, String errorText, TextStyle errorStyle, int errorMaxLines, bool hasFloatingPlaceholder: true, bool isDense, EdgeInsetsGeometry contentPadding, Widget prefixIcon, Widget prefix, String prefixText, TextStyle prefixStyle, Widget suffixIcon, Widget suffix, String suffixText, TextStyle suffixStyle, String counterText, TextStyle counterStyle, bool filled, Color fillColor, InputBorder errorBorder, InputBorder focusedBorder, InputBorder focusedErrorBorder, InputBorder disabledBorder, InputBorder enabledBorder, InputBorder border, bool enabled: true, String semanticCounterText })
-
Creates a bundle of the border, labels, icons, and styles used to
decorate a Material Design text field. [...]
const
- InputDecoration.collapsed({@required String hintText, bool hasFloatingPlaceholder: true, 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 shape of the border to draw around the decoration's container. [...]
final
- contentPadding → EdgeInsetsGeometry
-
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
- disabledBorder → InputBorder
-
The border to display when the InputDecorator is disabled and is not
showing an error. [...]
final
- enabled → bool
-
If false helperText,errorText, and counterText are not displayed,
and the opacity of the remaining visual elements is reduced. [...]
final
- enabledBorder → InputBorder
-
The border to display when the InputDecorator is enabled and is not
showing an error. [...]
final
- errorBorder → InputBorder
-
The border to display when the InputDecorator does not have the focus and
is showing an error. [...]
final
- errorMaxLines → int
-
The maximum number of lines the errorText can occupy. [...]
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
- focusedBorder → InputBorder
-
The border to display when the InputDecorator has the focus and is not
showing an error. [...]
final
- focusedErrorBorder → InputBorder
-
The border to display when the InputDecorator has the focus and is
showing an error. [...]
final
- hasFloatingPlaceholder → bool
-
Whether the label floats on focus. [...]
final
- hashCode → int
-
The hash code for this object. [...]
read-only, override
- 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
- prefix → Widget
-
Optional widget to place on the line before the input.
Can be used to add some padding to the prefixText or to
add a custom widget in front of the input. The widget's baseline
is lined up with the input baseline. [...]
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
- semanticCounterText → String
-
A semantic label for the counterText. [...]
final
- suffix → Widget
-
Optional widget to place on the line after the input.
Can be used to add some padding to the suffixText or to
add a custom widget after the input. The widget's baseline
is lined up with the input baseline. [...]
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, int errorMaxLines, bool hasFloatingPlaceholder, bool isDense, EdgeInsetsGeometry contentPadding, Widget prefixIcon, Widget prefix, String prefixText, TextStyle prefixStyle, Widget suffixIcon, Widget suffix, String suffixText, TextStyle suffixStyle, String counterText, TextStyle counterStyle, bool filled, Color fillColor, InputBorder errorBorder, InputBorder focusedBorder, InputBorder focusedErrorBorder, InputBorder disabledBorder, InputBorder enabledBorder, InputBorder border, bool enabled, String semanticCounterText }) → 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.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator. [...]
override