Showing
38 changed files
with
211 additions
and
184 deletions
@@ -43,6 +43,7 @@ test: pdf/.dart_tool $(FONTS) | @@ -43,6 +43,7 @@ test: pdf/.dart_tool $(FONTS) | ||
43 | cd pdf; pub get | 43 | cd pdf; pub get |
44 | cd pdf; for EXAMPLE in $(shell cd pdf; find example -name '*.dart'); do dart $$EXAMPLE; done | 44 | cd pdf; for EXAMPLE in $(shell cd pdf; find example -name '*.dart'); do dart $$EXAMPLE; done |
45 | cd pdf; for TEST in $(shell cd pdf; find test -name '*.dart'); do dart $$TEST; done | 45 | cd pdf; for TEST in $(shell cd pdf; find test -name '*.dart'); do dart $$TEST; done |
46 | + cd printing/example; flutter packages get | ||
46 | cd printing/example; flutter test | 47 | cd printing/example; flutter test |
47 | 48 | ||
48 | clean: | 49 | clean: |
@@ -56,10 +57,20 @@ publish-printing: format clean | @@ -56,10 +57,20 @@ publish-printing: format clean | ||
56 | 57 | ||
57 | .pana: | 58 | .pana: |
58 | pub global activate pana | 59 | pub global activate pana |
59 | - touch .pana | 60 | + touch $@ |
60 | 61 | ||
61 | analyze: .pana | 62 | analyze: .pana |
62 | @pana --no-warning --source path pdf 2> /dev/null | python pana_report.py | 63 | @pana --no-warning --source path pdf 2> /dev/null | python pana_report.py |
63 | @pana --no-warning --source path printing 2> /dev/null | python pana_report.py | 64 | @pana --no-warning --source path printing 2> /dev/null | python pana_report.py |
64 | 65 | ||
66 | +.dartfix: | ||
67 | + pub global activate dartfix | ||
68 | + touch $@ | ||
69 | + | ||
70 | +fix: .dartfix | ||
71 | + cd pdf; pub get | ||
72 | + cd pdf; dartfix --overwrite . | ||
73 | + cd printing; flutter packages get | ||
74 | + cd printing; dartfix --overwrite . | ||
75 | + | ||
65 | .PHONY: test format format-dart format-clang clean publish-pdf publish-printing analyze | 76 | .PHONY: test format format-dart format-clang clean publish-pdf publish-printing analyze |
@@ -41,7 +41,7 @@ void main() { | @@ -41,7 +41,7 @@ void main() { | ||
41 | child: Row( | 41 | child: Row( |
42 | mainAxisAlignment: MainAxisAlignment.spaceBetween, | 42 | mainAxisAlignment: MainAxisAlignment.spaceBetween, |
43 | children: <Widget>[ | 43 | children: <Widget>[ |
44 | - Text('Portable Document Format', textScaleFactor: 2.0), | 44 | + Text('Portable Document Format', textScaleFactor: 2), |
45 | PdfLogo() | 45 | PdfLogo() |
46 | ])), | 46 | ])), |
47 | Paragraph( | 47 | Paragraph( |
@@ -47,15 +47,15 @@ class PdfColor { | @@ -47,15 +47,15 @@ class PdfColor { | ||
47 | static const PdfColor indigo = PdfColor(0.24705, 0.31765, 0.70980); | 47 | static const PdfColor indigo = PdfColor(0.24705, 0.31765, 0.70980); |
48 | static const PdfColor blue = PdfColor(0.12941, 0.58823, 0.95294); | 48 | static const PdfColor blue = PdfColor(0.12941, 0.58823, 0.95294); |
49 | static const PdfColor lightBlue = PdfColor(0.01176, 0.66274, 0.95686); | 49 | static const PdfColor lightBlue = PdfColor(0.01176, 0.66274, 0.95686); |
50 | - static const PdfColor cyan = PdfColor(0.0, 0.73725, 0.83137); | ||
51 | - static const PdfColor teal = PdfColor(0.0, 0.58823, 0.53333); | 50 | + static const PdfColor cyan = PdfColor(0, 0.73725, 0.83137); |
51 | + static const PdfColor teal = PdfColor(0, 0.58823, 0.53333); | ||
52 | static const PdfColor green = PdfColor(0.29803, 0.68627, 0.31372); | 52 | static const PdfColor green = PdfColor(0.29803, 0.68627, 0.31372); |
53 | static const PdfColor lightGreen = PdfColor(0.54509, 0.76470, 0.29020); | 53 | static const PdfColor lightGreen = PdfColor(0.54509, 0.76470, 0.29020); |
54 | static const PdfColor lime = PdfColor(0.80392, 0.86274, 0.22353); | 54 | static const PdfColor lime = PdfColor(0.80392, 0.86274, 0.22353); |
55 | - static const PdfColor yellow = PdfColor(1.0, 0.92157, 0.23137); | ||
56 | - static const PdfColor amber = PdfColor(1.0, 0.75686, 0.02745); | ||
57 | - static const PdfColor orange = PdfColor(1.0, 0.59608, 0.0); | ||
58 | - static const PdfColor deepOrange = PdfColor(1.0, 0.34118, 0.13333); | 55 | + static const PdfColor yellow = PdfColor(1, 0.92157, 0.23137); |
56 | + static const PdfColor amber = PdfColor(1, 0.75686, 0.02745); | ||
57 | + static const PdfColor orange = PdfColor(1, 0.59608, 0); | ||
58 | + static const PdfColor deepOrange = PdfColor(1, 0.34118, 0.13333); | ||
59 | static const PdfColor brown = PdfColor(0.47451, 0.33333, 0.28235); | 59 | static const PdfColor brown = PdfColor(0.47451, 0.33333, 0.28235); |
60 | static const PdfColor grey = PdfColor(0.61961, 0.61961, 0.61961); | 60 | static const PdfColor grey = PdfColor(0.61961, 0.61961, 0.61961); |
61 | static const PdfColor blueGrey = PdfColor(0.37647, 0.49020, 0.54510); | 61 | static const PdfColor blueGrey = PdfColor(0.37647, 0.49020, 0.54510); |
@@ -70,7 +70,7 @@ class PDFAnnot extends PdfAnnot { | @@ -70,7 +70,7 @@ class PDFAnnot extends PdfAnnot { | ||
70 | static const PdfBorderStyle BEVELED = PdfBorderStyle.beveled; | 70 | static const PdfBorderStyle BEVELED = PdfBorderStyle.beveled; |
71 | static const PdfBorderStyle INSET = PdfBorderStyle.inset; | 71 | static const PdfBorderStyle INSET = PdfBorderStyle.inset; |
72 | static const PdfBorderStyle UNDERLINED = PdfBorderStyle.underlined; | 72 | static const PdfBorderStyle UNDERLINED = PdfBorderStyle.underlined; |
73 | - static const double FULL_PAGE = -9999.0; | 73 | + static const double FULL_PAGE = -9999; |
74 | } | 74 | } |
75 | 75 | ||
76 | @deprecated | 76 | @deprecated |
@@ -44,7 +44,7 @@ class PdfFontMetrics { | @@ -44,7 +44,7 @@ class PdfFontMetrics { | ||
44 | 44 | ||
45 | double left; | 45 | double left; |
46 | double top; | 46 | double top; |
47 | - double right = 0.0; | 47 | + double right = 0; |
48 | double bottom; | 48 | double bottom; |
49 | double ascent; | 49 | double ascent; |
50 | double descent; | 50 | double descent; |
@@ -72,7 +72,7 @@ class PdfFontMetrics { | @@ -72,7 +72,7 @@ class PdfFontMetrics { | ||
72 | } | 72 | } |
73 | 73 | ||
74 | static const PdfFontMetrics zero = | 74 | static const PdfFontMetrics zero = |
75 | - PdfFontMetrics(left: 0.0, top: 0.0, right: 0.0, bottom: 0.0); | 75 | + PdfFontMetrics(left: 0, top: 0, right: 0, bottom: 0); |
76 | 76 | ||
77 | final double left; | 77 | final double left; |
78 | 78 | ||
@@ -97,7 +97,7 @@ class PdfFontMetrics { | @@ -97,7 +97,7 @@ class PdfFontMetrics { | ||
97 | double get maxWidth => | 97 | double get maxWidth => |
98 | math.max(advanceWidth, right) + math.max(-leftBearing, 0.0); | 98 | math.max(advanceWidth, right) + math.max(-leftBearing, 0.0); |
99 | 99 | ||
100 | - double get effectiveLeft => math.min(leftBearing, 0.0); | 100 | + double get effectiveLeft => math.min(leftBearing, 0); |
101 | 101 | ||
102 | double get leftBearing => left; | 102 | double get leftBearing => left; |
103 | 103 |
@@ -97,7 +97,7 @@ class PdfGraphics { | @@ -97,7 +97,7 @@ class PdfGraphics { | ||
97 | 97 | ||
98 | // q w 0 0 h x y cm % the coordinate matrix | 98 | // q w 0 0 h x y cm % the coordinate matrix |
99 | buf.putString('q '); | 99 | buf.putString('q '); |
100 | - buf.putNumList(<double>[w, 0.0, 0.0, h, x, y]); | 100 | + buf.putNumList(<double>[w, 0, 0, h, x, y]); |
101 | buf.putString(' cm ${img.name} Do Q\n'); | 101 | buf.putString(' cm ${img.name} Do Q\n'); |
102 | } | 102 | } |
103 | 103 | ||
@@ -267,7 +267,7 @@ class PdfGraphics { | @@ -267,7 +267,7 @@ class PdfGraphics { | ||
267 | final double d = | 267 | final double d = |
268 | math.sqrt(ux * ux + uy * uy) * math.sqrt(vx * vx + vy * vy); | 268 | math.sqrt(ux * ux + uy * uy) * math.sqrt(vx * vx + vy * vy); |
269 | if (d == 0.0) { | 269 | if (d == 0.0) { |
270 | - return 0.0; | 270 | + return 0; |
271 | } | 271 | } |
272 | double c = (ux * vx + uy * vy) / d; | 272 | double c = (ux * vx + uy * vy) / d; |
273 | if (c < -1.0) { | 273 | if (c < -1.0) { |
@@ -315,8 +315,7 @@ class PdfGraphics { | @@ -315,8 +315,7 @@ class PdfGraphics { | ||
315 | final double cx = cxd + 0.5 * (x1 + x2); | 315 | final double cx = cxd + 0.5 * (x1 + x2); |
316 | final double cy = cyd + 0.5 * (y1 + y2); | 316 | final double cy = cyd + 0.5 * (y1 + y2); |
317 | 317 | ||
318 | - final double theta = | ||
319 | - _vectorAngle(1.0, 0.0, (x1d - cxd) / rx, (y1d - cyd) / ry); | 318 | + final double theta = _vectorAngle(1, 0, (x1d - cxd) / rx, (y1d - cyd) / ry); |
320 | double dTheta = _vectorAngle((x1d - cxd) / rx, (y1d - cyd) / ry, | 319 | double dTheta = _vectorAngle((x1d - cxd) / rx, (y1d - cyd) / ry, |
321 | (-x1d - cxd) / rx, (-y1d - cyd) / ry) % | 320 | (-x1d - cxd) / rx, (-y1d - cyd) / ry) % |
322 | (math.pi * 2.0); | 321 | (math.pi * 2.0); |
@@ -400,8 +399,8 @@ class PdfGraphics { | @@ -400,8 +399,8 @@ class PdfGraphics { | ||
400 | final Matrix4 mat = Matrix4.identity(); | 399 | final Matrix4 mat = Matrix4.identity(); |
401 | mat.translate(-x1, -y1); | 400 | mat.translate(-x1, -y1); |
402 | mat.rotateZ(-phi); | 401 | mat.rotateZ(-phi); |
403 | - final Vector3 tr = mat.transform3(Vector3(x2, y2, 0.0)); | ||
404 | - _endToCenterParameters(0.0, 0.0, tr[0], tr[1], large, sweep, rx, ry); | 402 | + final Vector3 tr = mat.transform3(Vector3(x2, y2, 0)); |
403 | + _endToCenterParameters(0, 0, tr[0], tr[1], large, sweep, rx, ry); | ||
405 | } else { | 404 | } else { |
406 | _endToCenterParameters(x1, y1, x2, y2, large, sweep, rx, ry); | 405 | _endToCenterParameters(x1, y1, x2, y2, large, sweep, rx, ry); |
407 | } | 406 | } |
@@ -415,8 +414,8 @@ class PdfGraphics { | @@ -415,8 +414,8 @@ class PdfGraphics { | ||
415 | String action; | 414 | String action; |
416 | String lastAction; | 415 | String lastAction; |
417 | List<double> points; | 416 | List<double> points; |
418 | - PdfPoint lastControl = const PdfPoint(0.0, 0.0); | ||
419 | - PdfPoint lastPoint = const PdfPoint(0.0, 0.0); | 417 | + PdfPoint lastControl = const PdfPoint(0, 0); |
418 | + PdfPoint lastPoint = const PdfPoint(0, 0); | ||
420 | for (Match m in matches) { | 419 | for (Match m in matches) { |
421 | final String a = m.group(1); | 420 | final String a = m.group(1); |
422 | final String b = m.group(0); | 421 | final String b = m.group(0); |
@@ -81,7 +81,7 @@ class PdfPage extends PdfObject { | @@ -81,7 +81,7 @@ class PdfPage extends PdfObject { | ||
81 | 81 | ||
82 | // the /MediaBox for the page size | 82 | // the /MediaBox for the page size |
83 | params['/MediaBox'] = PdfStream() | 83 | params['/MediaBox'] = PdfStream() |
84 | - ..putNumArray(<double>[0.0, 0.0, pageFormat.width, pageFormat.height]); | 84 | + ..putNumArray(<double>[0, 0, pageFormat.width, pageFormat.height]); |
85 | 85 | ||
86 | // Rotation (if not zero) | 86 | // Rotation (if not zero) |
87 | // if(rotate!=0) { | 87 | // if(rotate!=0) { |
@@ -23,6 +23,6 @@ class PdfPolygon { | @@ -23,6 +23,6 @@ class PdfPolygon { | ||
23 | 23 | ||
24 | PdfRect getBounds() { | 24 | PdfRect getBounds() { |
25 | // TODO(me): Implement properly | 25 | // TODO(me): Implement properly |
26 | - return const PdfRect(0.0, 0.0, 0.0, 0.0); | 26 | + return const PdfRect(0, 0, 0, 0); |
27 | } | 27 | } |
28 | } | 28 | } |
@@ -31,7 +31,7 @@ class PdfRect { | @@ -31,7 +31,7 @@ class PdfRect { | ||
31 | 31 | ||
32 | final double x, y, width, height; | 32 | final double x, y, width, height; |
33 | 33 | ||
34 | - static const PdfRect zero = PdfRect(0.0, 0.0, 0.0, 0.0); | 34 | + static const PdfRect zero = PdfRect(0, 0, 0, 0); |
35 | 35 | ||
36 | double get left => x; | 36 | double get left => x; |
37 | double get bottom => y; | 37 | double get bottom => y; |
@@ -45,7 +45,7 @@ class PdfType1Font extends PdfFont { | @@ -45,7 +45,7 @@ class PdfType1Font extends PdfFont { | ||
45 | @override | 45 | @override |
46 | PdfFontMetrics glyphMetrics(int charCode) { | 46 | PdfFontMetrics glyphMetrics(int charCode) { |
47 | return PdfFontMetrics( | 47 | return PdfFontMetrics( |
48 | - left: 0.0, | 48 | + left: 0, |
49 | top: descent, | 49 | top: descent, |
50 | right: charCode < widths.length | 50 | right: charCode < widths.length |
51 | ? widths[charCode] | 51 | ? widths[charCode] |
@@ -150,14 +150,14 @@ const List<double> _helveticaWidths = <double>[ | @@ -150,14 +150,14 @@ const List<double> _helveticaWidths = <double>[ | ||
150 | 0.222, | 150 | 0.222, |
151 | 0.278, | 151 | 0.278, |
152 | 0.333, | 152 | 0.333, |
153 | - 1.000, | 153 | + 1, |
154 | 0.556, | 154 | 0.556, |
155 | 0.556, | 155 | 0.556, |
156 | 0.333, | 156 | 0.333, |
157 | - 1.000, | 157 | + 1, |
158 | 0.667, | 158 | 0.667, |
159 | 0.250, | 159 | 0.250, |
160 | - 1.000, | 160 | + 1, |
161 | 0.500, | 161 | 0.500, |
162 | 0.611, | 162 | 0.611, |
163 | 0.500, | 163 | 0.500, |
@@ -168,9 +168,9 @@ const List<double> _helveticaWidths = <double>[ | @@ -168,9 +168,9 @@ const List<double> _helveticaWidths = <double>[ | ||
168 | 0.333, | 168 | 0.333, |
169 | 0.350, | 169 | 0.350, |
170 | 0.556, | 170 | 0.556, |
171 | - 1.000, | 171 | + 1, |
172 | 0.333, | 172 | 0.333, |
173 | - 1.000, | 173 | + 1, |
174 | 0.500, | 174 | 0.500, |
175 | 0.250, | 175 | 0.250, |
176 | 0.938, | 176 | 0.938, |
@@ -215,7 +215,7 @@ const List<double> _helveticaWidths = <double>[ | @@ -215,7 +215,7 @@ const List<double> _helveticaWidths = <double>[ | ||
215 | 0.667, | 215 | 0.667, |
216 | 0.667, | 216 | 0.667, |
217 | 0.667, | 217 | 0.667, |
218 | - 1.000, | 218 | + 1, |
219 | 0.722, | 219 | 0.722, |
220 | 0.667, | 220 | 0.667, |
221 | 0.667, | 221 | 0.667, |
@@ -409,14 +409,14 @@ const List<double> _helveticaBoldWidths = <double>[ | @@ -409,14 +409,14 @@ const List<double> _helveticaBoldWidths = <double>[ | ||
409 | 0.278, | 409 | 0.278, |
410 | 0.556, | 410 | 0.556, |
411 | 0.500, | 411 | 0.500, |
412 | - 1.000, | 412 | + 1, |
413 | 0.556, | 413 | 0.556, |
414 | 0.556, | 414 | 0.556, |
415 | 0.333, | 415 | 0.333, |
416 | - 1.000, | 416 | + 1, |
417 | 0.667, | 417 | 0.667, |
418 | 0.333, | 418 | 0.333, |
419 | - 1.000, | 419 | + 1, |
420 | 0.350, | 420 | 0.350, |
421 | 0.611, | 421 | 0.611, |
422 | 0.350, | 422 | 0.350, |
@@ -427,9 +427,9 @@ const List<double> _helveticaBoldWidths = <double>[ | @@ -427,9 +427,9 @@ const List<double> _helveticaBoldWidths = <double>[ | ||
427 | 0.500, | 427 | 0.500, |
428 | 0.350, | 428 | 0.350, |
429 | 0.556, | 429 | 0.556, |
430 | - 1.000, | 430 | + 1, |
431 | 0.333, | 431 | 0.333, |
432 | - 1.000, | 432 | + 1, |
433 | 0.556, | 433 | 0.556, |
434 | 0.333, | 434 | 0.333, |
435 | 0.944, | 435 | 0.944, |
@@ -474,7 +474,7 @@ const List<double> _helveticaBoldWidths = <double>[ | @@ -474,7 +474,7 @@ const List<double> _helveticaBoldWidths = <double>[ | ||
474 | 0.722, | 474 | 0.722, |
475 | 0.722, | 475 | 0.722, |
476 | 0.722, | 476 | 0.722, |
477 | - 1.000, | 477 | + 1, |
478 | 0.722, | 478 | 0.722, |
479 | 0.667, | 479 | 0.667, |
480 | 0.667, | 480 | 0.667, |
@@ -668,14 +668,14 @@ const List<double> _helveticaBoldObliqueWidths = <double>[ | @@ -668,14 +668,14 @@ const List<double> _helveticaBoldObliqueWidths = <double>[ | ||
668 | 0.278, | 668 | 0.278, |
669 | 0.556, | 669 | 0.556, |
670 | 0.500, | 670 | 0.500, |
671 | - 1.000, | 671 | + 1, |
672 | 0.556, | 672 | 0.556, |
673 | 0.556, | 673 | 0.556, |
674 | 0.333, | 674 | 0.333, |
675 | - 1.000, | 675 | + 1, |
676 | 0.667, | 676 | 0.667, |
677 | 0.333, | 677 | 0.333, |
678 | - 1.000, | 678 | + 1, |
679 | 0.350, | 679 | 0.350, |
680 | 0.611, | 680 | 0.611, |
681 | 0.350, | 681 | 0.350, |
@@ -686,9 +686,9 @@ const List<double> _helveticaBoldObliqueWidths = <double>[ | @@ -686,9 +686,9 @@ const List<double> _helveticaBoldObliqueWidths = <double>[ | ||
686 | 0.500, | 686 | 0.500, |
687 | 0.350, | 687 | 0.350, |
688 | 0.556, | 688 | 0.556, |
689 | - 1.000, | 689 | + 1, |
690 | 0.333, | 690 | 0.333, |
691 | - 1.000, | 691 | + 1, |
692 | 0.556, | 692 | 0.556, |
693 | 0.333, | 693 | 0.333, |
694 | 0.944, | 694 | 0.944, |
@@ -733,7 +733,7 @@ const List<double> _helveticaBoldObliqueWidths = <double>[ | @@ -733,7 +733,7 @@ const List<double> _helveticaBoldObliqueWidths = <double>[ | ||
733 | 0.722, | 733 | 0.722, |
734 | 0.722, | 734 | 0.722, |
735 | 0.722, | 735 | 0.722, |
736 | - 1.000, | 736 | + 1, |
737 | 0.722, | 737 | 0.722, |
738 | 0.667, | 738 | 0.667, |
739 | 0.667, | 739 | 0.667, |
@@ -927,14 +927,14 @@ const List<double> _helveticaObliqueWidths = <double>[ | @@ -927,14 +927,14 @@ const List<double> _helveticaObliqueWidths = <double>[ | ||
927 | 0.222, | 927 | 0.222, |
928 | 0.556, | 928 | 0.556, |
929 | 0.333, | 929 | 0.333, |
930 | - 1.000, | 930 | + 1, |
931 | 0.556, | 931 | 0.556, |
932 | 0.556, | 932 | 0.556, |
933 | 0.333, | 933 | 0.333, |
934 | - 1.000, | 934 | + 1, |
935 | 0.667, | 935 | 0.667, |
936 | 0.333, | 936 | 0.333, |
937 | - 1.000, | 937 | + 1, |
938 | 0.350, | 938 | 0.350, |
939 | 0.611, | 939 | 0.611, |
940 | 0.350, | 940 | 0.350, |
@@ -945,9 +945,9 @@ const List<double> _helveticaObliqueWidths = <double>[ | @@ -945,9 +945,9 @@ const List<double> _helveticaObliqueWidths = <double>[ | ||
945 | 0.333, | 945 | 0.333, |
946 | 0.350, | 946 | 0.350, |
947 | 0.556, | 947 | 0.556, |
948 | - 1.000, | 948 | + 1, |
949 | 0.333, | 949 | 0.333, |
950 | - 1.000, | 950 | + 1, |
951 | 0.500, | 951 | 0.500, |
952 | 0.333, | 952 | 0.333, |
953 | 0.944, | 953 | 0.944, |
@@ -992,7 +992,7 @@ const List<double> _helveticaObliqueWidths = <double>[ | @@ -992,7 +992,7 @@ const List<double> _helveticaObliqueWidths = <double>[ | ||
992 | 0.667, | 992 | 0.667, |
993 | 0.667, | 993 | 0.667, |
994 | 0.667, | 994 | 0.667, |
995 | - 1.000, | 995 | + 1, |
996 | 0.722, | 996 | 0.722, |
997 | 0.667, | 997 | 0.667, |
998 | 0.667, | 998 | 0.667, |
@@ -1186,11 +1186,11 @@ const List<double> _timesWidths = <double>[ | @@ -1186,11 +1186,11 @@ const List<double> _timesWidths = <double>[ | ||
1186 | 0.333, | 1186 | 0.333, |
1187 | 0.500, | 1187 | 0.500, |
1188 | 0.444, | 1188 | 0.444, |
1189 | - 1.000, | 1189 | + 1, |
1190 | 0.500, | 1190 | 0.500, |
1191 | 0.500, | 1191 | 0.500, |
1192 | 0.333, | 1192 | 0.333, |
1193 | - 1.000, | 1193 | + 1, |
1194 | 0.556, | 1194 | 0.556, |
1195 | 0.333, | 1195 | 0.333, |
1196 | 0.889, | 1196 | 0.889, |
@@ -1204,7 +1204,7 @@ const List<double> _timesWidths = <double>[ | @@ -1204,7 +1204,7 @@ const List<double> _timesWidths = <double>[ | ||
1204 | 0.444, | 1204 | 0.444, |
1205 | 0.350, | 1205 | 0.350, |
1206 | 0.500, | 1206 | 0.500, |
1207 | - 1.000, | 1207 | + 1, |
1208 | 0.333, | 1208 | 0.333, |
1209 | 0.980, | 1209 | 0.980, |
1210 | 0.389, | 1210 | 0.389, |
@@ -1349,7 +1349,7 @@ const List<double> _timesBoldWidths = <double>[ | @@ -1349,7 +1349,7 @@ const List<double> _timesBoldWidths = <double>[ | ||
1349 | 0.555, | 1349 | 0.555, |
1350 | 0.500, | 1350 | 0.500, |
1351 | 0.500, | 1351 | 0.500, |
1352 | - 1.000, | 1352 | + 1, |
1353 | 0.833, | 1353 | 0.833, |
1354 | 0.278, | 1354 | 0.278, |
1355 | 0.333, | 1355 | 0.333, |
@@ -1399,7 +1399,7 @@ const List<double> _timesBoldWidths = <double>[ | @@ -1399,7 +1399,7 @@ const List<double> _timesBoldWidths = <double>[ | ||
1399 | 0.667, | 1399 | 0.667, |
1400 | 0.722, | 1400 | 0.722, |
1401 | 0.722, | 1401 | 0.722, |
1402 | - 1.000, | 1402 | + 1, |
1403 | 0.722, | 1403 | 0.722, |
1404 | 0.722, | 1404 | 0.722, |
1405 | 0.667, | 1405 | 0.667, |
@@ -1445,14 +1445,14 @@ const List<double> _timesBoldWidths = <double>[ | @@ -1445,14 +1445,14 @@ const List<double> _timesBoldWidths = <double>[ | ||
1445 | 0.333, | 1445 | 0.333, |
1446 | 0.500, | 1446 | 0.500, |
1447 | 0.500, | 1447 | 0.500, |
1448 | - 1.000, | 1448 | + 1, |
1449 | 0.500, | 1449 | 0.500, |
1450 | 0.500, | 1450 | 0.500, |
1451 | 0.333, | 1451 | 0.333, |
1452 | - 1.000, | 1452 | + 1, |
1453 | 0.556, | 1453 | 0.556, |
1454 | 0.333, | 1454 | 0.333, |
1455 | - 1.000, | 1455 | + 1, |
1456 | 0.350, | 1456 | 0.350, |
1457 | 0.667, | 1457 | 0.667, |
1458 | 0.350, | 1458 | 0.350, |
@@ -1463,9 +1463,9 @@ const List<double> _timesBoldWidths = <double>[ | @@ -1463,9 +1463,9 @@ const List<double> _timesBoldWidths = <double>[ | ||
1463 | 0.500, | 1463 | 0.500, |
1464 | 0.350, | 1464 | 0.350, |
1465 | 0.500, | 1465 | 0.500, |
1466 | - 1.000, | 1466 | + 1, |
1467 | 0.333, | 1467 | 0.333, |
1468 | - 1.000, | 1468 | + 1, |
1469 | 0.389, | 1469 | 0.389, |
1470 | 0.333, | 1470 | 0.333, |
1471 | 0.722, | 1471 | 0.722, |
@@ -1510,7 +1510,7 @@ const List<double> _timesBoldWidths = <double>[ | @@ -1510,7 +1510,7 @@ const List<double> _timesBoldWidths = <double>[ | ||
1510 | 0.722, | 1510 | 0.722, |
1511 | 0.722, | 1511 | 0.722, |
1512 | 0.722, | 1512 | 0.722, |
1513 | - 1.000, | 1513 | + 1, |
1514 | 0.722, | 1514 | 0.722, |
1515 | 0.667, | 1515 | 0.667, |
1516 | 0.667, | 1516 | 0.667, |
@@ -1704,11 +1704,11 @@ const List<double> _timesBoldItalicWidths = <double>[ | @@ -1704,11 +1704,11 @@ const List<double> _timesBoldItalicWidths = <double>[ | ||
1704 | 0.333, | 1704 | 0.333, |
1705 | 0.500, | 1705 | 0.500, |
1706 | 0.500, | 1706 | 0.500, |
1707 | - 1.000, | 1707 | + 1, |
1708 | 0.500, | 1708 | 0.500, |
1709 | 0.500, | 1709 | 0.500, |
1710 | 0.333, | 1710 | 0.333, |
1711 | - 1.000, | 1711 | + 1, |
1712 | 0.556, | 1712 | 0.556, |
1713 | 0.333, | 1713 | 0.333, |
1714 | 0.944, | 1714 | 0.944, |
@@ -1722,9 +1722,9 @@ const List<double> _timesBoldItalicWidths = <double>[ | @@ -1722,9 +1722,9 @@ const List<double> _timesBoldItalicWidths = <double>[ | ||
1722 | 0.500, | 1722 | 0.500, |
1723 | 0.350, | 1723 | 0.350, |
1724 | 0.500, | 1724 | 0.500, |
1725 | - 1.000, | 1725 | + 1, |
1726 | 0.333, | 1726 | 0.333, |
1727 | - 1.000, | 1727 | + 1, |
1728 | 0.389, | 1728 | 0.389, |
1729 | 0.333, | 1729 | 0.333, |
1730 | 0.722, | 1730 | 0.722, |
@@ -1967,7 +1967,7 @@ const List<double> _timesItalicWidths = <double>[ | @@ -1967,7 +1967,7 @@ const List<double> _timesItalicWidths = <double>[ | ||
1967 | 0.500, | 1967 | 0.500, |
1968 | 0.500, | 1968 | 0.500, |
1969 | 0.333, | 1969 | 0.333, |
1970 | - 1.000, | 1970 | + 1, |
1971 | 0.500, | 1971 | 0.500, |
1972 | 0.333, | 1972 | 0.333, |
1973 | 0.944, | 1973 | 0.944, |
@@ -2277,9 +2277,9 @@ const List<double> _symbolWidths = <double>[ | @@ -2277,9 +2277,9 @@ const List<double> _symbolWidths = <double>[ | ||
2277 | 0.549, | 2277 | 0.549, |
2278 | 0.549, | 2278 | 0.549, |
2279 | 0.549, | 2279 | 0.549, |
2280 | - 1.000, | 2280 | + 1, |
2281 | 0.603, | 2281 | 0.603, |
2282 | - 1.000, | 2282 | + 1, |
2283 | 0.658, | 2283 | 0.658, |
2284 | 0.823, | 2284 | 0.823, |
2285 | 0.686, | 2285 | 0.686, |
@@ -141,7 +141,7 @@ class Transform extends SingleChildWidget { | @@ -141,7 +141,7 @@ class Transform extends SingleChildWidget { | ||
141 | Transform.translate({ | 141 | Transform.translate({ |
142 | @required PdfPoint offset, | 142 | @required PdfPoint offset, |
143 | Widget child, | 143 | Widget child, |
144 | - }) : transform = Matrix4.translationValues(offset.x, offset.y, 0.0), | 144 | + }) : transform = Matrix4.translationValues(offset.x, offset.y, 0), |
145 | origin = null, | 145 | origin = null, |
146 | alignment = null, | 146 | alignment = null, |
147 | super(child: child); | 147 | super(child: child); |
@@ -152,7 +152,7 @@ class Transform extends SingleChildWidget { | @@ -152,7 +152,7 @@ class Transform extends SingleChildWidget { | ||
152 | this.origin, | 152 | this.origin, |
153 | this.alignment = Alignment.center, | 153 | this.alignment = Alignment.center, |
154 | Widget child, | 154 | Widget child, |
155 | - }) : transform = Matrix4.diagonal3Values(scale, scale, 1.0), | 155 | + }) : transform = Matrix4.diagonal3Values(scale, scale, 1), |
156 | super(child: child); | 156 | super(child: child); |
157 | 157 | ||
158 | /// The matrix to transform the child by during painting. | 158 | /// The matrix to transform the child by during painting. |
@@ -329,8 +329,8 @@ class FittedBox extends SingleChildWidget { | @@ -329,8 +329,8 @@ class FittedBox extends SingleChildWidget { | ||
329 | alignment.inscribe(sizes.destination, box); | 329 | alignment.inscribe(sizes.destination, box); |
330 | 330 | ||
331 | final Matrix4 mat = | 331 | final Matrix4 mat = |
332 | - Matrix4.translationValues(destinationRect.x, destinationRect.y, 0.0) | ||
333 | - ..scale(scaleX, scaleY, 1.0) | 332 | + Matrix4.translationValues(destinationRect.x, destinationRect.y, 0) |
333 | + ..scale(scaleX, scaleY, 1) | ||
334 | ..translate(-sourceRect.x, -sourceRect.y); | 334 | ..translate(-sourceRect.x, -sourceRect.y); |
335 | 335 | ||
336 | context.canvas | 336 | context.canvas |
@@ -211,8 +211,8 @@ class Container extends StatelessWidget { | @@ -211,8 +211,8 @@ class Container extends StatelessWidget { | ||
211 | 211 | ||
212 | if (child == null && (constraints == null || !constraints.isTight)) { | 212 | if (child == null && (constraints == null || !constraints.isTight)) { |
213 | current = LimitedBox( | 213 | current = LimitedBox( |
214 | - maxWidth: 0.0, | ||
215 | - maxHeight: 0.0, | 214 | + maxWidth: 0, |
215 | + maxHeight: 0, | ||
216 | child: ConstrainedBox(constraints: const BoxConstraints.expand())); | 216 | child: ConstrainedBox(constraints: const BoxConstraints.expand())); |
217 | } | 217 | } |
218 | 218 |
@@ -52,7 +52,7 @@ class Header extends StatelessWidget { | @@ -52,7 +52,7 @@ class Header extends StatelessWidget { | ||
52 | _margin ??= const EdgeInsets.only(bottom: 5.0 * PdfPageFormat.mm); | 52 | _margin ??= const EdgeInsets.only(bottom: 5.0 * PdfPageFormat.mm); |
53 | _padding ??= const EdgeInsets.only(bottom: 1.0 * PdfPageFormat.mm); | 53 | _padding ??= const EdgeInsets.only(bottom: 1.0 * PdfPageFormat.mm); |
54 | _decoration ??= | 54 | _decoration ??= |
55 | - const BoxDecoration(border: BoxBorder(bottom: true, width: 1.0)); | 55 | + const BoxDecoration(border: BoxBorder(bottom: true, width: 1)); |
56 | _textStyle ??= Theme.of(context).header0; | 56 | _textStyle ??= Theme.of(context).header0; |
57 | break; | 57 | break; |
58 | case 1: | 58 | case 1: |
@@ -67,10 +67,10 @@ class Page extends BasePage { | @@ -67,10 +67,10 @@ class Page extends BasePage { | ||
67 | void debugPaint(Context context) { | 67 | void debugPaint(Context context) { |
68 | context.canvas | 68 | context.canvas |
69 | ..setFillColor(PdfColor.lightGreen) | 69 | ..setFillColor(PdfColor.lightGreen) |
70 | - ..moveTo(0.0, 0.0) | ||
71 | - ..lineTo(pageFormat.width, 0.0) | 70 | + ..moveTo(0, 0) |
71 | + ..lineTo(pageFormat.width, 0) | ||
72 | ..lineTo(pageFormat.width, pageFormat.height) | 72 | ..lineTo(pageFormat.width, pageFormat.height) |
73 | - ..lineTo(0.0, pageFormat.height) | 73 | + ..lineTo(0, pageFormat.height) |
74 | ..moveTo(margin.left, margin.bottom) | 74 | ..moveTo(margin.left, margin.bottom) |
75 | ..lineTo(margin.left, pageFormat.height - margin.top) | 75 | ..lineTo(margin.left, pageFormat.height - margin.top) |
76 | ..lineTo(pageFormat.width - margin.right, pageFormat.height - margin.top) | 76 | ..lineTo(pageFormat.width - margin.right, pageFormat.height - margin.top) |
@@ -89,9 +89,9 @@ class Flex extends MultiChildWidget { | @@ -89,9 +89,9 @@ class Flex extends MultiChildWidget { | ||
89 | // INTRINSIC MAIN SIZE | 89 | // INTRINSIC MAIN SIZE |
90 | // Intrinsic main size is the smallest size the flex container can take | 90 | // Intrinsic main size is the smallest size the flex container can take |
91 | // while maintaining the min/max-content contributions of its flex items. | 91 | // while maintaining the min/max-content contributions of its flex items. |
92 | - double totalFlex = 0.0; | ||
93 | - double inflexibleSpace = 0.0; | ||
94 | - double maxFlexFractionSoFar = 0.0; | 92 | + double totalFlex = 0; |
93 | + double inflexibleSpace = 0; | ||
94 | + double maxFlexFractionSoFar = 0; | ||
95 | 95 | ||
96 | for (Widget child in children) { | 96 | for (Widget child in children) { |
97 | final int flex = child is Expanded ? child.flex : 0; | 97 | final int flex = child is Expanded ? child.flex : 0; |
@@ -113,8 +113,8 @@ class Flex extends MultiChildWidget { | @@ -113,8 +113,8 @@ class Flex extends MultiChildWidget { | ||
113 | // Get inflexible space using the max intrinsic dimensions of fixed children in the main direction. | 113 | // Get inflexible space using the max intrinsic dimensions of fixed children in the main direction. |
114 | final double availableMainSpace = extent; | 114 | final double availableMainSpace = extent; |
115 | int totalFlex = 0; | 115 | int totalFlex = 0; |
116 | - double inflexibleSpace = 0.0; | ||
117 | - double maxCrossSize = 0.0; | 116 | + double inflexibleSpace = 0; |
117 | + double maxCrossSize = 0; | ||
118 | for (Widget child in children) { | 118 | for (Widget child in children) { |
119 | final int flex = child is Expanded ? child.flex : 0; | 119 | final int flex = child is Expanded ? child.flex : 0; |
120 | totalFlex += flex; | 120 | totalFlex += flex; |
@@ -139,7 +139,7 @@ class Flex extends MultiChildWidget { | @@ -139,7 +139,7 @@ class Flex extends MultiChildWidget { | ||
139 | // Determine the spacePerFlex by allocating the remaining available space. | 139 | // Determine the spacePerFlex by allocating the remaining available space. |
140 | // When you're over-constrained spacePerFlex can be negative. | 140 | // When you're over-constrained spacePerFlex can be negative. |
141 | final double spacePerFlex = | 141 | final double spacePerFlex = |
142 | - math.max(0.0, (availableMainSpace - inflexibleSpace) / totalFlex); | 142 | + math.max(0, (availableMainSpace - inflexibleSpace) / totalFlex); |
143 | 143 | ||
144 | // Size remaining (flexible) items, find the maximum cross size. | 144 | // Size remaining (flexible) items, find the maximum cross size. |
145 | for (Widget child in children) { | 145 | for (Widget child in children) { |
@@ -214,9 +214,8 @@ class Flex extends MultiChildWidget { | @@ -214,9 +214,8 @@ class Flex extends MultiChildWidget { | ||
214 | : constraints.maxHeight; | 214 | : constraints.maxHeight; |
215 | final bool canFlex = maxMainSize < double.infinity; | 215 | final bool canFlex = maxMainSize < double.infinity; |
216 | 216 | ||
217 | - double crossSize = 0.0; | ||
218 | - double allocatedSize = | ||
219 | - 0.0; // Sum of the sizes of the non-flexible children. | 217 | + double crossSize = 0; |
218 | + double allocatedSize = 0; // Sum of the sizes of the non-flexible children. | ||
220 | 219 | ||
221 | for (Widget child in children) { | 220 | for (Widget child in children) { |
222 | final int flex = child is Expanded ? child.flex : 0; | 221 | final int flex = child is Expanded ? child.flex : 0; |
@@ -269,8 +268,8 @@ class Flex extends MultiChildWidget { | @@ -269,8 +268,8 @@ class Flex extends MultiChildWidget { | ||
269 | 268 | ||
270 | // Distribute free space to flexible children, and determine baseline. | 269 | // Distribute free space to flexible children, and determine baseline. |
271 | final double freeSpace = | 270 | final double freeSpace = |
272 | - math.max(0.0, (canFlex ? maxMainSize : 0.0) - allocatedSize); | ||
273 | - double allocatedFlexSpace = 0.0; | 271 | + math.max(0, (canFlex ? maxMainSize : 0.0) - allocatedSize); |
272 | + double allocatedFlexSpace = 0; | ||
274 | if (totalFlex > 0) { | 273 | if (totalFlex > 0) { |
275 | final double spacePerFlex = | 274 | final double spacePerFlex = |
276 | canFlex && totalFlex > 0 ? (freeSpace / totalFlex) : double.nan; | 275 | canFlex && totalFlex > 0 ? (freeSpace / totalFlex) : double.nan; |
@@ -362,7 +361,7 @@ class Flex extends MultiChildWidget { | @@ -362,7 +361,7 @@ class Flex extends MultiChildWidget { | ||
362 | box = PdfRect.fromPoints(PdfPoint.zero, size); | 361 | box = PdfRect.fromPoints(PdfPoint.zero, size); |
363 | actualSizeDelta = actualSize - allocatedSize; | 362 | actualSizeDelta = actualSize - allocatedSize; |
364 | 363 | ||
365 | - final double remainingSpace = math.max(0.0, actualSizeDelta); | 364 | + final double remainingSpace = math.max(0, actualSizeDelta); |
366 | double leadingSpace; | 365 | double leadingSpace; |
367 | double betweenSpace; | 366 | double betweenSpace; |
368 | final bool flipMainAxis = (verticalDirection == VerticalDirection.down && | 367 | final bool flipMainAxis = (verticalDirection == VerticalDirection.down && |
@@ -74,7 +74,7 @@ class BoxConstraints { | @@ -74,7 +74,7 @@ class BoxConstraints { | ||
74 | PdfPoint get biggest => PdfPoint(constrainWidth(), constrainHeight()); | 74 | PdfPoint get biggest => PdfPoint(constrainWidth(), constrainHeight()); |
75 | 75 | ||
76 | /// The smallest size that satisfies the constraints. | 76 | /// The smallest size that satisfies the constraints. |
77 | - PdfPoint get smallest => PdfPoint(constrainWidth(0.0), constrainHeight(0.0)); | 77 | + PdfPoint get smallest => PdfPoint(constrainWidth(0), constrainHeight(0)); |
78 | 78 | ||
79 | /// Whether there is exactly one width value that satisfies the constraints. | 79 | /// Whether there is exactly one width value that satisfies the constraints. |
80 | bool get hasTightWidth => minWidth >= maxWidth; | 80 | bool get hasTightWidth => minWidth >= maxWidth; |
@@ -162,8 +162,8 @@ class BoxConstraints { | @@ -162,8 +162,8 @@ class BoxConstraints { | ||
162 | assert(edges != null); | 162 | assert(edges != null); |
163 | final double horizontal = edges.horizontal; | 163 | final double horizontal = edges.horizontal; |
164 | final double vertical = edges.vertical; | 164 | final double vertical = edges.vertical; |
165 | - final double deflatedMinWidth = math.max(0.0, minWidth - horizontal); | ||
166 | - final double deflatedMinHeight = math.max(0.0, minHeight - vertical); | 165 | + final double deflatedMinWidth = math.max(0, minWidth - horizontal); |
166 | + final double deflatedMinHeight = math.max(0, minHeight - vertical); | ||
167 | return BoxConstraints( | 167 | return BoxConstraints( |
168 | minWidth: deflatedMinWidth, | 168 | minWidth: deflatedMinWidth, |
169 | maxWidth: math.max(deflatedMinWidth, maxWidth - horizontal), | 169 | maxWidth: math.max(deflatedMinWidth, maxWidth - horizontal), |
@@ -174,10 +174,11 @@ class BoxConstraints { | @@ -174,10 +174,11 @@ class BoxConstraints { | ||
174 | /// Returns new box constraints that remove the minimum width and height requirements. | 174 | /// Returns new box constraints that remove the minimum width and height requirements. |
175 | BoxConstraints loosen() { | 175 | BoxConstraints loosen() { |
176 | return BoxConstraints( | 176 | return BoxConstraints( |
177 | - minWidth: 0.0, | ||
178 | - maxWidth: maxWidth, | ||
179 | - minHeight: 0.0, | ||
180 | - maxHeight: maxHeight); | 177 | + minWidth: 0, |
178 | + maxWidth: maxWidth, | ||
179 | + minHeight: 0, | ||
180 | + maxHeight: maxHeight, | ||
181 | + ); | ||
181 | } | 182 | } |
182 | 183 | ||
183 | /// Returns new box constraints that respect the given constraints while being | 184 | /// Returns new box constraints that respect the given constraints while being |
@@ -279,31 +280,31 @@ class Alignment { | @@ -279,31 +280,31 @@ class Alignment { | ||
279 | final double y; | 280 | final double y; |
280 | 281 | ||
281 | /// The top left corner. | 282 | /// The top left corner. |
282 | - static const Alignment topLeft = Alignment(-1.0, 1.0); | 283 | + static const Alignment topLeft = Alignment(-1, 1); |
283 | 284 | ||
284 | /// The center point along the top edge. | 285 | /// The center point along the top edge. |
285 | - static const Alignment topCenter = Alignment(0.0, 1.0); | 286 | + static const Alignment topCenter = Alignment(0, 1); |
286 | 287 | ||
287 | /// The top right corner. | 288 | /// The top right corner. |
288 | - static const Alignment topRight = Alignment(1.0, 1.0); | 289 | + static const Alignment topRight = Alignment(1, 1); |
289 | 290 | ||
290 | /// The center point along the left edge. | 291 | /// The center point along the left edge. |
291 | - static const Alignment centerLeft = Alignment(-1.0, 0.0); | 292 | + static const Alignment centerLeft = Alignment(-1, 0); |
292 | 293 | ||
293 | /// The center point, both horizontally and vertically. | 294 | /// The center point, both horizontally and vertically. |
294 | - static const Alignment center = Alignment(0.0, 0.0); | 295 | + static const Alignment center = Alignment(0, 0); |
295 | 296 | ||
296 | /// The center point along the right edge. | 297 | /// The center point along the right edge. |
297 | - static const Alignment centerRight = Alignment(1.0, 0.0); | 298 | + static const Alignment centerRight = Alignment(1, 0); |
298 | 299 | ||
299 | /// The bottom left corner. | 300 | /// The bottom left corner. |
300 | - static const Alignment bottomLeft = Alignment(-1.0, -1.0); | 301 | + static const Alignment bottomLeft = Alignment(-1, -1); |
301 | 302 | ||
302 | /// The center point along the bottom edge. | 303 | /// The center point along the bottom edge. |
303 | - static const Alignment bottomCenter = Alignment(0.0, -1.0); | 304 | + static const Alignment bottomCenter = Alignment(0, -1); |
304 | 305 | ||
305 | /// The bottom right corner. | 306 | /// The bottom right corner. |
306 | - static const Alignment bottomRight = Alignment(1.0, -1.0); | 307 | + static const Alignment bottomRight = Alignment(1, -1); |
307 | 308 | ||
308 | /// Returns the offset that is this fraction within the given size. | 309 | /// Returns the offset that is this fraction within the given size. |
309 | PdfPoint alongSize(PdfPoint other) { | 310 | PdfPoint alongSize(PdfPoint other) { |
@@ -414,7 +415,7 @@ FittedSizes applyBoxFit(BoxFit fit, PdfPoint inputSize, PdfPoint outputSize) { | @@ -414,7 +415,7 @@ FittedSizes applyBoxFit(BoxFit fit, PdfPoint inputSize, PdfPoint outputSize) { | ||
414 | } | 415 | } |
415 | 416 | ||
416 | PdfPoint transformPoint(Matrix4 transform, PdfPoint point) { | 417 | PdfPoint transformPoint(Matrix4 transform, PdfPoint point) { |
417 | - final Vector3 position3 = Vector3(point.x, point.y, 0.0); | 418 | + final Vector3 position3 = Vector3(point.x, point.y, 0); |
418 | final Vector3 transformed3 = transform.perspectiveTransform(position3); | 419 | final Vector3 transformed3 = transform.perspectiveTransform(position3); |
419 | return PdfPoint(transformed3.x, transformed3.y); | 420 | return PdfPoint(transformed3.x, transformed3.y); |
420 | } | 421 | } |
@@ -70,7 +70,7 @@ class GridView extends MultiChildWidget { | @@ -70,7 +70,7 @@ class GridView extends MultiChildWidget { | ||
70 | crossAxisSpacing; | 70 | crossAxisSpacing; |
71 | 71 | ||
72 | final double startX = padding.left; | 72 | final double startX = padding.left; |
73 | - const double startY = 0.0; | 73 | + const double startY = 0; |
74 | double mainAxis; | 74 | double mainAxis; |
75 | double crossAxis; | 75 | double crossAxis; |
76 | BoxConstraints innerConstraints; | 76 | BoxConstraints innerConstraints; |
@@ -167,7 +167,7 @@ class GridView extends MultiChildWidget { | @@ -167,7 +167,7 @@ class GridView extends MultiChildWidget { | ||
167 | (_childCrossAxis + crossAxisSpacing) * c - | 167 | (_childCrossAxis + crossAxisSpacing) * c - |
168 | crossAxisSpacing, | 168 | crossAxisSpacing, |
169 | box.bottom + padding.bottom, | 169 | box.bottom + padding.bottom, |
170 | - math.max(crossAxisSpacing, 1.0), | 170 | + math.max(crossAxisSpacing, 1), |
171 | box.height - padding.vertical) | 171 | box.height - padding.vertical) |
172 | ..fillPath(); | 172 | ..fillPath(); |
173 | break; | 173 | break; |
@@ -187,7 +187,7 @@ class GridView extends MultiChildWidget { | @@ -187,7 +187,7 @@ class GridView extends MultiChildWidget { | ||
187 | (_childMainAxis + mainAxisSpacing) * c - | 187 | (_childMainAxis + mainAxisSpacing) * c - |
188 | mainAxisSpacing, | 188 | mainAxisSpacing, |
189 | box.width - padding.horizontal, | 189 | box.width - padding.horizontal, |
190 | - math.max(mainAxisSpacing, 1.0)) | 190 | + math.max(mainAxisSpacing, 1)) |
191 | ..fillPath(); | 191 | ..fillPath(); |
192 | break; | 192 | break; |
193 | case Axis.horizontal: | 193 | case Axis.horizontal: |
@@ -35,8 +35,8 @@ class Placeholder extends Widget { | @@ -35,8 +35,8 @@ class Placeholder extends Widget { | ||
35 | void layout(Context context, BoxConstraints constraints, | 35 | void layout(Context context, BoxConstraints constraints, |
36 | {bool parentUsesSize = false}) { | 36 | {bool parentUsesSize = false}) { |
37 | box = PdfRect( | 37 | box = PdfRect( |
38 | - 0.0, | ||
39 | - 0.0, | 38 | + 0, |
39 | + 0, | ||
40 | constraints.constrainWidth( | 40 | constraints.constrainWidth( |
41 | constraints.hasBoundedWidth ? constraints.maxWidth : fallbackWidth), | 41 | constraints.hasBoundedWidth ? constraints.maxWidth : fallbackWidth), |
42 | constraints.constrainHeight(constraints.hasBoundedHeight | 42 | constraints.constrainHeight(constraints.hasBoundedHeight |
@@ -71,7 +71,7 @@ class PdfLogo extends StatelessWidget { | @@ -71,7 +71,7 @@ class PdfLogo extends StatelessWidget { | ||
71 | 71 | ||
72 | @override | 72 | @override |
73 | Widget build(Context context) { | 73 | Widget build(Context context) { |
74 | - return Shape(pdf, width: 24.0, height: 27.0, fillColor: color, fit: fit); | 74 | + return Shape(pdf, width: 24, height: 27, fillColor: color, fit: fit); |
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 |
@@ -186,7 +186,7 @@ class Table extends Widget implements SpanningWidget { | @@ -186,7 +186,7 @@ class Table extends Widget implements SpanningWidget { | ||
186 | // Compute column widths using flex and estimated width | 186 | // Compute column widths using flex and estimated width |
187 | if (constraints.hasBoundedWidth) { | 187 | if (constraints.hasBoundedWidth) { |
188 | final double totalFlex = flex.reduce((double a, double b) => a + b); | 188 | final double totalFlex = flex.reduce((double a, double b) => a + b); |
189 | - double flexSpace = 0.0; | 189 | + double flexSpace = 0; |
190 | for (int n = 0; n < _widths.length; n++) { | 190 | for (int n = 0; n < _widths.length; n++) { |
191 | if (flex[n] == 0.0) { | 191 | if (flex[n] == 0.0) { |
192 | final double newWidth = _widths[n] / maxWidth * constraints.maxWidth; | 192 | final double newWidth = _widths[n] / maxWidth * constraints.maxWidth; |
@@ -212,7 +212,7 @@ class Table extends Widget implements SpanningWidget { | @@ -212,7 +212,7 @@ class Table extends Widget implements SpanningWidget { | ||
212 | final double totalWidth = _widths.reduce((double a, double b) => a + b); | 212 | final double totalWidth = _widths.reduce((double a, double b) => a + b); |
213 | 213 | ||
214 | // Compute final widths | 214 | // Compute final widths |
215 | - double totalHeight = 0.0; | 215 | + double totalHeight = 0; |
216 | index = 0; | 216 | index = 0; |
217 | for (TableRow row in children) { | 217 | for (TableRow row in children) { |
218 | if (index++ < _context.firstLine && !row.repeat) { | 218 | if (index++ < _context.firstLine && !row.repeat) { |
@@ -220,9 +220,9 @@ class Table extends Widget implements SpanningWidget { | @@ -220,9 +220,9 @@ class Table extends Widget implements SpanningWidget { | ||
220 | } | 220 | } |
221 | 221 | ||
222 | int n = 0; | 222 | int n = 0; |
223 | - double x = 0.0; | 223 | + double x = 0; |
224 | 224 | ||
225 | - double lineHeight = 0.0; | 225 | + double lineHeight = 0; |
226 | for (Widget child in row.children) { | 226 | for (Widget child in row.children) { |
227 | final BoxConstraints childConstraints = | 227 | final BoxConstraints childConstraints = |
228 | BoxConstraints.tightFor(width: _widths[n]); | 228 | BoxConstraints.tightFor(width: _widths[n]); |
@@ -262,7 +262,7 @@ class Table extends Widget implements SpanningWidget { | @@ -262,7 +262,7 @@ class Table extends Widget implements SpanningWidget { | ||
262 | } | 262 | } |
263 | } | 263 | } |
264 | 264 | ||
265 | - box = PdfRect(0.0, 0.0, totalWidth, totalHeight); | 265 | + box = PdfRect(0, 0, totalWidth, totalHeight); |
266 | } | 266 | } |
267 | 267 | ||
268 | @override | 268 | @override |
@@ -35,7 +35,7 @@ class _Word { | @@ -35,7 +35,7 @@ class _Word { | ||
35 | } | 35 | } |
36 | 36 | ||
37 | void debugPaint(Context context, double textScaleFactor, PdfRect globalBox) { | 37 | void debugPaint(Context context, double textScaleFactor, PdfRect globalBox) { |
38 | - const double deb = 5.0; | 38 | + const double deb = 5; |
39 | 39 | ||
40 | context.canvas | 40 | context.canvas |
41 | ..drawRect(globalBox.x + offset.x + metrics.left, | 41 | ..drawRect(globalBox.x + offset.x + metrics.left, |
@@ -111,7 +111,7 @@ class RichText extends Widget { | @@ -111,7 +111,7 @@ class RichText extends Widget { | ||
111 | 111 | ||
112 | double _realignLine(List<_Word> words, double totalWidth, double wordsWidth, | 112 | double _realignLine(List<_Word> words, double totalWidth, double wordsWidth, |
113 | bool last, double baseline) { | 113 | bool last, double baseline) { |
114 | - double delta = 0.0; | 114 | + double delta = 0; |
115 | switch (textAlign) { | 115 | switch (textAlign) { |
116 | case TextAlign.left: | 116 | case TextAlign.left: |
117 | totalWidth = wordsWidth; | 117 | totalWidth = wordsWidth; |
@@ -128,7 +128,7 @@ class RichText extends Widget { | @@ -128,7 +128,7 @@ class RichText extends Widget { | ||
128 | break; | 128 | break; |
129 | } | 129 | } |
130 | delta = (totalWidth - wordsWidth) / (words.length - 1); | 130 | delta = (totalWidth - wordsWidth) / (words.length - 1); |
131 | - double x = 0.0; | 131 | + double x = 0; |
132 | for (_Word word in words) { | 132 | for (_Word word in words) { |
133 | word.offset = word.offset.translate(x, -baseline); | 133 | word.offset = word.offset.translate(x, -baseline); |
134 | x += delta; | 134 | x += delta; |
@@ -156,9 +156,9 @@ class RichText extends Widget { | @@ -156,9 +156,9 @@ class RichText extends Widget { | ||
156 | ? constraints.maxHeight | 156 | ? constraints.maxHeight |
157 | : constraints.constrainHeight(); | 157 | : constraints.constrainHeight(); |
158 | 158 | ||
159 | - double offsetX = 0.0; | ||
160 | - double offsetY = 0.0; | ||
161 | - double width = 0.0; | 159 | + double offsetX = 0; |
160 | + double offsetY = 0; | ||
161 | + double width = 0; | ||
162 | double top; | 162 | double top; |
163 | double bottom; | 163 | double bottom; |
164 | 164 | ||
@@ -230,7 +230,7 @@ class RichText extends Widget { | @@ -230,7 +230,7 @@ class RichText extends Widget { | ||
230 | bottom ??= 0.0; | 230 | bottom ??= 0.0; |
231 | top ??= 0.0; | 231 | top ??= 0.0; |
232 | 232 | ||
233 | - box = PdfRect(0.0, 0.0, constraints.constrainWidth(width), | 233 | + box = PdfRect(0, 0, constraints.constrainWidth(width), |
234 | constraints.constrainHeight(offsetY + bottom - top)); | 234 | constraints.constrainHeight(offsetY + bottom - top)); |
235 | } | 235 | } |
236 | 236 |
@@ -104,8 +104,8 @@ class Theme extends Inherited { | @@ -104,8 +104,8 @@ class Theme extends Inherited { | ||
104 | return Theme( | 104 | return Theme( |
105 | defaultTextStyle: defaultTextStyle, | 105 | defaultTextStyle: defaultTextStyle, |
106 | defaultTextStyleBold: defaultTextStyleBold, | 106 | defaultTextStyleBold: defaultTextStyleBold, |
107 | - paragraphStyle: defaultTextStyle.copyWith(lineSpacing: 5.0), | ||
108 | - bulletStyle: defaultTextStyle.copyWith(lineSpacing: 5.0), | 107 | + paragraphStyle: defaultTextStyle.copyWith(lineSpacing: 5), |
108 | + bulletStyle: defaultTextStyle.copyWith(lineSpacing: 5), | ||
109 | header0: defaultTextStyleBold.copyWith(fontSize: fontSize * 2.0), | 109 | header0: defaultTextStyleBold.copyWith(fontSize: fontSize * 2.0), |
110 | header1: defaultTextStyleBold.copyWith(fontSize: fontSize * 1.5), | 110 | header1: defaultTextStyleBold.copyWith(fontSize: fontSize * 1.5), |
111 | header2: defaultTextStyleBold.copyWith(fontSize: fontSize * 1.4), | 111 | header2: defaultTextStyleBold.copyWith(fontSize: fontSize * 1.4), |
@@ -2,10 +2,12 @@ name: pdf | @@ -2,10 +2,12 @@ name: pdf | ||
2 | author: David PHAM-VAN <dev.nfet.net@gmail.com> | 2 | author: David PHAM-VAN <dev.nfet.net@gmail.com> |
3 | description: A pdf producer for Dart. It can create pdf files for both web or flutter. | 3 | description: A pdf producer for Dart. It can create pdf files for both web or flutter. |
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 | ||
6 | +issue_tracker: https://github.com/DavBfr/dart_pdf/issues | ||
5 | version: 1.3.3 | 7 | version: 1.3.3 |
6 | 8 | ||
7 | environment: | 9 | environment: |
8 | - sdk: ">=1.8.0 <3.0.0" | 10 | + sdk: ">=2.1.0 <3.0.0" |
9 | 11 | ||
10 | dependencies: | 12 | dependencies: |
11 | meta: "^1.1.5" | 13 | meta: "^1.1.5" |
@@ -23,18 +23,17 @@ void main() { | @@ -23,18 +23,17 @@ void main() { | ||
23 | test('Pdf', () { | 23 | test('Pdf', () { |
24 | final PdfDocument pdf = PdfDocument(); | 24 | final PdfDocument pdf = PdfDocument(); |
25 | final PdfPage page = | 25 | final PdfPage page = |
26 | - PdfPage(pdf, pageFormat: const PdfPageFormat(500.0, 300.0)); | 26 | + PdfPage(pdf, pageFormat: const PdfPageFormat(500, 300)); |
27 | final PdfPage page1 = | 27 | final PdfPage page1 = |
28 | - PdfPage(pdf, pageFormat: const PdfPageFormat(500.0, 300.0)); | 28 | + PdfPage(pdf, pageFormat: const PdfPageFormat(500, 300)); |
29 | 29 | ||
30 | final PdfGraphics g = page.getGraphics(); | 30 | final PdfGraphics g = page.getGraphics(); |
31 | 31 | ||
32 | PdfAnnot.text(page, | 32 | PdfAnnot.text(page, |
33 | - content: 'Hello', rect: const PdfRect(100.0, 100.0, 50.0, 50.0)); | 33 | + content: 'Hello', rect: const PdfRect(100, 100, 50, 50)); |
34 | 34 | ||
35 | - PdfAnnot.link(page, | ||
36 | - dest: page1, srcRect: const PdfRect(100.0, 150.0, 50.0, 50.0)); | ||
37 | - g.drawRect(100.0, 150.0, 50.0, 50.0); | 35 | + PdfAnnot.link(page, dest: page1, srcRect: const PdfRect(100, 150, 50, 50)); |
36 | + g.drawRect(100, 150, 50, 50); | ||
38 | g.strokePath(); | 37 | g.strokePath(); |
39 | 38 | ||
40 | final File file = File('annotations.pdf'); | 39 | final File file = File('annotations.pdf'); |
@@ -34,16 +34,16 @@ void main() { | @@ -34,16 +34,16 @@ void main() { | ||
34 | title: 'My Title', | 34 | title: 'My Title', |
35 | subject: 'My Subject'); | 35 | subject: 'My Subject'); |
36 | final PdfPage page = | 36 | final PdfPage page = |
37 | - PdfPage(pdf, pageFormat: const PdfPageFormat(500.0, 300.0)); | 37 | + PdfPage(pdf, pageFormat: const PdfPageFormat(500, 300)); |
38 | 38 | ||
39 | final PdfGraphics g = page.getGraphics(); | 39 | final PdfGraphics g = page.getGraphics(); |
40 | 40 | ||
41 | g.saveContext(); | 41 | g.saveContext(); |
42 | Matrix4 tm = Matrix4.identity(); | 42 | Matrix4 tm = Matrix4.identity(); |
43 | - tm.translate(10.0, 290.0); | ||
44 | - tm.scale(1.0, -1.0); | 43 | + tm.translate(10.0, 290); |
44 | + tm.scale(1.0, -1); | ||
45 | g.setTransform(tm); | 45 | g.setTransform(tm); |
46 | - g.setColor(const PdfColor(0.0, 0.0, 0.0)); | 46 | + g.setColor(const PdfColor(0, 0, 0)); |
47 | g.drawShape( | 47 | g.drawShape( |
48 | 'M37 0H9C6.24 0 4 2.24 4 5v38c0 2.76 2.24 5 5 5h28c2.76 0 5-2.24 5-5V5c0-2.76-2.24-5-5-5zM23 46c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm15-8H8V6h30v32z', | 48 | 'M37 0H9C6.24 0 4 2.24 4 5v38c0 2.76 2.24 5 5 5h28c2.76 0 5-2.24 5-5V5c0-2.76-2.24-5-5-5zM23 46c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm15-8H8V6h30v32z', |
49 | stroke: false); | 49 | stroke: false); |
@@ -52,10 +52,10 @@ void main() { | @@ -52,10 +52,10 @@ void main() { | ||
52 | 52 | ||
53 | g.saveContext(); | 53 | g.saveContext(); |
54 | tm = Matrix4.identity(); | 54 | tm = Matrix4.identity(); |
55 | - tm.translate(200.0, 290.0); | 55 | + tm.translate(200.0, 290); |
56 | tm.scale(.1, -.1); | 56 | tm.scale(.1, -.1); |
57 | g.setTransform(tm); | 57 | g.setTransform(tm); |
58 | - g.setColor(const PdfColor(0.0, 0.0, 0.0)); | 58 | + g.setColor(const PdfColor(0, 0, 0)); |
59 | g.drawShape( | 59 | g.drawShape( |
60 | 'M300,200 h-150 a150,150 0 1,0 150,-150 z M275,175 v-150 a150,150 0 0,0 -150,150 z'); | 60 | 'M300,200 h-150 a150,150 0 1,0 150,-150 z M275,175 v-150 a150,150 0 0,0 -150,150 z'); |
61 | g.restoreContext(); | 61 | g.restoreContext(); |
@@ -66,32 +66,32 @@ void main() { | @@ -66,32 +66,32 @@ void main() { | ||
66 | final PdfTtfFont font2 = PdfTtfFont(pdf, data.buffer.asByteData()); | 66 | final PdfTtfFont font2 = PdfTtfFont(pdf, data.buffer.asByteData()); |
67 | const String s = 'Hello World!'; | 67 | const String s = 'Hello World!'; |
68 | final PdfFontMetrics r = font2.stringMetrics(s); | 68 | final PdfFontMetrics r = font2.stringMetrics(s); |
69 | - const double FS = 20.0; | ||
70 | - g.setColor(const PdfColor(0.0, 1.0, 1.0)); | 69 | + const double FS = 20; |
70 | + g.setColor(const PdfColor(0, 1, 1)); | ||
71 | g.drawRect( | 71 | g.drawRect( |
72 | 50.0 + r.left * FS, 30.0 + r.top * FS, r.width * FS, r.height * FS); | 72 | 50.0 + r.left * FS, 30.0 + r.top * FS, r.width * FS, r.height * FS); |
73 | g.fillPath(); | 73 | g.fillPath(); |
74 | g.setColor(const PdfColor(0.3, 0.3, 0.3)); | 74 | g.setColor(const PdfColor(0.3, 0.3, 0.3)); |
75 | - g.drawString(font2, FS, s, 50.0, 30.0); | 75 | + g.drawString(font2, FS, s, 50, 30); |
76 | 76 | ||
77 | - g.setColor(const PdfColor(1.0, 0.0, 0.0)); | ||
78 | - g.drawString(font2, 20.0, 'Hé (Olà)', 50.0, 10.0); | ||
79 | - g.drawLine(30.0, 30.0, 200.0, 200.0); | 77 | + g.setColor(const PdfColor(1, 0, 0)); |
78 | + g.drawString(font2, 20, 'Hé (Olà)', 50, 10); | ||
79 | + g.drawLine(30, 30, 200, 200); | ||
80 | g.strokePath(); | 80 | g.strokePath(); |
81 | - g.setColor(const PdfColor(1.0, 0.0, 0.0)); | ||
82 | - g.drawRect(300.0, 150.0, 50.0, 50.0); | 81 | + g.setColor(const PdfColor(1, 0, 0)); |
82 | + g.drawRect(300, 150, 50, 50); | ||
83 | g.fillPath(); | 83 | g.fillPath(); |
84 | - g.setColor(const PdfColor(0.0, 0.5, 0.0)); | 84 | + g.setColor(const PdfColor(0, 0.5, 0)); |
85 | final PdfImage image = | 85 | final PdfImage image = |
86 | PdfImage(pdf, image: img.buffer.asUint8List(), width: 10, height: 10); | 86 | PdfImage(pdf, image: img.buffer.asUint8List(), width: 10, height: 10); |
87 | - for (double i = 10.0; i < 90.0; i += 5.0) { | 87 | + for (double i = 10; i < 90.0; i += 5.0) { |
88 | g.saveContext(); | 88 | g.saveContext(); |
89 | final Matrix4 tm = Matrix4.identity(); | 89 | final Matrix4 tm = Matrix4.identity(); |
90 | tm.rotateZ(i * pi / 360.0); | 90 | tm.rotateZ(i * pi / 360.0); |
91 | - tm.translate(300.0, -100.0); | 91 | + tm.translate(300.0, -100); |
92 | g.setTransform(tm); | 92 | g.setTransform(tm); |
93 | - g.drawString(font1, 12.0, 'Hello $i', 20.0, 100.0); | ||
94 | - g.drawImage(image, 100.0, 100.0); | 93 | + g.drawString(font1, 12, 'Hello $i', 20, 100); |
94 | + g.drawImage(image, 100, 100); | ||
95 | g.restoreContext(); | 95 | g.restoreContext(); |
96 | } | 96 | } |
97 | 97 |
@@ -44,7 +44,7 @@ void main() { | @@ -44,7 +44,7 @@ void main() { | ||
44 | alpha: false); | 44 | alpha: false); |
45 | 45 | ||
46 | final PdfGraphics g = page.getGraphics(); | 46 | final PdfGraphics g = page.getGraphics(); |
47 | - g.drawImage(image, 30.0, page.pageFormat.height - 507.0); | 47 | + g.drawImage(image, 30, page.pageFormat.height - 507.0); |
48 | 48 | ||
49 | final File file = File('jpeg.pdf'); | 49 | final File file = File('jpeg.pdf'); |
50 | file.writeAsBytesSync(pdf.save()); | 50 | file.writeAsBytesSync(pdf.save()); |
@@ -30,7 +30,7 @@ void printMetrics( | @@ -30,7 +30,7 @@ void printMetrics( | ||
30 | final double fontSize = min(fontSizeW, fontSizeH); | 30 | final double fontSize = min(fontSizeW, fontSizeH); |
31 | final PdfFontMetrics metrics = metricsUnscales * fontSize; | 31 | final PdfFontMetrics metrics = metricsUnscales * fontSize; |
32 | 32 | ||
33 | - const double deb = 20.0; | 33 | + const double deb = 20; |
34 | 34 | ||
35 | final double x = (size.x - metrics.maxWidth) / 2.0; | 35 | final double x = (size.x - metrics.maxWidth) / 2.0; |
36 | final double y = (size.y - metrics.maxHeight) / 2.0 - metrics.descent; | 36 | final double y = (size.y - metrics.maxHeight) / 2.0 - metrics.descent; |
@@ -70,7 +70,7 @@ void main() { | @@ -70,7 +70,7 @@ void main() { | ||
70 | in 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&%!?0123456789' | 70 | in 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&%!?0123456789' |
71 | .codeUnits) { | 71 | .codeUnits) { |
72 | pdf.addPage(Page( | 72 | pdf.addPage(Page( |
73 | - pageFormat: const PdfPageFormat(500.0, 500.0, marginAll: 20), | 73 | + pageFormat: const PdfPageFormat(500, 500, marginAll: 20), |
74 | build: (Context context) { | 74 | build: (Context context) { |
75 | return ConstrainedBox( | 75 | return ConstrainedBox( |
76 | constraints: const BoxConstraints.expand(), | 76 | constraints: const BoxConstraints.expand(), |
@@ -25,8 +25,8 @@ void main() { | @@ -25,8 +25,8 @@ void main() { | ||
25 | final PdfPage page = PdfPage(pdf, pageFormat: PdfPageFormat.a4); | 25 | final PdfPage page = PdfPage(pdf, pageFormat: PdfPageFormat.a4); |
26 | 26 | ||
27 | final PdfGraphics g = page.getGraphics(); | 27 | final PdfGraphics g = page.getGraphics(); |
28 | - g.drawLine(30.0, page.pageFormat.height - 30.0, 200.0, | ||
29 | - page.pageFormat.height - 200.0); | 28 | + g.drawLine( |
29 | + 30, page.pageFormat.height - 30.0, 200, page.pageFormat.height - 200.0); | ||
30 | g.strokePath(); | 30 | g.strokePath(); |
31 | 31 | ||
32 | final File file = File('minimal.pdf'); | 32 | final File file = File('minimal.pdf'); |
@@ -22,12 +22,12 @@ import 'package:test/test.dart'; | @@ -22,12 +22,12 @@ import 'package:test/test.dart'; | ||
22 | 22 | ||
23 | void printText(PdfGraphics canvas, String text, PdfFont font, double top) { | 23 | void printText(PdfGraphics canvas, String text, PdfFont font, double top) { |
24 | text = text + font.fontName; | 24 | text = text + font.fontName; |
25 | - const double fontSize = 20.0; | 25 | + const double fontSize = 20; |
26 | final PdfFontMetrics metrics = font.stringMetrics(text) * fontSize; | 26 | final PdfFontMetrics metrics = font.stringMetrics(text) * fontSize; |
27 | 27 | ||
28 | - const double deb = 5.0; | 28 | + const double deb = 5; |
29 | 29 | ||
30 | - const double x = 50.0; | 30 | + const double x = 50; |
31 | final double y = canvas.page.pageFormat.height - top; | 31 | final double y = canvas.page.pageFormat.height - top; |
32 | 32 | ||
33 | canvas | 33 | canvas |
@@ -61,7 +61,7 @@ void main() { | @@ -61,7 +61,7 @@ void main() { | ||
61 | test('Pdf', () { | 61 | test('Pdf', () { |
62 | final PdfDocument pdf = PdfDocument(); | 62 | final PdfDocument pdf = PdfDocument(); |
63 | final PdfPage page = | 63 | final PdfPage page = |
64 | - PdfPage(pdf, pageFormat: const PdfPageFormat(500.0, 300.0)); | 64 | + PdfPage(pdf, pageFormat: const PdfPageFormat(500, 300)); |
65 | 65 | ||
66 | final PdfGraphics g = page.getGraphics(); | 66 | final PdfGraphics g = page.getGraphics(); |
67 | int top = 0; | 67 | int top = 0; |
@@ -21,12 +21,12 @@ import 'package:test/test.dart'; | @@ -21,12 +21,12 @@ import 'package:test/test.dart'; | ||
21 | 21 | ||
22 | void printText(PdfGraphics canvas, String text, PdfFont font, double top) { | 22 | void printText(PdfGraphics canvas, String text, PdfFont font, double top) { |
23 | text = text + font.fontName; | 23 | text = text + font.fontName; |
24 | - const double fontSize = 20.0; | 24 | + const double fontSize = 20; |
25 | final PdfFontMetrics metrics = font.stringMetrics(text) * fontSize; | 25 | final PdfFontMetrics metrics = font.stringMetrics(text) * fontSize; |
26 | 26 | ||
27 | - const double deb = 5.0; | 27 | + const double deb = 5; |
28 | 28 | ||
29 | - const double x = 50.0; | 29 | + const double x = 50; |
30 | final double y = canvas.page.pageFormat.height - top; | 30 | final double y = canvas.page.pageFormat.height - top; |
31 | 31 | ||
32 | canvas | 32 | canvas |
@@ -52,7 +52,7 @@ void main() { | @@ -52,7 +52,7 @@ void main() { | ||
52 | test('Pdf', () { | 52 | test('Pdf', () { |
53 | final PdfDocument pdf = PdfDocument(); | 53 | final PdfDocument pdf = PdfDocument(); |
54 | final PdfPage page = | 54 | final PdfPage page = |
55 | - PdfPage(pdf, pageFormat: const PdfPageFormat(500.0, 430.0)); | 55 | + PdfPage(pdf, pageFormat: const PdfPageFormat(500, 430)); |
56 | 56 | ||
57 | final PdfGraphics g = page.getGraphics(); | 57 | final PdfGraphics g = page.getGraphics(); |
58 | int top = 0; | 58 | int top = 0; |
@@ -35,8 +35,8 @@ void main() { | @@ -35,8 +35,8 @@ void main() { | ||
35 | PdfImage(pdf.document, image: imData, width: 16, height: 20); | 35 | PdfImage(pdf.document, image: imData, width: 16, height: 20); |
36 | 36 | ||
37 | pdf.addPage(Page( | 37 | pdf.addPage(Page( |
38 | - pageFormat: const PdfPageFormat(400.0, 400.0), | ||
39 | - margin: const EdgeInsets.all(10.0), | 38 | + pageFormat: const PdfPageFormat(400, 400), |
39 | + margin: const EdgeInsets.all(10), | ||
40 | build: (Context context) => Column(children: <Widget>[ | 40 | build: (Context context) => Column(children: <Widget>[ |
41 | Container( | 41 | Container( |
42 | padding: const EdgeInsets.all(5), | 42 | padding: const EdgeInsets.all(5), |
@@ -48,11 +48,11 @@ void main() { | @@ -48,11 +48,11 @@ void main() { | ||
48 | bottom: true, | 48 | bottom: true, |
49 | left: true, | 49 | left: true, |
50 | right: true, | 50 | right: true, |
51 | - width: 2.0)), | 51 | + width: 2)), |
52 | child: Text('Hello World', | 52 | child: Text('Hello World', |
53 | - textScaleFactor: 2.0, textAlign: TextAlign.center)), | 53 | + textScaleFactor: 2, textAlign: TextAlign.center)), |
54 | Align(alignment: Alignment.topLeft, child: Text('Left align')), | 54 | Align(alignment: Alignment.topLeft, child: Text('Left align')), |
55 | - Padding(padding: const EdgeInsets.all(5.0)), | 55 | + Padding(padding: const EdgeInsets.all(5)), |
56 | Row( | 56 | Row( |
57 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, | 57 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
58 | children: <Widget>[ | 58 | children: <Widget>[ |
@@ -75,31 +75,31 @@ void main() { | @@ -75,31 +75,31 @@ void main() { | ||
75 | Container( | 75 | Container( |
76 | padding: const EdgeInsets.only(top: 5), | 76 | padding: const EdgeInsets.only(top: 5), |
77 | decoration: const BoxDecoration( | 77 | decoration: const BoxDecoration( |
78 | - border: BoxBorder(top: true, width: 1.0)), | 78 | + border: BoxBorder(top: true, width: 1)), |
79 | child: Text("That's all Folks!", | 79 | child: Text("That's all Folks!", |
80 | textAlign: TextAlign.center, | 80 | textAlign: TextAlign.center, |
81 | style: Theme.of(context) | 81 | style: Theme.of(context) |
82 | .defaultTextStyle | 82 | .defaultTextStyle |
83 | .copyWith(font: Font.timesBoldItalic()), | 83 | .copyWith(font: Font.timesBoldItalic()), |
84 | - textScaleFactor: 3.0)), | 84 | + textScaleFactor: 3)), |
85 | ]))); | 85 | ]))); |
86 | 86 | ||
87 | pdf.addPage(Page( | 87 | pdf.addPage(Page( |
88 | - pageFormat: const PdfPageFormat(400.0, 400.0), | ||
89 | - margin: const EdgeInsets.all(10.0), | 88 | + pageFormat: const PdfPageFormat(400, 400), |
89 | + margin: const EdgeInsets.all(10), | ||
90 | build: (Context context) => Center( | 90 | build: (Context context) => Center( |
91 | child: GridView( | 91 | child: GridView( |
92 | crossAxisCount: 3, | 92 | crossAxisCount: 3, |
93 | direction: Axis.vertical, | 93 | direction: Axis.vertical, |
94 | - crossAxisSpacing: 10.0, | ||
95 | - mainAxisSpacing: 10.0, | ||
96 | - padding: const EdgeInsets.all(10.0), | 94 | + crossAxisSpacing: 10, |
95 | + mainAxisSpacing: 10, | ||
96 | + padding: const EdgeInsets.all(10), | ||
97 | children: List<Widget>.generate( | 97 | children: List<Widget>.generate( |
98 | 9, (int n) => FittedBox(child: Text('${n + 1}'))))))); | 98 | 9, (int n) => FittedBox(child: Text('${n + 1}'))))))); |
99 | 99 | ||
100 | pdf.addPage(MultiPage( | 100 | pdf.addPage(MultiPage( |
101 | - pageFormat: const PdfPageFormat(400.0, 200.0), | ||
102 | - margin: const EdgeInsets.all(10.0), | 101 | + pageFormat: const PdfPageFormat(400, 200), |
102 | + margin: const EdgeInsets.all(10), | ||
103 | build: (Context context) => <Widget>[ | 103 | build: (Context context) => <Widget>[ |
104 | Table.fromTextArray(context: context, data: <List<String>>[ | 104 | Table.fromTextArray(context: context, data: <List<String>>[ |
105 | <String>['Company', 'Contact', 'Country'], | 105 | <String>['Company', 'Contact', 'Country'], |
@@ -136,8 +136,8 @@ void main() { | @@ -136,8 +136,8 @@ void main() { | ||
136 | ])); | 136 | ])); |
137 | 137 | ||
138 | pdf.addPage(Page( | 138 | pdf.addPage(Page( |
139 | - pageFormat: const PdfPageFormat(400.0, 200.0), | ||
140 | - margin: const EdgeInsets.all(10.0), | 139 | + pageFormat: const PdfPageFormat(400, 200), |
140 | + margin: const EdgeInsets.all(10), | ||
141 | build: (Context context) => Stack(overflow: Overflow.visible, | 141 | build: (Context context) => Stack(overflow: Overflow.visible, |
142 | // fit: StackFit.expand, | 142 | // fit: StackFit.expand, |
143 | // alignment: Alignment.bottomRight, | 143 | // alignment: Alignment.bottomRight, |
@@ -131,7 +131,7 @@ Future<PdfDocument> generateDocument(PdfPageFormat format) async { | @@ -131,7 +131,7 @@ Future<PdfDocument> generateDocument(PdfPageFormat format) async { | ||
131 | crossAxisAlignment: CrossAxisAlignment.start, | 131 | crossAxisAlignment: CrossAxisAlignment.start, |
132 | children: <Widget>[ | 132 | children: <Widget>[ |
133 | Text('Parnella Charlesbois', | 133 | Text('Parnella Charlesbois', |
134 | - textScaleFactor: 2.0, | 134 | + textScaleFactor: 2, |
135 | style: Theme.of(context).defaultTextStyleBold), | 135 | style: Theme.of(context).defaultTextStyleBold), |
136 | Padding(padding: const EdgeInsets.only(top: 10)), | 136 | Padding(padding: const EdgeInsets.only(top: 10)), |
137 | Text('Electrotyper', | 137 | Text('Electrotyper', |
@@ -4,7 +4,7 @@ description: Pdf Printing Example | @@ -4,7 +4,7 @@ description: Pdf Printing Example | ||
4 | version: 1.0.0+1 | 4 | version: 1.0.0+1 |
5 | 5 | ||
6 | environment: | 6 | environment: |
7 | - sdk: ">=2.0.0 <3.0.0" | 7 | + sdk: ">=2.1.0 <3.0.0" |
8 | 8 | ||
9 | dependencies: | 9 | dependencies: |
10 | flutter: | 10 | flutter: |
@@ -17,5 +17,11 @@ dev_dependencies: | @@ -17,5 +17,11 @@ dev_dependencies: | ||
17 | flutter_test: | 17 | flutter_test: |
18 | sdk: flutter | 18 | sdk: flutter |
19 | 19 | ||
20 | +dependency_overrides: | ||
21 | + printing: | ||
22 | + path: .. | ||
23 | + pdf: | ||
24 | + path: ../../pdf | ||
25 | + | ||
20 | flutter: | 26 | flutter: |
21 | uses-material-design: true | 27 | uses-material-design: true |
@@ -75,7 +75,7 @@ mixin Printing { | @@ -75,7 +75,7 @@ mixin Printing { | ||
75 | bytes = document.save(); | 75 | bytes = document.save(); |
76 | } | 76 | } |
77 | 77 | ||
78 | - bounds ??= Rect.fromCircle(center: Offset.zero, radius: 10.0); | 78 | + bounds ??= Rect.fromCircle(center: Offset.zero, radius: 10); |
79 | 79 | ||
80 | final Map<String, dynamic> params = <String, dynamic>{ | 80 | final Map<String, dynamic> params = <String, dynamic>{ |
81 | 'doc': Uint8List.fromList(bytes), | 81 | 'doc': Uint8List.fromList(bytes), |
@@ -2,10 +2,13 @@ name: printing | @@ -2,10 +2,13 @@ name: printing | ||
2 | author: David PHAM-VAN <dev.nfet.net@gmail.com> | 2 | author: David PHAM-VAN <dev.nfet.net@gmail.com> |
3 | description: Plugin that allows Flutter apps to generate and print documents to android or ios compatible printers | 3 | description: Plugin that allows Flutter apps to generate and print documents to android or ios compatible printers |
4 | homepage: https://github.com/DavBfr/dart_pdf/tree/master/printing | 4 | homepage: https://github.com/DavBfr/dart_pdf/tree/master/printing |
5 | +repository: https://github.com/DavBfr/dart_pdf | ||
6 | +issue_tracker: https://github.com/DavBfr/dart_pdf/issues | ||
5 | version: 1.3.5 | 7 | version: 1.3.5 |
6 | 8 | ||
7 | environment: | 9 | environment: |
8 | - sdk: ">=1.19.0 <3.0.0" | 10 | + sdk: ">=2.1.0 <3.0.0" |
11 | + flutter: "^1.2.0" | ||
9 | 12 | ||
10 | dependencies: | 13 | dependencies: |
11 | flutter: | 14 | flutter: |
@@ -16,6 +19,10 @@ dev_dependencies: | @@ -16,6 +19,10 @@ dev_dependencies: | ||
16 | flutter_test: | 19 | flutter_test: |
17 | sdk: flutter | 20 | sdk: flutter |
18 | 21 | ||
22 | +dependency_overrides: | ||
23 | + pdf: | ||
24 | + path: ../pdf | ||
25 | + | ||
19 | flutter: | 26 | flutter: |
20 | plugin: | 27 | plugin: |
21 | androidPackage: net.nfet.flutter.printing | 28 | androidPackage: net.nfet.flutter.printing |
-
Please register or login to post a comment