copyWith method Null safety

ButtonStyle copyWith(
  1. {MaterialStateProperty<TextStyle?>? textStyle,
  2. MaterialStateProperty<Color?>? backgroundColor,
  3. MaterialStateProperty<Color?>? foregroundColor,
  4. MaterialStateProperty<Color?>? overlayColor,
  5. MaterialStateProperty<Color?>? shadowColor,
  6. MaterialStateProperty<Color?>? surfaceTintColor,
  7. MaterialStateProperty<double?>? elevation,
  8. MaterialStateProperty<EdgeInsetsGeometry?>? padding,
  9. MaterialStateProperty<Size?>? minimumSize,
  10. MaterialStateProperty<Size?>? fixedSize,
  11. MaterialStateProperty<Size?>? maximumSize,
  12. MaterialStateProperty<double?>? iconSize,
  13. MaterialStateProperty<BorderSide?>? side,
  14. MaterialStateProperty<OutlinedBorder?>? shape,
  15. MaterialStateProperty<MouseCursor?>? mouseCursor,
  16. VisualDensity? visualDensity,
  17. MaterialTapTargetSize? tapTargetSize,
  18. Duration? animationDuration,
  19. bool? enableFeedback,
  20. AlignmentGeometry? alignment,
  21. InteractiveInkFeatureFactory? splashFactory}
)

Returns a copy of this ButtonStyle with the given fields replaced with the new values.

Implementation

ButtonStyle copyWith({
  MaterialStateProperty<TextStyle?>? textStyle,
  MaterialStateProperty<Color?>? backgroundColor,
  MaterialStateProperty<Color?>? foregroundColor,
  MaterialStateProperty<Color?>? overlayColor,
  MaterialStateProperty<Color?>? shadowColor,
  MaterialStateProperty<Color?>? surfaceTintColor,
  MaterialStateProperty<double?>? elevation,
  MaterialStateProperty<EdgeInsetsGeometry?>? padding,
  MaterialStateProperty<Size?>? minimumSize,
  MaterialStateProperty<Size?>? fixedSize,
  MaterialStateProperty<Size?>? maximumSize,
  MaterialStateProperty<double?>? iconSize,
  MaterialStateProperty<BorderSide?>? side,
  MaterialStateProperty<OutlinedBorder?>? shape,
  MaterialStateProperty<MouseCursor?>? mouseCursor,
  VisualDensity? visualDensity,
  MaterialTapTargetSize? tapTargetSize,
  Duration? animationDuration,
  bool? enableFeedback,
  AlignmentGeometry? alignment,
  InteractiveInkFeatureFactory? splashFactory,
}) {
  return ButtonStyle(
    textStyle: textStyle ?? this.textStyle,
    backgroundColor: backgroundColor ?? this.backgroundColor,
    foregroundColor: foregroundColor ?? this.foregroundColor,
    overlayColor: overlayColor ?? this.overlayColor,
    shadowColor: shadowColor ?? this.shadowColor,
    surfaceTintColor: surfaceTintColor ?? this.surfaceTintColor,
    elevation: elevation ?? this.elevation,
    padding: padding ?? this.padding,
    minimumSize: minimumSize ?? this.minimumSize,
    fixedSize: fixedSize ?? this.fixedSize,
    maximumSize: maximumSize ?? this.maximumSize,
    iconSize: iconSize ?? this.iconSize,
    side: side ?? this.side,
    shape: shape ?? this.shape,
    mouseCursor: mouseCursor ?? this.mouseCursor,
    visualDensity: visualDensity ?? this.visualDensity,
    tapTargetSize: tapTargetSize ?? this.tapTargetSize,
    animationDuration: animationDuration ?? this.animationDuration,
    enableFeedback: enableFeedback ?? this.enableFeedback,
    alignment: alignment ?? this.alignment,
    splashFactory: splashFactory ?? this.splashFactory,
  );
}