copyWith method

  1. @override
BoxSpec copyWith({
  1. AlignmentGeometry? alignment,
  2. EdgeInsetsGeometry? padding,
  3. EdgeInsetsGeometry? margin,
  4. BoxConstraints? constraints,
  5. Decoration? decoration,
  6. Decoration? foregroundDecoration,
  7. double? width,
  8. double? height,
  9. Matrix4? transform,
  10. AlignmentGeometry? transformAlignment,
  11. Clip? clipBehavior,
  12. AnimatedData? animated,
})
override

Returns a new BoxSpec with the specified properties replaced.

This method is useful for creating modified copies of an existing BoxSpec with some attributes changed.

Implementation

@override
BoxSpec copyWith({
  AlignmentGeometry? alignment,
  EdgeInsetsGeometry? padding,
  EdgeInsetsGeometry? margin,
  BoxConstraints? constraints,
  Decoration? decoration,
  Decoration? foregroundDecoration,
  double? width,
  double? height,
  Matrix4? transform,
  AlignmentGeometry? transformAlignment,
  Clip? clipBehavior,
  AnimatedData? animated,
}) {
  return BoxSpec(
    alignment: alignment ?? this.alignment,
    padding: padding ?? this.padding,
    margin: margin ?? this.margin,
    constraints: constraints ?? this.constraints,
    decoration: decoration ?? this.decoration,
    foregroundDecoration: foregroundDecoration ?? this.foregroundDecoration,
    transform: transform ?? this.transform,
    transformAlignment: transformAlignment ?? this.transformAlignment,
    clipBehavior: clipBehavior ?? this.clipBehavior,
    width: width ?? this.width,
    height: height ?? this.height,
    animated: animated ?? this.animated,
  );
}