defaultDecoration static method
InputDecoration
defaultDecoration(
- InputBorderType inputBorderType,
- InputDecoration? decoration, {
- BorderSide? borderSide,
- BorderRadius? borderRadius,
- double? gapPadding = 0,
- Widget? prefixWidget,
- Widget? suffixWidget,
- BoxConstraints? prefixWidgetConstraints,
- BoxConstraints? suffixWidgetConstraints,
Implementation
static InputDecoration defaultDecoration(
InputBorderType inputBorderType,
InputDecoration? decoration, {
BorderSide? borderSide,
BorderRadius? borderRadius,
double? gapPadding = 0,
Widget? prefixWidget,
Widget? suffixWidget,
BoxConstraints? prefixWidgetConstraints,
BoxConstraints? suffixWidgetConstraints,
}) {
InputBorder? inputBorder;
EdgeInsetsGeometry? contentPadding;
if (inputBorderType == InputBorderType.outline) {
inputBorder = OutlineInputBorder(
borderSide: borderSide ?? const BorderSide(),
borderRadius:
borderRadius ?? const BorderRadius.all(Radius.circular(4.0)),
gapPadding: gapPadding ?? 4.0,
);
} else if (inputBorderType == InputBorderType.underline) {
inputBorder = UnderlineInputBorder(
borderSide: borderSide ?? const BorderSide(),
borderRadius: borderRadius ??
const BorderRadius.only(
topLeft: Radius.circular(4.0),
topRight: Radius.circular(4.0),
),
);
} else if (inputBorderType == InputBorderType.none) {
inputBorder = InputBorder.none;
contentPadding = EdgeInsets.zero;
}
return InputDecoration(
icon: decoration?.icon,
iconColor: decoration?.iconColor,
label: decoration?.label,
labelText: decoration?.labelText,
labelStyle: decoration?.labelStyle,
floatingLabelStyle: decoration?.floatingLabelStyle,
helperText: decoration?.helperText,
helperStyle: decoration?.helperStyle,
helperMaxLines: decoration?.helperMaxLines,
hintText: decoration?.hintText,
hintStyle: decoration?.hintStyle,
hintTextDirection: decoration?.hintTextDirection,
hintMaxLines: decoration?.hintMaxLines,
hintFadeDuration: decoration?.hintFadeDuration,
error: decoration?.error,
errorText: decoration?.errorText,
errorStyle: decoration?.errorStyle,
errorMaxLines: decoration?.errorMaxLines,
floatingLabelBehavior: decoration?.floatingLabelBehavior,
floatingLabelAlignment: decoration?.floatingLabelAlignment,
isCollapsed: decoration?.isCollapsed ?? false,
isDense: decoration?.isDense ?? true,
contentPadding: decoration?.contentPadding ?? contentPadding,
prefixIcon: decoration?.prefixIcon ?? prefixWidget,
prefixIconConstraints: decoration?.prefixIconConstraints ??
prefixWidgetConstraints ??
const BoxConstraints(minHeight: 0),
prefix: decoration?.prefix,
prefixText: decoration?.prefixText,
prefixStyle: decoration?.prefixStyle,
prefixIconColor: decoration?.prefixIconColor,
suffixIcon: decoration?.suffixIcon ?? suffixWidget,
suffix: decoration?.suffix,
suffixText: decoration?.suffixText,
suffixStyle: decoration?.suffixStyle,
suffixIconColor: decoration?.suffixIconColor,
suffixIconConstraints: decoration?.suffixIconConstraints ??
suffixWidgetConstraints ??
const BoxConstraints(minHeight: 0),
counter: decoration?.counter,
counterText: decoration?.counterText,
counterStyle: decoration?.counterStyle,
filled: decoration?.filled,
fillColor: decoration?.fillColor,
focusColor: decoration?.focusColor,
hoverColor: decoration?.hoverColor,
errorBorder: decoration?.errorBorder ?? inputBorder,
focusedBorder: decoration?.focusedBorder ?? inputBorder,
focusedErrorBorder: decoration?.focusedErrorBorder ?? inputBorder,
disabledBorder: decoration?.disabledBorder ?? inputBorder,
enabledBorder: decoration?.enabledBorder ?? inputBorder,
border: decoration?.border ?? inputBorder,
enabled: decoration?.enabled ?? true,
semanticCounterText: decoration?.semanticCounterText,
alignLabelWithHint: decoration?.alignLabelWithHint,
constraints: decoration?.constraints,
);
}