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<BorderSide?>? side,
  13. MaterialStateProperty<OutlinedBorder?>? shape,
  14. MaterialStateProperty<MouseCursor?>? mouseCursor,
  15. VisualDensity? visualDensity,
  16. MaterialTapTargetSize? tapTargetSize,
  17. Duration? animationDuration,
  18. bool? enableFeedback,
  19. AlignmentGeometry? alignment,
  20. 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<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,
    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,
  );
}