FieldDecoration constructor
- String? labelText,
- String? hintText = 'Select',
- InputBorder? border,
- InputBorder? focusedBorder,
- InputBorder? disabledBorder,
- InputBorder? errorBorder,
- Widget? suffixIcon = const Icon(Icons.arrow_drop_down),
- Widget? prefixIcon,
- TextStyle? labelStyle,
- double borderRadius = 12,
- TextStyle? hintStyle,
- bool animateSuffixIcon = true,
- EdgeInsets? padding = const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
- Color? backgroundColor,
- bool showClearIcon = true,
Creates a new instance of FieldDecoration.
labelText is the label text to display above the dropdown field.
hintText is the hint text to display in the dropdown field. The default value is 'Select'.
border is the border of the dropdown field.
focusedBorder is the border of the dropdown field when it is focused.
disabledBorder is the border of the dropdown field when it is disabled.
errorBorder is the border of the dropdown field when there is an error.
suffixIcon is the icon to display at the end of dropdown field. The default value is Icon(Icons.arrow_drop_down).
prefixIcon is the icon to display at the start of dropdown field.
labelStyle is the style of the label text.
hintStyle is the style of the hint text.
borderRadius is the border radius of the dropdown field. The default value is 12.
animateSuffixIcon is whether to animate the suffix icon or not when dropdown is opened/closed. The default value is true.
suffixIcon is the icon to display at the end of dropdown field.
prefixIcon is the icon to display at the start of dropdown field.
padding is the padding around the dropdown field.
backgroundColor is the background color of the dropdown field.
Implementation
const FieldDecoration({
this.labelText,
this.hintText = 'Select',
this.border,
this.focusedBorder,
this.disabledBorder,
this.errorBorder,
this.suffixIcon = const Icon(Icons.arrow_drop_down),
this.prefixIcon,
this.labelStyle,
this.borderRadius = 12,
this.hintStyle,
this.animateSuffixIcon = true,
this.padding = const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
this.backgroundColor,
this.showClearIcon = true,
});