copyWith method Null safety

InputDecoration copyWith(
  1. {Widget? icon,
  2. Color? iconColor,
  3. Widget? label,
  4. String? labelText,
  5. TextStyle? labelStyle,
  6. TextStyle? floatingLabelStyle,
  7. String? helperText,
  8. TextStyle? helperStyle,
  9. int? helperMaxLines,
  10. String? hintText,
  11. TextStyle? hintStyle,
  12. TextDirection? hintTextDirection,
  13. int? hintMaxLines,
  14. String? errorText,
  15. TextStyle? errorStyle,
  16. int? errorMaxLines,
  17. FloatingLabelBehavior? floatingLabelBehavior,
  18. FloatingLabelAlignment? floatingLabelAlignment,
  19. bool? isCollapsed,
  20. bool? isDense,
  21. EdgeInsetsGeometry? contentPadding,
  22. Widget? prefixIcon,
  23. Widget? prefix,
  24. String? prefixText,
  25. BoxConstraints? prefixIconConstraints,
  26. TextStyle? prefixStyle,
  27. Color? prefixIconColor,
  28. Widget? suffixIcon,
  29. Widget? suffix,
  30. String? suffixText,
  31. TextStyle? suffixStyle,
  32. Color? suffixIconColor,
  33. BoxConstraints? suffixIconConstraints,
  34. Widget? counter,
  35. String? counterText,
  36. TextStyle? counterStyle,
  37. bool? filled,
  38. Color? fillColor,
  39. Color? focusColor,
  40. Color? hoverColor,
  41. InputBorder? errorBorder,
  42. InputBorder? focusedBorder,
  43. InputBorder? focusedErrorBorder,
  44. InputBorder? disabledBorder,
  45. InputBorder? enabledBorder,
  46. InputBorder? border,
  47. bool? enabled,
  48. String? semanticCounterText,
  49. bool? alignLabelWithHint,
  50. BoxConstraints? constraints}
)

Creates a copy of this input decoration with the given fields replaced by the new values.

Implementation

InputDecoration copyWith({
  Widget? icon,
  Color? iconColor,
  Widget? label,
  String? labelText,
  TextStyle? labelStyle,
  TextStyle? floatingLabelStyle,
  String? helperText,
  TextStyle? helperStyle,
  int? helperMaxLines,
  String? hintText,
  TextStyle? hintStyle,
  TextDirection? hintTextDirection,
  int? hintMaxLines,
  String? errorText,
  TextStyle? errorStyle,
  int? errorMaxLines,
  FloatingLabelBehavior? floatingLabelBehavior,
  FloatingLabelAlignment? floatingLabelAlignment,
  bool? isCollapsed,
  bool? isDense,
  EdgeInsetsGeometry? contentPadding,
  Widget? prefixIcon,
  Widget? prefix,
  String? prefixText,
  BoxConstraints? prefixIconConstraints,
  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,
  String? semanticCounterText,
  bool? alignLabelWithHint,
  BoxConstraints? constraints,
}) {
  return InputDecoration(
    icon: icon ?? this.icon,
    iconColor: iconColor ?? this.iconColor,
    label: label ?? this.label,
    labelText: labelText ?? this.labelText,
    labelStyle: labelStyle ?? this.labelStyle,
    floatingLabelStyle: floatingLabelStyle ?? this.floatingLabelStyle,
    helperText: helperText ?? this.helperText,
    helperStyle: helperStyle ?? this.helperStyle,
    helperMaxLines : helperMaxLines ?? this.helperMaxLines,
    hintText: hintText ?? this.hintText,
    hintStyle: hintStyle ?? this.hintStyle,
    hintTextDirection: hintTextDirection ?? this.hintTextDirection,
    hintMaxLines: hintMaxLines ?? this.hintMaxLines,
    errorText: errorText ?? this.errorText,
    errorStyle: errorStyle ?? this.errorStyle,
    errorMaxLines: errorMaxLines ?? this.errorMaxLines,
    floatingLabelBehavior: floatingLabelBehavior ?? this.floatingLabelBehavior,
    floatingLabelAlignment: floatingLabelAlignment ?? this.floatingLabelAlignment,
    isCollapsed: isCollapsed ?? this.isCollapsed,
    isDense: isDense ?? this.isDense,
    contentPadding: contentPadding ?? this.contentPadding,
    prefixIcon: prefixIcon ?? this.prefixIcon,
    prefix: prefix ?? this.prefix,
    prefixText: prefixText ?? this.prefixText,
    prefixStyle: prefixStyle ?? this.prefixStyle,
    prefixIconColor: prefixIconColor ?? this.prefixIconColor,
    prefixIconConstraints: prefixIconConstraints ?? this.prefixIconConstraints,
    suffixIcon: suffixIcon ?? this.suffixIcon,
    suffix: suffix ?? this.suffix,
    suffixText: suffixText ?? this.suffixText,
    suffixStyle: suffixStyle ?? this.suffixStyle,
    suffixIconColor: suffixIconColor ?? this.suffixIconColor,
    suffixIconConstraints: suffixIconConstraints ?? this.suffixIconConstraints,
    counter: counter ?? this.counter,
    counterText: counterText ?? this.counterText,
    counterStyle: counterStyle ?? this.counterStyle,
    filled: filled ?? this.filled,
    fillColor: fillColor ?? this.fillColor,
    focusColor: focusColor ?? this.focusColor,
    hoverColor: hoverColor ?? this.hoverColor,
    errorBorder: errorBorder ?? this.errorBorder,
    focusedBorder: focusedBorder ?? this.focusedBorder,
    focusedErrorBorder: focusedErrorBorder ?? this.focusedErrorBorder,
    disabledBorder: disabledBorder ?? this.disabledBorder,
    enabledBorder: enabledBorder ?? this.enabledBorder,
    border: border ?? this.border,
    enabled: enabled ?? this.enabled,
    semanticCounterText: semanticCounterText ?? this.semanticCounterText,
    alignLabelWithHint: alignLabelWithHint ?? this.alignLabelWithHint,
    constraints: constraints ?? this.constraints,
  );
}