translate method
Returns a new offset with translateX added to the x component and translateY added to the y component.
If the arguments come from another PrinterOffset, consider using the +
or -
operators instead:
PrinterOffset a = const PrinterOffset(10.0, 10.0);
PrinterOffset b = const PrinterOffset(10.0, 10.0);
PrinterOffset c = a + b; // same as: a.translate(b.x, b.y)
PrinterOffset d = a - b; // same as: a.translate(-b.x, -b.y)
Implementation
/// translateY added to the y component.
///
/// If the arguments come from another [PrinterOffset], consider using the `+` or `-`
/// operators instead:
///
/// ```dart
/// PrinterOffset a = const PrinterOffset(10.0, 10.0);
/// PrinterOffset b = const PrinterOffset(10.0, 10.0);
/// PrinterOffset c = a + b; // same as: a.translate(b.x, b.y)
/// PrinterOffset d = a - b; // same as: a.translate(-b.x, -b.y)
/// ```
PrinterOffset translate(double translateX, double translateY) => PrinterOffset(x! + translateX, y! + translateY);