copyWith method

Alignment copyWith({
  1. double? x,
  2. double? y,
})

Creates a copy of this Alignment with optionally modified x and/or y values

Example usage:

Alignment.center.copyWith(x: -0.5) // Creates Alignment(-0.5, 0.0)
Alignment.topLeft.copyWith(y: 0.5) // Creates Alignment(-1.0, 0.5)

Implementation

Alignment copyWith({double? x, double? y}) {
  return Alignment(
    x ?? this.x,
    y ?? this.y,
  );
}