copyWith method Null safety

ButtonThemeData copyWith(
  1. {ButtonTextTheme? textTheme,
  2. ButtonBarLayoutBehavior? layoutBehavior,
  3. double? minWidth,
  4. double? height,
  5. EdgeInsetsGeometry? padding,
  6. ShapeBorder? shape,
  7. bool? alignedDropdown,
  8. Color? buttonColor,
  9. Color? disabledColor,
  10. Color? focusColor,
  11. Color? hoverColor,
  12. Color? highlightColor,
  13. Color? splashColor,
  14. ColorScheme? colorScheme,
  15. MaterialTapTargetSize? materialTapTargetSize}
)

Creates a copy of this button theme data object with the matching fields replaced with the non-null parameter values.

Implementation

ButtonThemeData copyWith({
  ButtonTextTheme? textTheme,
  ButtonBarLayoutBehavior? layoutBehavior,
  double? minWidth,
  double? height,
  EdgeInsetsGeometry? padding,
  ShapeBorder? shape,
  bool? alignedDropdown,
  Color? buttonColor,
  Color? disabledColor,
  Color? focusColor,
  Color? hoverColor,
  Color? highlightColor,
  Color? splashColor,
  ColorScheme? colorScheme,
  MaterialTapTargetSize? materialTapTargetSize,
}) {
  return ButtonThemeData(
    textTheme: textTheme ?? this.textTheme,
    layoutBehavior: layoutBehavior ?? this.layoutBehavior,
    minWidth: minWidth ?? this.minWidth,
    height: height ?? this.height,
    padding: padding ?? this.padding,
    shape: shape ?? this.shape,
    alignedDropdown: alignedDropdown ?? this.alignedDropdown,
    buttonColor: buttonColor ?? _buttonColor,
    disabledColor: disabledColor ?? _disabledColor,
    focusColor: focusColor ?? _focusColor,
    hoverColor: hoverColor ?? _hoverColor,
    highlightColor: highlightColor ?? _highlightColor,
    splashColor: splashColor ?? _splashColor,
    colorScheme: colorScheme ?? this.colorScheme,
    materialTapTargetSize: materialTapTargetSize ?? _materialTapTargetSize,
  );
}