buildInputDecoration method
InputDecoration
buildInputDecoration(
- Set<WidgetState> states, {
- bool expands = false,
- Widget? beforePostWidget,
- Widget? beforePreWidget,
- String? label,
- String? placeholder,
- String? tag,
- String? helperText,
- List<String>? errors,
- bool isRequired = false,
- VoidCallback? onClear,
- Widget? infoIcon,
})
Implementation
InputDecoration buildInputDecoration(
Set<WidgetState> states, {
bool expands = false,
Widget? beforePostWidget,
Widget? beforePreWidget,
String? label,
String? placeholder,
String? tag,
String? helperText,
List<String>? errors,
bool isRequired = false,
VoidCallback? onClear,
Widget? infoIcon,
}) {
final inputBorder = buildInputBorder(states);
return InputDecoration(
border: inputBorder,
enabledBorder: inputBorder,
focusedErrorBorder: inputBorder,
disabledBorder: inputBorder,
focusedBorder: inputBorder,
errorBorder: inputBorder,
contentPadding: fieldPadding,
label: labelPosition == TLabelPosition.aboveField ? null : labelBuilder.resolve(states)(label, tag, isRequired, null),
labelStyle: labelStyle.resolve(states),
floatingLabelStyle: labelStyle.resolve(states),
floatingLabelBehavior: switch (labelPosition) {
TLabelPosition.aboveField => FloatingLabelBehavior.never,
TLabelPosition.floating => FloatingLabelBehavior.auto,
},
isDense: true,
visualDensity: VisualDensity.compact,
constraints: BoxConstraints(minHeight: fieldHeight, maxHeight: expands ? double.infinity : fieldHeight),
hintText: placeholder,
hintStyle: hintStyle.resolve(states),
prefixIcon: _buildPreWidget(beforePreWidget),
suffixIcon: _buildPostWidget(
beforePostWidget: beforePostWidget, onClear: onClear, infoIcon: labelPosition == TLabelPosition.floating ? infoIcon : null),
filled: decorationType == TInputDecorationType.filled,
fillColor: backgroundColor.resolve(states),
);
}