David PHAM-VAN

Improve PdfPoint and PdfRect

# 1.1.1
* Improve PdfPoint and PdfRect
# 1.1.0
* Rename classes to satisfy Dart conventions
* Remove useless new and const keywords
... ...
... ... @@ -30,6 +30,8 @@ class PdfPoint {
const PdfPoint(this.x, this.y);
static const zero = PdfPoint(0.0, 0.0);
@override
String toString() => "PdfPoint($x, $y)";
}
... ...
... ... @@ -22,6 +22,8 @@ part of pdf;
class PdfRect {
final double x, y, w, h;
static const zero = PdfRect(0.0, 0.0, 0.0, 0.0);
const PdfRect(this.x, this.y, this.w, this.h);
factory PdfRect.fromLTRB(
... ... @@ -29,6 +31,10 @@ class PdfRect {
return PdfRect(left, top, right - left, bottom - top);
}
factory PdfRect.fromPoints(PdfPoint offset, PdfPoint size) {
return PdfRect(offset.x, offset.y, size.x, size.y);
}
double get l => x;
double get b => y;
double get r => x + w;
... ... @@ -36,4 +42,16 @@ class PdfRect {
@override
String toString() => "PdfRect($x, $y, $w, $h)";
PdfRect operator *(double factor) {
return PdfRect(x * factor, y * factor, w * factor, h * factor);
}
PdfPoint get offset => PdfPoint(x, y);
PdfPoint get size => PdfPoint(w, h);
PdfPoint get topLeft => PdfPoint(x, y);
PdfPoint get topRight => PdfPoint(r, y);
PdfPoint get bottomLeft => PdfPoint(x, t);
PdfPoint get bottomRight => PdfPoint(r, t);
}
... ...
... ... @@ -2,7 +2,7 @@ name: pdf
author: David PHAM-VAN <dev.nfet.net@gmail.com>
description: A pdf producer for Dart. It can create pdf files for both web or flutter.
homepage: https://github.com/DavBfr/dart_pdf/tree/master/pdf
version: 1.1.0
version: 1.1.1
environment:
sdk: ">=1.8.0 <3.0.0"
... ...