David PHAM-VAN

Add available dimensions for PdfPageFormat

  1 +# 1.3.4
  2 +* Add available dimensions for PdfPageFormat
  3 +
1 # 1.3.3 4 # 1.3.3
2 * Fix a bug with the RichText Widget 5 * Fix a bug with the RichText Widget
3 * Update code to Dart 2.1.0 6 * Update code to Dart 2.1.0
@@ -66,8 +66,18 @@ class PdfPageFormat { @@ -66,8 +66,18 @@ class PdfPageFormat {
66 marginRight: marginRight ?? this.marginRight); 66 marginRight: marginRight ?? this.marginRight);
67 } 67 }
68 68
  69 + /// Total page dimensions
69 PdfPoint get dimension => PdfPoint(width, height); 70 PdfPoint get dimension => PdfPoint(width, height);
70 71
  72 + /// Total page width excluding margins
  73 + double get availableWidth => width - marginLeft - marginRight;
  74 +
  75 + /// Total page height excluding margins
  76 + double get availableHeight => height - marginTop - marginBottom;
  77 +
  78 + /// Total page dimensions excluding margins
  79 + PdfPoint get availableDimension => PdfPoint(availableWidth, availableHeight);
  80 +
71 PdfPageFormat get landscape => 81 PdfPageFormat get landscape =>
72 width >= height ? this : copyWith(width: height, height: width); 82 width >= height ? this : copyWith(width: height, height: width);
73 83
@@ -85,6 +95,6 @@ class PdfPageFormat { @@ -85,6 +95,6 @@ class PdfPageFormat {
85 95
86 @override 96 @override
87 String toString() { 97 String toString() {
88 - return '${width}x$height'; 98 + return 'Page ${width}x$height margins:$marginLeft, $marginTop, $marginRight, $marginBottom';
89 } 99 }
90 } 100 }
@@ -4,7 +4,7 @@ description: A pdf producer for Dart. It can create pdf files for both web or fl @@ -4,7 +4,7 @@ description: A pdf producer for Dart. It can create pdf files for both web or fl
4 homepage: https://github.com/DavBfr/dart_pdf/tree/master/pdf 4 homepage: https://github.com/DavBfr/dart_pdf/tree/master/pdf
5 repository: https://github.com/DavBfr/dart_pdf 5 repository: https://github.com/DavBfr/dart_pdf
6 issue_tracker: https://github.com/DavBfr/dart_pdf/issues 6 issue_tracker: https://github.com/DavBfr/dart_pdf/issues
7 -version: 1.3.3 7 +version: 1.3.4
8 8
9 environment: 9 environment:
10 sdk: ">=2.1.0 <3.0.0" 10 sdk: ">=2.1.0 <3.0.0"