Showing
25 changed files
with
37 additions
and
355 deletions
@@ -40,7 +40,7 @@ class MyApp extends StatelessWidget { | @@ -40,7 +40,7 @@ class MyApp extends StatelessWidget { | ||
40 | } | 40 | } |
41 | 41 | ||
42 | /// This method takes a page format and generates the Pdf file data | 42 | /// This method takes a page format and generates the Pdf file data |
43 | - List<int> buildPdf(PdfPageFormat format) { | 43 | + Future<Uint8List> buildPdf(PdfPageFormat format) async { |
44 | // Create the Pdf document | 44 | // Create the Pdf document |
45 | final pw.Document doc = pw.Document(); | 45 | final pw.Document doc = pw.Document(); |
46 | 46 | ||
@@ -60,7 +60,7 @@ class MyApp extends StatelessWidget { | @@ -60,7 +60,7 @@ class MyApp extends StatelessWidget { | ||
60 | ); | 60 | ); |
61 | 61 | ||
62 | // Build and return the final Pdf file data | 62 | // Build and return the final Pdf file data |
63 | - return doc.save(); | 63 | + return await doc.save(); |
64 | } | 64 | } |
65 | } | 65 | } |
66 | ``` | 66 | ``` |
@@ -165,5 +165,5 @@ Future<Uint8List> generateDocument(PdfPageFormat format) async { | @@ -165,5 +165,5 @@ Future<Uint8List> generateDocument(PdfPageFormat format) async { | ||
165 | 'Text is available under the Creative Commons Attribution Share Alike License.') | 165 | 'Text is available under the Creative Commons Attribution Share Alike License.') |
166 | ])); | 166 | ])); |
167 | 167 | ||
168 | - return doc.save(); | 168 | + return await doc.save(); |
169 | } | 169 | } |
@@ -156,7 +156,7 @@ class Invoice { | @@ -156,7 +156,7 @@ class Invoice { | ||
156 | ), | 156 | ), |
157 | pw.Container( | 157 | pw.Container( |
158 | decoration: pw.BoxDecoration( | 158 | decoration: pw.BoxDecoration( |
159 | - borderRadiusEx: | 159 | + borderRadius: |
160 | const pw.BorderRadius.all(pw.Radius.circular(2)), | 160 | const pw.BorderRadius.all(pw.Radius.circular(2)), |
161 | color: accentColor, | 161 | color: accentColor, |
162 | ), | 162 | ), |
@@ -456,7 +456,7 @@ class Invoice { | @@ -456,7 +456,7 @@ class Invoice { | ||
456 | border: null, | 456 | border: null, |
457 | cellAlignment: pw.Alignment.centerLeft, | 457 | cellAlignment: pw.Alignment.centerLeft, |
458 | headerDecoration: pw.BoxDecoration( | 458 | headerDecoration: pw.BoxDecoration( |
459 | - borderRadiusEx: const pw.BorderRadius.all(pw.Radius.circular(2)), | 459 | + borderRadius: const pw.BorderRadius.all(pw.Radius.circular(2)), |
460 | color: baseColor, | 460 | color: baseColor, |
461 | ), | 461 | ), |
462 | headerHeight: 25, | 462 | headerHeight: 25, |
@@ -129,7 +129,7 @@ Future<Uint8List> generateResume(PdfPageFormat format) async { | @@ -129,7 +129,7 @@ Future<Uint8List> generateResume(PdfPageFormat format) async { | ||
129 | width: 100, | 129 | width: 100, |
130 | height: 100, | 130 | height: 100, |
131 | color: lightGreen, | 131 | color: lightGreen, |
132 | - child: pw.Image.provider(profileImage), | 132 | + child: pw.Image(profileImage), |
133 | ), | 133 | ), |
134 | ), | 134 | ), |
135 | pw.Column(children: <pw.Widget>[ | 135 | pw.Column(children: <pw.Widget>[ |
@@ -249,7 +249,7 @@ class _Category extends pw.StatelessWidget { | @@ -249,7 +249,7 @@ class _Category extends pw.StatelessWidget { | ||
249 | return pw.Container( | 249 | return pw.Container( |
250 | decoration: const pw.BoxDecoration( | 250 | decoration: const pw.BoxDecoration( |
251 | color: lightGreen, | 251 | color: lightGreen, |
252 | - borderRadiusEx: pw.BorderRadius.all(pw.Radius.circular(6)), | 252 | + borderRadius: pw.BorderRadius.all(pw.Radius.circular(6)), |
253 | ), | 253 | ), |
254 | margin: const pw.EdgeInsets.only(bottom: 10, top: 20), | 254 | margin: const pw.EdgeInsets.only(bottom: 10, top: 20), |
255 | padding: const pw.EdgeInsets.fromLTRB(10, 7, 10, 4), | 255 | padding: const pw.EdgeInsets.fromLTRB(10, 7, 10, 4), |
@@ -23,7 +23,6 @@ import 'document.dart'; | @@ -23,7 +23,6 @@ import 'document.dart'; | ||
23 | import 'font_metrics.dart'; | 23 | import 'font_metrics.dart'; |
24 | import 'object.dart'; | 24 | import 'object.dart'; |
25 | import 'point.dart'; | 25 | import 'point.dart'; |
26 | -import 'rect.dart'; | ||
27 | import 'stream.dart'; | 26 | import 'stream.dart'; |
28 | import 'type1_font.dart'; | 27 | import 'type1_font.dart'; |
29 | import 'type1_fonts.dart'; | 28 | import 'type1_fonts.dart'; |
@@ -162,17 +161,9 @@ See https://github.com/DavBfr/dart_pdf/wiki/Fonts-Management | @@ -162,17 +161,9 @@ See https://github.com/DavBfr/dart_pdf/wiki/Fonts-Management | ||
162 | params['/Encoding'] = const PdfName('/WinAnsiEncoding'); | 161 | params['/Encoding'] = const PdfName('/WinAnsiEncoding'); |
163 | } | 162 | } |
164 | 163 | ||
165 | - /// How many units to move for the next glyph | ||
166 | - @Deprecated('Use `glyphMetrics` instead') | ||
167 | - double glyphAdvance(int charCode) => glyphMetrics(charCode).advanceWidth; | ||
168 | - | ||
169 | /// Calculate the [PdfFontMetrics] for this glyph | 164 | /// Calculate the [PdfFontMetrics] for this glyph |
170 | PdfFontMetrics glyphMetrics(int charCode); | 165 | PdfFontMetrics glyphMetrics(int charCode); |
171 | 166 | ||
172 | - /// Calculate the dimensions of this glyph | ||
173 | - @Deprecated('Use `glyphMetrics` instead') | ||
174 | - PdfRect glyphBounds(int charCode) => glyphMetrics(charCode).toPdfRect(); | ||
175 | - | ||
176 | /// Calculate the [PdfFontMetrics] for this string | 167 | /// Calculate the [PdfFontMetrics] for this string |
177 | PdfFontMetrics stringMetrics(String s, {double letterSpacing = 0}) { | 168 | PdfFontMetrics stringMetrics(String s, {double letterSpacing = 0}) { |
178 | if (s.isEmpty) { | 169 | if (s.isEmpty) { |
@@ -193,10 +184,6 @@ See https://github.com/DavBfr/dart_pdf/wiki/Fonts-Management | @@ -193,10 +184,6 @@ See https://github.com/DavBfr/dart_pdf/wiki/Fonts-Management | ||
193 | } | 184 | } |
194 | } | 185 | } |
195 | 186 | ||
196 | - /// Calculage the bounding box for this string | ||
197 | - @Deprecated('Use `stringMetrics` instead') | ||
198 | - PdfRect stringBounds(String s) => stringMetrics(s).toPdfRect(); | ||
199 | - | ||
200 | /// Calculage the unit size of this string | 187 | /// Calculage the unit size of this string |
201 | PdfPoint stringSize(String s) { | 188 | PdfPoint stringSize(String s) { |
202 | final metrics = stringMetrics(s); | 189 | final metrics = stringMetrics(s); |
@@ -27,10 +27,6 @@ class PdfPageList extends PdfObject { | @@ -27,10 +27,6 @@ class PdfPageList extends PdfObject { | ||
27 | /// This holds the pages | 27 | /// This holds the pages |
28 | final List<PdfPage> pages = <PdfPage>[]; | 28 | final List<PdfPage> pages = <PdfPage>[]; |
29 | 29 | ||
30 | - /// This returns a specific page. Used by the Pdf class. | ||
31 | - @Deprecated('Use pages[index] instead') | ||
32 | - PdfPage getPage(int page) => pages[page]; | ||
33 | - | ||
34 | @override | 30 | @override |
35 | void prepare() { | 31 | void prepare() { |
36 | super.prepare(); | 32 | super.prepare(); |
@@ -22,12 +22,6 @@ class PdfPoint { | @@ -22,12 +22,6 @@ class PdfPoint { | ||
22 | 22 | ||
23 | final double x, y; | 23 | final double x, y; |
24 | 24 | ||
25 | - @Deprecated('Use `x` instead') | ||
26 | - double get w => x; | ||
27 | - | ||
28 | - @Deprecated('Use `y` instead') | ||
29 | - double get h => y; | ||
30 | - | ||
31 | static const PdfPoint zero = PdfPoint(0.0, 0.0); | 25 | static const PdfPoint zero = PdfPoint(0.0, 0.0); |
32 | 26 | ||
33 | @override | 27 | @override |
@@ -43,24 +43,6 @@ class PdfRect { | @@ -43,24 +43,6 @@ class PdfRect { | ||
43 | double get horizondalCenter => x + width / 2; | 43 | double get horizondalCenter => x + width / 2; |
44 | double get verticalCenter => y + height / 2; | 44 | double get verticalCenter => y + height / 2; |
45 | 45 | ||
46 | - @Deprecated('Use `left` instead') | ||
47 | - double get l => left; | ||
48 | - | ||
49 | - @Deprecated('Use `bottom` instead') | ||
50 | - double get b => bottom; | ||
51 | - | ||
52 | - @Deprecated('Use `right` instead') | ||
53 | - double get r => right; | ||
54 | - | ||
55 | - @Deprecated('Use `top` instead') | ||
56 | - double get t => top; | ||
57 | - | ||
58 | - @Deprecated('Use `width` instead') | ||
59 | - double get w => width; | ||
60 | - | ||
61 | - @Deprecated('Use `height` instead') | ||
62 | - double get h => height; | ||
63 | - | ||
64 | @override | 46 | @override |
65 | String toString() => 'PdfRect($x, $y, $width, $height)'; | 47 | String toString() => 'PdfRect($x, $y, $width, $height)'; |
66 | 48 |
@@ -25,37 +25,7 @@ enum BorderStyle { none, solid, dashed, dotted } | @@ -25,37 +25,7 @@ enum BorderStyle { none, solid, dashed, dotted } | ||
25 | 25 | ||
26 | @immutable | 26 | @immutable |
27 | abstract class BoxBorder { | 27 | abstract class BoxBorder { |
28 | - @Deprecated('Use Border instead') | ||
29 | - factory BoxBorder({ | ||
30 | - bool left = false, | ||
31 | - bool top = false, | ||
32 | - bool right = false, | ||
33 | - bool bottom = false, | ||
34 | - PdfColor color = PdfColors.black, | ||
35 | - double width = 1.0, | ||
36 | - BorderStyle style = BorderStyle.solid, | ||
37 | - }) { | ||
38 | - assert(color != null); | ||
39 | - assert(width != null); | ||
40 | - assert(width >= 0.0); | ||
41 | - assert(style != null); | ||
42 | - | ||
43 | - return Border( | ||
44 | - top: BorderSide( | ||
45 | - color: color, width: width, style: top ? style : BorderStyle.none), | ||
46 | - bottom: BorderSide( | ||
47 | - color: color, | ||
48 | - width: width, | ||
49 | - style: bottom ? style : BorderStyle.none), | ||
50 | - left: BorderSide( | ||
51 | - color: color, width: width, style: left ? style : BorderStyle.none), | ||
52 | - right: BorderSide( | ||
53 | - color: color, | ||
54 | - width: width, | ||
55 | - style: right ? style : BorderStyle.none)); | ||
56 | - } | ||
57 | - | ||
58 | - const BoxBorder.P(); | 28 | + const BoxBorder(); |
59 | 29 | ||
60 | BorderSide get top; | 30 | BorderSide get top; |
61 | BorderSide get bottom; | 31 | BorderSide get bottom; |
@@ -198,7 +168,7 @@ class Border extends BoxBorder { | @@ -198,7 +168,7 @@ class Border extends BoxBorder { | ||
198 | assert(right != null), | 168 | assert(right != null), |
199 | assert(bottom != null), | 169 | assert(bottom != null), |
200 | assert(left != null), | 170 | assert(left != null), |
201 | - super.P(); | 171 | + super(); |
202 | 172 | ||
203 | /// A uniform border with all sides the same color and width. | 173 | /// A uniform border with all sides the same color and width. |
204 | factory Border.all({ | 174 | factory Border.all({ |
@@ -217,7 +187,7 @@ class Border extends BoxBorder { | @@ -217,7 +187,7 @@ class Border extends BoxBorder { | ||
217 | right = side, | 187 | right = side, |
218 | bottom = side, | 188 | bottom = side, |
219 | left = side, | 189 | left = side, |
220 | - super.P(); | 190 | + super(); |
221 | 191 | ||
222 | /// Creates a border with symmetrical vertical and horizontal sides. | 192 | /// Creates a border with symmetrical vertical and horizontal sides. |
223 | const Border.symmetric({ | 193 | const Border.symmetric({ |
@@ -229,7 +199,7 @@ class Border extends BoxBorder { | @@ -229,7 +199,7 @@ class Border extends BoxBorder { | ||
229 | top = horizontal, | 199 | top = horizontal, |
230 | right = vertical, | 200 | right = vertical, |
231 | bottom = horizontal, | 201 | bottom = horizontal, |
232 | - super.P(); | 202 | + super(); |
233 | 203 | ||
234 | @override | 204 | @override |
235 | final BorderSide top; | 205 | final BorderSide top; |
@@ -32,18 +32,7 @@ enum DecorationPosition { background, foreground } | @@ -32,18 +32,7 @@ enum DecorationPosition { background, foreground } | ||
32 | 32 | ||
33 | @immutable | 33 | @immutable |
34 | class DecorationImage { | 34 | class DecorationImage { |
35 | - @Deprecated('Use DecorationImage.provider()') | ||
36 | - DecorationImage({ | ||
37 | - @required PdfImage image, | ||
38 | - this.fit = BoxFit.cover, | ||
39 | - this.alignment = Alignment.center, | ||
40 | - }) : assert(image != null), | ||
41 | - assert(fit != null), | ||
42 | - assert(alignment != null), | ||
43 | - image = ImageProxy(image), | ||
44 | - dpi = null; | ||
45 | - | ||
46 | - const DecorationImage.provider({ | 35 | + const DecorationImage({ |
47 | @required this.image, | 36 | @required this.image, |
48 | this.fit = BoxFit.cover, | 37 | this.fit = BoxFit.cover, |
49 | this.alignment = Alignment.center, | 38 | this.alignment = Alignment.center, |
@@ -313,33 +302,22 @@ class BoxDecoration { | @@ -313,33 +302,22 @@ class BoxDecoration { | ||
313 | const BoxDecoration({ | 302 | const BoxDecoration({ |
314 | this.color, | 303 | this.color, |
315 | this.border, | 304 | this.border, |
316 | - @Deprecated('Use borderRadiusEx with `BorderRadius.all(Radius.circular(20))`') | ||
317 | - double borderRadius, | ||
318 | - BorderRadius borderRadiusEx, | 305 | + this.borderRadius, |
319 | this.boxShadow, | 306 | this.boxShadow, |
320 | this.gradient, | 307 | this.gradient, |
321 | this.image, | 308 | this.image, |
322 | this.shape = BoxShape.rectangle, | 309 | this.shape = BoxShape.rectangle, |
323 | - }) : assert(shape != null), | ||
324 | - assert(!(borderRadius != null && borderRadiusEx != null), | ||
325 | - 'Don\'t set both borderRadius and borderRadiusEx'), | ||
326 | - _borderRadius = borderRadiusEx, | ||
327 | - _radius = borderRadius; | 310 | + }) : assert(shape != null); |
328 | 311 | ||
329 | /// The color to fill in the background of the box. | 312 | /// The color to fill in the background of the box. |
330 | final PdfColor color; | 313 | final PdfColor color; |
331 | final BoxBorder border; | 314 | final BoxBorder border; |
332 | - final BorderRadius _borderRadius; | ||
333 | - final double _radius; | 315 | + final BorderRadius borderRadius; |
334 | final BoxShape shape; | 316 | final BoxShape shape; |
335 | final DecorationImage image; | 317 | final DecorationImage image; |
336 | final Gradient gradient; | 318 | final Gradient gradient; |
337 | final List<BoxShadow> boxShadow; | 319 | final List<BoxShadow> boxShadow; |
338 | 320 | ||
339 | - BorderRadius get borderRadius => | ||
340 | - _borderRadius ?? | ||
341 | - (_radius == null ? null : BorderRadius.all(Radius.circular(_radius))); | ||
342 | - | ||
343 | void paint( | 321 | void paint( |
344 | Context context, | 322 | Context context, |
345 | PdfRect box, [ | 323 | PdfRect box, [ |
@@ -111,7 +111,7 @@ class FlatButton extends SingleChildWidget { | @@ -111,7 +111,7 @@ class FlatButton extends SingleChildWidget { | ||
111 | decoration: decoration ?? | 111 | decoration: decoration ?? |
112 | BoxDecoration( | 112 | BoxDecoration( |
113 | color: colorDown, | 113 | color: colorDown, |
114 | - borderRadiusEx: const BorderRadius.all(Radius.circular(2)), | 114 | + borderRadius: const BorderRadius.all(Radius.circular(2)), |
115 | ), | 115 | ), |
116 | padding: padding ?? | 116 | padding: padding ?? |
117 | const EdgeInsets.symmetric(horizontal: 20, vertical: 5), | 117 | const EdgeInsets.symmetric(horizontal: 20, vertical: 5), |
@@ -124,7 +124,7 @@ class FlatButton extends SingleChildWidget { | @@ -124,7 +124,7 @@ class FlatButton extends SingleChildWidget { | ||
124 | decoration: decoration ?? | 124 | decoration: decoration ?? |
125 | BoxDecoration( | 125 | BoxDecoration( |
126 | color: colorRollover, | 126 | color: colorRollover, |
127 | - borderRadiusEx: const BorderRadius.all(Radius.circular(2)), | 127 | + borderRadius: const BorderRadius.all(Radius.circular(2)), |
128 | ), | 128 | ), |
129 | padding: padding ?? | 129 | padding: padding ?? |
130 | const EdgeInsets.symmetric(horizontal: 20, vertical: 5), | 130 | const EdgeInsets.symmetric(horizontal: 20, vertical: 5), |
@@ -138,7 +138,7 @@ class FlatButton extends SingleChildWidget { | @@ -138,7 +138,7 @@ class FlatButton extends SingleChildWidget { | ||
138 | decoration: decoration ?? | 138 | decoration: decoration ?? |
139 | BoxDecoration( | 139 | BoxDecoration( |
140 | color: color, | 140 | color: color, |
141 | - borderRadiusEx: const BorderRadius.all(Radius.circular(2)), | 141 | + borderRadius: const BorderRadius.all(Radius.circular(2)), |
142 | ), | 142 | ), |
143 | padding: padding ?? | 143 | padding: padding ?? |
144 | const EdgeInsets.symmetric(horizontal: 20, vertical: 5), | 144 | const EdgeInsets.symmetric(horizontal: 20, vertical: 5), |
@@ -77,18 +77,7 @@ void _drawImageRect(PdfGraphics canvas, PdfImage image, PdfRect sourceRect, | @@ -77,18 +77,7 @@ void _drawImageRect(PdfGraphics canvas, PdfImage image, PdfRect sourceRect, | ||
77 | } | 77 | } |
78 | 78 | ||
79 | class Image extends Widget { | 79 | class Image extends Widget { |
80 | - @Deprecated('Use Image.provider instead') | ||
81 | Image( | 80 | Image( |
82 | - PdfImage image, { | ||
83 | - this.fit = BoxFit.contain, | ||
84 | - this.alignment = Alignment.center, | ||
85 | - this.width, | ||
86 | - this.height, | ||
87 | - }) : assert(image != null), | ||
88 | - image = ImageProxy(image), | ||
89 | - dpi = null; | ||
90 | - | ||
91 | - Image.provider( | ||
92 | this.image, { | 81 | this.image, { |
93 | this.fit = BoxFit.contain, | 82 | this.fit = BoxFit.contain, |
94 | this.alignment = Alignment.center, | 83 | this.alignment = Alignment.center, |
pdf/lib/src/widgets/qrcode.dart
deleted
100644 → 0
1 | -/* | ||
2 | - * Copyright (C) 2017, David PHAM-VAN <dev.nfet.net@gmail.com> | ||
3 | - * | ||
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | ||
7 | - * | ||
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | - * | ||
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | ||
14 | - * limitations under the License. | ||
15 | - */ | ||
16 | - | ||
17 | -import 'package:barcode/barcode.dart'; | ||
18 | -import 'package:meta/meta.dart'; | ||
19 | -import 'package:pdf/pdf.dart'; | ||
20 | - | ||
21 | -import 'barcode.dart'; | ||
22 | -import 'decoration.dart'; | ||
23 | -import 'geometry.dart'; | ||
24 | -import 'widget.dart'; | ||
25 | - | ||
26 | -typedef QrError = void Function(dynamic error); | ||
27 | - | ||
28 | -@Deprecated('Use BarcodeWidget instead') | ||
29 | -class QrCodeWidget extends StatelessWidget { | ||
30 | - QrCodeWidget({ | ||
31 | - @required this.data, | ||
32 | - this.version, | ||
33 | - this.errorCorrectionLevel = BarcodeQRCorrectionLevel.low, | ||
34 | - this.color = PdfColors.black, | ||
35 | - this.backgroundColor, | ||
36 | - this.decoration, | ||
37 | - this.margin, | ||
38 | - this.onError, | ||
39 | - this.gapless = false, | ||
40 | - this.size, | ||
41 | - this.padding, | ||
42 | - }); | ||
43 | - | ||
44 | - /// the qr code data | ||
45 | - final String data; | ||
46 | - | ||
47 | - /// the qr code version | ||
48 | - final int version; | ||
49 | - | ||
50 | - /// the qr code error correction level | ||
51 | - final BarcodeQRCorrectionLevel errorCorrectionLevel; | ||
52 | - | ||
53 | - /// the color of the dark squares | ||
54 | - final PdfColor color; | ||
55 | - | ||
56 | - final PdfColor backgroundColor; | ||
57 | - | ||
58 | - final EdgeInsets margin; | ||
59 | - | ||
60 | - final QrError onError; | ||
61 | - | ||
62 | - final bool gapless; | ||
63 | - | ||
64 | - final double size; | ||
65 | - | ||
66 | - final EdgeInsets padding; | ||
67 | - | ||
68 | - final BoxDecoration decoration; | ||
69 | - | ||
70 | - @override | ||
71 | - Widget build(Context context) { | ||
72 | - return BarcodeWidget( | ||
73 | - barcode: Barcode.qrCode( | ||
74 | - typeNumber: version, | ||
75 | - errorCorrectLevel: errorCorrectionLevel, | ||
76 | - ), | ||
77 | - data: data, | ||
78 | - backgroundColor: backgroundColor, | ||
79 | - color: color, | ||
80 | - decoration: decoration, | ||
81 | - width: size, | ||
82 | - height: size, | ||
83 | - margin: margin, | ||
84 | - padding: padding, | ||
85 | - ); | ||
86 | - } | ||
87 | -} |
@@ -58,44 +58,7 @@ enum TableWidth { min, max } | @@ -58,44 +58,7 @@ enum TableWidth { min, max } | ||
58 | 58 | ||
59 | class TableBorder extends Border { | 59 | class TableBorder extends Border { |
60 | /// Creates a border for a table. | 60 | /// Creates a border for a table. |
61 | - @Deprecated('Use TableBorder.ex instead') | ||
62 | - TableBorder( | ||
63 | - {bool left = true, | ||
64 | - bool top = true, | ||
65 | - bool right = true, | ||
66 | - bool bottom = true, | ||
67 | - bool horizontalInside = true, | ||
68 | - bool verticalInside = true, | ||
69 | - PdfColor color = PdfColors.black, | ||
70 | - double width = 1.0}) | ||
71 | - : horizontalInside = BorderSide( | ||
72 | - color: color, | ||
73 | - width: width, | ||
74 | - style: horizontalInside ? BorderStyle.solid : BorderStyle.none), | ||
75 | - verticalInside = BorderSide( | ||
76 | - color: color, | ||
77 | - width: width, | ||
78 | - style: verticalInside ? BorderStyle.solid : BorderStyle.none), | ||
79 | - super( | ||
80 | - top: BorderSide( | ||
81 | - color: color, | ||
82 | - width: width, | ||
83 | - style: top ? BorderStyle.solid : BorderStyle.none), | ||
84 | - bottom: BorderSide( | ||
85 | - color: color, | ||
86 | - width: width, | ||
87 | - style: bottom ? BorderStyle.solid : BorderStyle.none), | ||
88 | - left: BorderSide( | ||
89 | - color: color, | ||
90 | - width: width, | ||
91 | - style: left ? BorderStyle.solid : BorderStyle.none), | ||
92 | - right: BorderSide( | ||
93 | - color: color, | ||
94 | - width: width, | ||
95 | - style: right ? BorderStyle.solid : BorderStyle.none)); | ||
96 | - | ||
97 | - /// Creates a border for a table. | ||
98 | - const TableBorder.ex({ | 61 | + const TableBorder({ |
99 | BorderSide left = BorderSide.none, | 62 | BorderSide left = BorderSide.none, |
100 | BorderSide top = BorderSide.none, | 63 | BorderSide top = BorderSide.none, |
101 | BorderSide right = BorderSide.none, | 64 | BorderSide right = BorderSide.none, |
@@ -111,7 +74,7 @@ class TableBorder extends Border { | @@ -111,7 +74,7 @@ class TableBorder extends Border { | ||
111 | BorderStyle style = BorderStyle.solid, | 74 | BorderStyle style = BorderStyle.solid, |
112 | }) { | 75 | }) { |
113 | final side = BorderSide(color: color, width: width, style: style); | 76 | final side = BorderSide(color: color, width: width, style: style); |
114 | - return TableBorder.ex( | 77 | + return TableBorder( |
115 | top: side, | 78 | top: side, |
116 | right: side, | 79 | right: side, |
117 | bottom: side, | 80 | bottom: side, |
@@ -125,7 +88,7 @@ class TableBorder extends Border { | @@ -125,7 +88,7 @@ class TableBorder extends Border { | ||
125 | BorderSide inside = BorderSide.none, | 88 | BorderSide inside = BorderSide.none, |
126 | BorderSide outside = BorderSide.none, | 89 | BorderSide outside = BorderSide.none, |
127 | }) { | 90 | }) { |
128 | - return TableBorder.ex( | 91 | + return TableBorder( |
129 | top: outside, | 92 | top: outside, |
130 | right: outside, | 93 | right: outside, |
131 | bottom: outside, | 94 | bottom: outside, |
@@ -280,7 +243,6 @@ class Table extends Widget implements SpanningWidget { | @@ -280,7 +243,6 @@ class Table extends Widget implements SpanningWidget { | ||
280 | factory Table.fromTextArray({ | 243 | factory Table.fromTextArray({ |
281 | Context context, | 244 | Context context, |
282 | @required List<List<dynamic>> data, | 245 | @required List<List<dynamic>> data, |
283 | - @deprecated EdgeInsets margin, | ||
284 | EdgeInsets cellPadding = const EdgeInsets.all(5), | 246 | EdgeInsets cellPadding = const EdgeInsets.all(5), |
285 | double cellHeight = 0, | 247 | double cellHeight = 0, |
286 | Alignment cellAlignment = Alignment.topLeft, | 248 | Alignment cellAlignment = Alignment.topLeft, |
@@ -296,7 +258,7 @@ class Table extends Widget implements SpanningWidget { | @@ -296,7 +258,7 @@ class Table extends Widget implements SpanningWidget { | ||
296 | Map<int, Alignment> headerAlignments, | 258 | Map<int, Alignment> headerAlignments, |
297 | TextStyle headerStyle, | 259 | TextStyle headerStyle, |
298 | OnCellFormat headerFormat, | 260 | OnCellFormat headerFormat, |
299 | - TableBorder border = const TableBorder.ex( | 261 | + TableBorder border = const TableBorder( |
300 | left: BorderSide(), | 262 | left: BorderSide(), |
301 | right: BorderSide(), | 263 | right: BorderSide(), |
302 | top: BorderSide(), | 264 | top: BorderSide(), |
@@ -315,10 +277,6 @@ class Table extends Widget implements SpanningWidget { | @@ -315,10 +277,6 @@ class Table extends Widget implements SpanningWidget { | ||
315 | assert(headerCount != null && headerCount >= 0); | 277 | assert(headerCount != null && headerCount >= 0); |
316 | assert(cellHeight != null); | 278 | assert(cellHeight != null); |
317 | 279 | ||
318 | - if (margin != null) { | ||
319 | - cellPadding = margin; | ||
320 | - } | ||
321 | - | ||
322 | if (context != null) { | 280 | if (context != null) { |
323 | final theme = Theme.of(context); | 281 | final theme = Theme.of(context); |
324 | headerStyle ??= theme.tableHeader; | 282 | headerStyle ??= theme.tableHeader; |
@@ -357,9 +357,6 @@ class TextStyle { | @@ -357,9 +357,6 @@ class TextStyle { | ||
357 | ); | 357 | ); |
358 | } | 358 | } |
359 | 359 | ||
360 | - @Deprecated('use `font` instead') | ||
361 | - Font get paintFont => font; | ||
362 | - | ||
363 | Font get font { | 360 | Font get font { |
364 | if (fontWeight != FontWeight.bold) { | 361 | if (fontWeight != FontWeight.bold) { |
365 | if (fontStyle != FontStyle.italic) { | 362 | if (fontStyle != FontStyle.italic) { |
@@ -204,15 +204,6 @@ class Theme extends StatelessWidget { | @@ -204,15 +204,6 @@ class Theme extends StatelessWidget { | ||
204 | return context.inherited[ThemeData]; | 204 | return context.inherited[ThemeData]; |
205 | } | 205 | } |
206 | 206 | ||
207 | - @Deprecated('Use ThemeData.base()') | ||
208 | - static ThemeData base() => ThemeData.base(); | ||
209 | - | ||
210 | - @Deprecated('Use ThemeData.withFont()') | ||
211 | - static ThemeData withFont( | ||
212 | - {Font base, Font bold, Font italic, Font boldItalic}) => | ||
213 | - ThemeData.withFont( | ||
214 | - base: base, bold: bold, italic: italic, boldItalic: boldItalic); | ||
215 | - | ||
216 | @override | 207 | @override |
217 | Widget build(Context context) { | 208 | Widget build(Context context) { |
218 | return InheritedWidget( | 209 | return InheritedWidget( |
@@ -47,7 +47,6 @@ export 'src/widgets/page_theme.dart'; | @@ -47,7 +47,6 @@ export 'src/widgets/page_theme.dart'; | ||
47 | export 'src/widgets/partitions.dart'; | 47 | export 'src/widgets/partitions.dart'; |
48 | export 'src/widgets/placeholders.dart'; | 48 | export 'src/widgets/placeholders.dart'; |
49 | export 'src/widgets/progress.dart'; | 49 | export 'src/widgets/progress.dart'; |
50 | -export 'src/widgets/qrcode.dart'; | ||
51 | export 'src/widgets/stack.dart'; | 50 | export 'src/widgets/stack.dart'; |
52 | export 'src/widgets/svg.dart'; | 51 | export 'src/widgets/svg.dart'; |
53 | export 'src/widgets/table.dart'; | 52 | export 'src/widgets/table.dart'; |
@@ -38,8 +38,7 @@ void compute(Message message) { | @@ -38,8 +38,7 @@ void compute(Message message) { | ||
38 | message.image, | 38 | message.image, |
39 | ); | 39 | ); |
40 | 40 | ||
41 | - pdf.addPage( | ||
42 | - Page(build: (Context context) => Center(child: Image.provider(image)))); | 41 | + pdf.addPage(Page(build: (Context context) => Center(child: Image(image)))); |
43 | 42 | ||
44 | message.sendPort.send(pdf.save()); | 43 | message.sendPort.send(pdf.save()); |
45 | } | 44 | } |
@@ -37,7 +37,7 @@ void main() { | @@ -37,7 +37,7 @@ void main() { | ||
37 | 37 | ||
38 | test('Pdf Jpeg Download', () async { | 38 | test('Pdf Jpeg Download', () async { |
39 | pdf.addPage(Page( | 39 | pdf.addPage(Page( |
40 | - build: (Context context) => Center(child: Image.provider(image)), | 40 | + build: (Context context) => Center(child: Image(image)), |
41 | )); | 41 | )); |
42 | }); | 42 | }); |
43 | 43 | ||
@@ -49,7 +49,7 @@ void main() { | @@ -49,7 +49,7 @@ void main() { | ||
49 | crossAxisSpacing: 10, | 49 | crossAxisSpacing: 10, |
50 | children: List<Widget>.generate( | 50 | children: List<Widget>.generate( |
51 | images.length, | 51 | images.length, |
52 | - (int index) => Image.provider( | 52 | + (int index) => Image( |
53 | MemoryImage( | 53 | MemoryImage( |
54 | base64.decode(images[index]), | 54 | base64.decode(images[index]), |
55 | ), | 55 | ), |
@@ -69,7 +69,7 @@ void main() { | @@ -69,7 +69,7 @@ void main() { | ||
69 | return SizedBox( | 69 | return SizedBox( |
70 | width: 200, | 70 | width: 200, |
71 | height: 100, | 71 | height: 100, |
72 | - child: Image.provider( | 72 | + child: Image( |
73 | image, | 73 | image, |
74 | fit: fit, | 74 | fit: fit, |
75 | ), | 75 | ), |
@@ -82,7 +82,7 @@ void main() { | @@ -82,7 +82,7 @@ void main() { | ||
82 | test('Pdf Image decode', () { | 82 | test('Pdf Image decode', () { |
83 | final imageWidgets = imageFiles.map<Widget>( | 83 | final imageWidgets = imageFiles.map<Widget>( |
84 | (String image) => SizedBox( | 84 | (String image) => SizedBox( |
85 | - child: Image.provider( | 85 | + child: Image( |
86 | MemoryImage( | 86 | MemoryImage( |
87 | gzip.decode(base64.decode(image)), | 87 | gzip.decode(base64.decode(image)), |
88 | ), | 88 | ), |
@@ -38,7 +38,7 @@ void main() { | @@ -38,7 +38,7 @@ void main() { | ||
38 | padding: const EdgeInsets.all(20), | 38 | padding: const EdgeInsets.all(20), |
39 | decoration: BoxDecoration( | 39 | decoration: BoxDecoration( |
40 | color: PdfColors.blue, | 40 | color: PdfColors.blue, |
41 | - borderRadiusEx: const BorderRadius.all(Radius.circular(20)), | 41 | + borderRadius: const BorderRadius.all(Radius.circular(20)), |
42 | border: Border.all( | 42 | border: Border.all( |
43 | color: PdfColors.blue800, | 43 | color: PdfColors.blue800, |
44 | width: 2, | 44 | width: 2, |
@@ -61,8 +61,8 @@ void main() { | @@ -61,8 +61,8 @@ void main() { | ||
61 | alignment: Alignment.center, | 61 | alignment: Alignment.center, |
62 | decoration: BoxDecoration( | 62 | decoration: BoxDecoration( |
63 | shape: shape, | 63 | shape: shape, |
64 | - borderRadiusEx: const BorderRadius.all(Radius.circular(10)), | ||
65 | - image: DecorationImage.provider(image: image, fit: fit), | 64 | + borderRadius: const BorderRadius.all(Radius.circular(10)), |
65 | + image: DecorationImage(image: image, fit: fit), | ||
66 | ), | 66 | ), |
67 | width: 100, | 67 | width: 100, |
68 | height: 100, | 68 | height: 100, |
@@ -109,7 +109,7 @@ void main() { | @@ -109,7 +109,7 @@ void main() { | ||
109 | width: 200.0, | 109 | width: 200.0, |
110 | decoration: BoxDecoration( | 110 | decoration: BoxDecoration( |
111 | shape: BoxShape.rectangle, | 111 | shape: BoxShape.rectangle, |
112 | - borderRadiusEx: const BorderRadius.all(Radius.circular(40)), | 112 | + borderRadius: const BorderRadius.all(Radius.circular(40)), |
113 | border: Border.all(color: PdfColors.blue, width: 3), | 113 | border: Border.all(color: PdfColors.blue, width: 3), |
114 | ), | 114 | ), |
115 | ), | 115 | ), |
@@ -126,7 +126,7 @@ void main() { | @@ -126,7 +126,7 @@ void main() { | ||
126 | margin: const EdgeInsets.all(30), | 126 | margin: const EdgeInsets.all(30), |
127 | padding: const EdgeInsets.all(20), | 127 | padding: const EdgeInsets.all(20), |
128 | decoration: BoxDecoration( | 128 | decoration: BoxDecoration( |
129 | - borderRadiusEx: const BorderRadius.all(Radius.circular(20)), | 129 | + borderRadius: const BorderRadius.all(Radius.circular(20)), |
130 | gradient: const LinearGradient( | 130 | gradient: const LinearGradient( |
131 | colors: <PdfColor>[ | 131 | colors: <PdfColor>[ |
132 | PdfColors.blue, | 132 | PdfColors.blue, |
@@ -155,7 +155,7 @@ void main() { | @@ -155,7 +155,7 @@ void main() { | ||
155 | margin: const EdgeInsets.all(30), | 155 | margin: const EdgeInsets.all(30), |
156 | padding: const EdgeInsets.all(20), | 156 | padding: const EdgeInsets.all(20), |
157 | decoration: BoxDecoration( | 157 | decoration: BoxDecoration( |
158 | - borderRadiusEx: const BorderRadius.all(Radius.circular(20)), | 158 | + borderRadius: const BorderRadius.all(Radius.circular(20)), |
159 | gradient: const RadialGradient( | 159 | gradient: const RadialGradient( |
160 | colors: <PdfColor>[ | 160 | colors: <PdfColor>[ |
161 | PdfColors.blue, | 161 | PdfColors.blue, |
@@ -51,7 +51,7 @@ List<TableRow> buildTable( | @@ -51,7 +51,7 @@ List<TableRow> buildTable( | ||
51 | margin: const EdgeInsets.all(5), | 51 | margin: const EdgeInsets.all(5), |
52 | decoration: BoxDecoration( | 52 | decoration: BoxDecoration( |
53 | color: color, | 53 | color: color, |
54 | - borderRadiusEx: const BorderRadius.all(Radius.circular(5)), | 54 | + borderRadius: const BorderRadius.all(Radius.circular(5)), |
55 | ), | 55 | ), |
56 | height: Theme.of(context).tableCell.fontSize), | 56 | height: Theme.of(context).tableCell.fontSize), |
57 | Container( | 57 | Container( |
@@ -208,7 +208,7 @@ void main() { | @@ -208,7 +208,7 @@ void main() { | ||
208 | border: null, | 208 | border: null, |
209 | cellAlignment: Alignment.center, | 209 | cellAlignment: Alignment.center, |
210 | headerDecoration: const BoxDecoration( | 210 | headerDecoration: const BoxDecoration( |
211 | - borderRadiusEx: BorderRadius.all(Radius.circular(2)), | 211 | + borderRadius: BorderRadius.all(Radius.circular(2)), |
212 | color: PdfColors.indigo, | 212 | color: PdfColors.indigo, |
213 | ), | 213 | ), |
214 | headerHeight: 25, | 214 | headerHeight: 25, |
@@ -81,7 +81,7 @@ void main() { | @@ -81,7 +81,7 @@ void main() { | ||
81 | Row( | 81 | Row( |
82 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, | 82 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
83 | children: <Widget>[ | 83 | children: <Widget>[ |
84 | - Image.provider(im), | 84 | + Image(im), |
85 | PdfLogo(), | 85 | PdfLogo(), |
86 | Column( | 86 | Column( |
87 | children: <Widget>[ | 87 | children: <Widget>[ |
@@ -19,57 +19,8 @@ import 'dart:ui' as ui; | @@ -19,57 +19,8 @@ import 'dart:ui' as ui; | ||
19 | 19 | ||
20 | import 'package:flutter/rendering.dart' as rdr; | 20 | import 'package:flutter/rendering.dart' as rdr; |
21 | import 'package:flutter/services.dart'; | 21 | import 'package:flutter/services.dart'; |
22 | -import 'package:meta/meta.dart'; | ||
23 | -import 'package:pdf/pdf.dart'; | ||
24 | import 'package:pdf/widgets.dart'; | 22 | import 'package:pdf/widgets.dart'; |
25 | 23 | ||
26 | -/// Loads an image from a Flutter [ui.Image] | ||
27 | -/// into a [PdfImage] instance | ||
28 | -@Deprecated('Use flutterImageProvider') | ||
29 | -Future<PdfImage> pdfImageFromImage( | ||
30 | - {@required PdfDocument pdf, @required ui.Image image}) async { | ||
31 | - final bytes = await image.toByteData(format: ui.ImageByteFormat.rawRgba); | ||
32 | - | ||
33 | - return PdfImage(pdf, | ||
34 | - image: bytes.buffer.asUint8List(), | ||
35 | - width: image.width, | ||
36 | - height: image.height); | ||
37 | -} | ||
38 | - | ||
39 | -/// Loads an image from a Flutter [ImageProvider] | ||
40 | -/// into a [PdfImage] instance | ||
41 | -@Deprecated('Use flutterImageProvider') | ||
42 | -Future<PdfImage> pdfImageFromImageProvider( | ||
43 | - {@required PdfDocument pdf, | ||
44 | - @required rdr.ImageProvider image, | ||
45 | - rdr.ImageConfiguration configuration, | ||
46 | - rdr.ImageErrorListener onError}) async { | ||
47 | - final completer = Completer<PdfImage>(); | ||
48 | - final stream = image.resolve(configuration ?? rdr.ImageConfiguration.empty); | ||
49 | - | ||
50 | - rdr.ImageStreamListener listener; | ||
51 | - listener = rdr.ImageStreamListener((rdr.ImageInfo image, bool sync) async { | ||
52 | - final result = await pdfImageFromImage(pdf: pdf, image: image.image); | ||
53 | - if (!completer.isCompleted) { | ||
54 | - completer.complete(result); | ||
55 | - } | ||
56 | - stream.removeListener(listener); | ||
57 | - }, onError: (dynamic exception, StackTrace stackTrace) { | ||
58 | - if (!completer.isCompleted) { | ||
59 | - completer.complete(null); | ||
60 | - } | ||
61 | - if (onError != null) { | ||
62 | - onError(exception, stackTrace); | ||
63 | - } else { | ||
64 | - // https://groups.google.com/forum/#!topic/flutter-announce/hp1RNIgej38 | ||
65 | - assert(false, 'image failed to load'); | ||
66 | - } | ||
67 | - }); | ||
68 | - | ||
69 | - stream.addListener(listener); | ||
70 | - return completer.future; | ||
71 | -} | ||
72 | - | ||
73 | /// Loads an image from a Flutter [ImageProvider] | 24 | /// Loads an image from a Flutter [ImageProvider] |
74 | /// into an [ImageProvider] instance | 25 | /// into an [ImageProvider] instance |
75 | Future<ImageProvider> flutterImageProvider( | 26 | Future<ImageProvider> flutterImageProvider( |
@@ -167,13 +167,6 @@ mixin Printing { | @@ -167,13 +167,6 @@ mixin Printing { | ||
167 | return PrintingPlatform.instance.info(); | 167 | return PrintingPlatform.instance.info(); |
168 | } | 168 | } |
169 | 169 | ||
170 | - /// Returns a [PrintingInfo] object representing the capabilities | ||
171 | - /// supported for the current platform as a map | ||
172 | - @Deprecated('Use Printing.info()') | ||
173 | - static Future<Map<dynamic, dynamic>> printingInfo() async { | ||
174 | - return (await info()).asMap(); | ||
175 | - } | ||
176 | - | ||
177 | /// Convert a PDF to a list of images. | 170 | /// Convert a PDF to a list of images. |
178 | /// ```dart | 171 | /// ```dart |
179 | /// await for (final page in Printing.raster(content)) { | 172 | /// await for (final page in Printing.raster(content)) { |
@@ -194,19 +187,4 @@ mixin Printing { | @@ -194,19 +187,4 @@ mixin Printing { | ||
194 | 187 | ||
195 | return PrintingPlatform.instance.raster(document, pages, dpi); | 188 | return PrintingPlatform.instance.raster(document, pages, dpi); |
196 | } | 189 | } |
197 | - | ||
198 | - /// Prints a [PdfDocument] or a pdf stream to a local printer | ||
199 | - /// using the platform UI | ||
200 | - @Deprecated('use Printing.layoutPdf(onLayout: (_) => document.save());') | ||
201 | - static Future<void> printPdf({ | ||
202 | - @Deprecated('use bytes with document.save()') PdfDocument document, | ||
203 | - Uint8List bytes, | ||
204 | - }) async { | ||
205 | - assert(document != null || bytes != null); | ||
206 | - assert(!(document == null && bytes == null)); | ||
207 | - | ||
208 | - await layoutPdf( | ||
209 | - onLayout: (PdfPageFormat format) => | ||
210 | - document != null ? document.save() : bytes); | ||
211 | - } | ||
212 | } | 190 | } |
@@ -53,7 +53,7 @@ void main() { | @@ -53,7 +53,7 @@ void main() { | ||
53 | pw.Page( | 53 | pw.Page( |
54 | build: (pw.Context context) => pw.Center( | 54 | build: (pw.Context context) => pw.Center( |
55 | child: pw.Container( | 55 | child: pw.Container( |
56 | - child: pw.Image.provider(image), | 56 | + child: pw.Image(image), |
57 | ), | 57 | ), |
58 | ), | 58 | ), |
59 | ), | 59 | ), |
-
Please register or login to post a comment