mergeWith method
Returns a new InputDecoration created by merging this
with the given other decoration.
Non-null values from other override the corresponding values
of the current decoration.
Implementation
InputDecoration mergeWith(InputDecoration? other) {
if (other == null) return this;
return copyWith(
icon: other.icon ?? icon,
labelText: other.labelText ?? labelText,
labelStyle: other.labelStyle ?? labelStyle,
hintText: other.hintText ?? hintText,
hintStyle: other.hintStyle ?? hintStyle,
helperText: other.helperText ?? helperText,
helperStyle: other.helperStyle ?? helperStyle,
errorText: other.errorText ?? errorText,
errorStyle: other.errorStyle ?? errorStyle,
prefixText: other.prefixText ?? prefixText,
suffixText: other.suffixText ?? suffixText,
prefixStyle: other.prefixStyle ?? prefixStyle,
suffixStyle: other.suffixStyle ?? suffixStyle,
prefixIcon: other.prefixIcon ?? prefixIcon,
suffixIcon: other.suffixIcon ?? suffixIcon,
counterText: other.counterText ?? counterText,
counterStyle: other.counterStyle ?? counterStyle,
isDense: other.isDense ?? isDense,
contentPadding: other.contentPadding ?? contentPadding,
filled: other.filled ?? filled,
fillColor: other.fillColor ?? fillColor,
focusColor: other.focusColor ?? focusColor,
hoverColor: other.hoverColor ?? hoverColor,
enabled: other.enabled && enabled,
alignLabelWithHint: other.alignLabelWithHint ?? alignLabelWithHint,
floatingLabelBehavior:
other.floatingLabelBehavior ?? floatingLabelBehavior,
border: other.border ?? border,
enabledBorder: other.enabledBorder ?? enabledBorder,
focusedBorder: other.focusedBorder ?? focusedBorder,
errorBorder: other.errorBorder ?? errorBorder,
focusedErrorBorder: other.focusedErrorBorder ?? focusedErrorBorder,
constraints: other.constraints ?? constraints,
semanticCounterText: other.semanticCounterText ?? semanticCounterText,
);
}