InputDecoration constructor
- Widget? icon,
- Color? iconColor,
- Widget? label,
- String? labelText,
- TextStyle? labelStyle,
- TextStyle? floatingLabelStyle,
- Widget? helper,
- String? helperText,
- TextStyle? helperStyle,
- int? helperMaxLines,
- String? hintText,
- Widget? hint,
- TextStyle? hintStyle,
- TextDirection? hintTextDirection,
- int? hintMaxLines,
- Duration? hintFadeDuration,
- @Deprecated('Use maintainHintSize instead. ' 'This will maintain both hint height and hint width. ' 'This feature was deprecated after v3.28.0-2.0.pre.') bool maintainHintHeight = true,
- bool maintainHintSize = true,
- Widget? error,
- String? errorText,
- TextStyle? errorStyle,
- int? errorMaxLines,
- FloatingLabelBehavior? floatingLabelBehavior,
- FloatingLabelAlignment? floatingLabelAlignment,
- bool? isCollapsed,
- bool? isDense,
- EdgeInsetsGeometry? contentPadding,
- Widget? prefixIcon,
- BoxConstraints? prefixIconConstraints,
- Widget? prefix,
- String? prefixText,
- TextStyle? prefixStyle,
- Color? prefixIconColor,
- Widget? suffixIcon,
- Widget? suffix,
- String? suffixText,
- TextStyle? suffixStyle,
- Color? suffixIconColor,
- BoxConstraints? suffixIconConstraints,
- Widget? counter,
- String? counterText,
- TextStyle? counterStyle,
- bool? filled,
- Color? fillColor,
- Color? focusColor,
- Color? hoverColor,
- InputBorder? errorBorder,
- InputBorder? focusedBorder,
- InputBorder? focusedErrorBorder,
- InputBorder? disabledBorder,
- InputBorder? enabledBorder,
- InputBorder? border,
- bool enabled = true,
- String? semanticCounterText,
- bool? alignLabelWithHint,
- 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.hint,
this.hintStyle,
this.hintTextDirection,
this.hintMaxLines,
this.hintFadeDuration,
@Deprecated(
'Use maintainHintSize instead. '
'This will maintain both hint height and hint width. '
'This feature was deprecated after v3.28.0-2.0.pre.',
)
this.maintainHintHeight = true,
this.maintainHintSize = 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(
hint == null || hintText == null,
'Declaring both hint and hintText 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.',
);