David PHAM-VAN

Remove deprecated functions

@@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
5 - Improve Annotations 5 - Improve Annotations
6 - Implement table row vertical alignment 6 - Implement table row vertical alignment
7 - Improve Internal data structure 7 - Improve Internal data structure
  8 +- Remove deprecated functions
8 9
9 ## 1.5.0 10 ## 1.5.0
10 11
@@ -37,7 +37,6 @@ part 'src/border.dart'; @@ -37,7 +37,6 @@ part 'src/border.dart';
37 part 'src/catalog.dart'; 37 part 'src/catalog.dart';
38 part 'src/color.dart'; 38 part 'src/color.dart';
39 part 'src/colors.dart'; 39 part 'src/colors.dart';
40 -part 'src/compatibility.dart';  
41 part 'src/data_types.dart'; 40 part 'src/data_types.dart';
42 part 'src/document.dart'; 41 part 'src/document.dart';
43 part 'src/encryption.dart'; 42 part 'src/encryption.dart';
@@ -25,55 +25,6 @@ class PdfAnnot extends PdfObject { @@ -25,55 +25,6 @@ class PdfAnnot extends PdfObject {
25 pdfPage.annotations.add(this); 25 pdfPage.annotations.add(this);
26 } 26 }
27 27
28 - /// Create a text annotation  
29 - @deprecated  
30 - factory PdfAnnot.text(  
31 - PdfPage pdfPage, {  
32 - @required PdfRect rect,  
33 - @required String content,  
34 - PdfBorder border,  
35 - }) =>  
36 - PdfAnnot(  
37 - pdfPage,  
38 - PdfAnnotText(  
39 - rect: rect,  
40 - content: content,  
41 - border: border,  
42 - ));  
43 -  
44 - /// Creates an external link annotation  
45 - @deprecated  
46 - factory PdfAnnot.urlLink(  
47 - PdfPage pdfPage, {  
48 - @required PdfRect rect,  
49 - @required String dest,  
50 - PdfBorder border,  
51 - }) =>  
52 - PdfAnnot(  
53 - pdfPage,  
54 - PdfAnnotUrlLink(  
55 - rect: rect,  
56 - url: dest,  
57 - border: border,  
58 - ));  
59 -  
60 - /// Creates a link annotation to a named destination  
61 - @deprecated  
62 - factory PdfAnnot.namedLink(  
63 - PdfPage pdfPage, {  
64 - @required PdfRect rect,  
65 - @required String dest,  
66 - PdfBorder border,  
67 - }) =>  
68 - PdfAnnot(  
69 - pdfPage,  
70 - PdfAnnotNamedLink(  
71 - rect: rect,  
72 - dest: dest,  
73 - border: border,  
74 - ),  
75 - );  
76 -  
77 /// The annotation content 28 /// The annotation content
78 final PdfAnnotBase annot; 29 final PdfAnnotBase annot;
79 30
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 -// ignore_for_file: omit_local_variable_types  
18 -// ignore_for_file: avoid_unused_constructor_parameters  
19 -  
20 -part of pdf;  
21 -  
22 -@deprecated  
23 -class PDFAnnot extends PdfAnnot {  
24 - PDFAnnot(PdfPage pdfPage,  
25 - {String type,  
26 - String s,  
27 - double l,  
28 - double b,  
29 - double r,  
30 - double t,  
31 - String subtype,  
32 - PdfObject dest,  
33 - double fl,  
34 - double fb,  
35 - double fr,  
36 - double ft})  
37 - : super(pdfPage, PdfAnnotText(rect: PdfRect(l, b, r, t), content: s));  
38 -  
39 - factory PDFAnnot.annotation(  
40 - PdfPage pdfPage, String s, double l, double b, double r, double t) =>  
41 - PDFAnnot(pdfPage, type: '/Annot', s: s, l: l, b: b, r: r, t: t);  
42 -  
43 - factory PDFAnnot.text(  
44 - PdfPage pdfPage, double l, double b, double r, double t, String s) =>  
45 - PDFAnnot(pdfPage, type: '/Text', l: l, b: b, r: r, t: t, s: s);  
46 -  
47 - factory PDFAnnot.link(PdfPage pdfPage, double l, double b, double r, double t,  
48 - PdfObject dest,  
49 - [double fl = FULL_PAGE,  
50 - double fb = FULL_PAGE,  
51 - double fr = FULL_PAGE,  
52 - double ft = FULL_PAGE]) =>  
53 - PDFAnnot(pdfPage,  
54 - type: '/Link',  
55 - l: l,  
56 - b: b,  
57 - r: r,  
58 - t: t,  
59 - dest: dest,  
60 - fl: fl,  
61 - fb: fb,  
62 - fr: fr,  
63 - ft: ft);  
64 -  
65 - static const PdfBorderStyle SOLID = PdfBorderStyle.solid;  
66 - static const PdfBorderStyle DASHED = PdfBorderStyle.dashed;  
67 - static const PdfBorderStyle BEVELED = PdfBorderStyle.beveled;  
68 - static const PdfBorderStyle INSET = PdfBorderStyle.inset;  
69 - static const PdfBorderStyle UNDERLINED = PdfBorderStyle.underlined;  
70 - static const double FULL_PAGE = -9999;  
71 -}  
72 -  
73 -@deprecated  
74 -class PDFArrayObject extends PdfArrayObject {  
75 - PDFArrayObject(PdfDocument pdfDocument, List<String> values)  
76 - : super(pdfDocument, null);  
77 -}  
78 -  
79 -@deprecated  
80 -class PDFBorder extends PdfBorder {  
81 - PDFBorder(PdfDocument pdfDocument, double width,  
82 - {int style, List<double> dash})  
83 - : super(pdfDocument, width,  
84 - style: PdfBorderStyle.values[style], dash: dash);  
85 -}  
86 -  
87 -@deprecated  
88 -class PDFCatalog extends PdfCatalog {  
89 - PDFCatalog(PdfDocument pdfDocument, PdfPageList pdfPageList,  
90 - PdfPageMode pageMode, PdfNames names)  
91 - : super(pdfDocument, pdfPageList, pageMode, names);  
92 -}  
93 -  
94 -@deprecated  
95 -class PDFDocument extends PdfDocument {  
96 - PDFDocument(  
97 - {PdfPageMode pageMode = PdfPageMode.none, DeflateCallback deflate})  
98 - : super(pageMode: pageMode, deflate: deflate);  
99 -}  
100 -  
101 -@deprecated  
102 -class PDFColor extends PdfColor {  
103 - PDFColor(double r, double g, double b, [double a = 1.0]) : super(r, g, b, a);  
104 -  
105 - factory PDFColor.fromInt(int color) {  
106 - final PdfColor c = PdfColor.fromInt(color);  
107 - return PDFColor(c.red, c.green, c.blue, c.alpha);  
108 - }  
109 -  
110 - factory PDFColor.fromHex(String color) {  
111 - final PdfColor c = PdfColor.fromHex(color);  
112 - return PDFColor(c.red, c.green, c.blue, c.alpha);  
113 - }  
114 -  
115 - @deprecated  
116 - static const PdfColor black = PdfColors.black;  
117 - @deprecated  
118 - static const PdfColor white = PdfColors.white;  
119 - @deprecated  
120 - static const PdfColor pink = PdfColors.pink;  
121 - @deprecated  
122 - static const PdfColor purple = PdfColors.purple;  
123 - @deprecated  
124 - static const PdfColor deepPurple = PdfColors.deepPurple;  
125 - @deprecated  
126 - static const PdfColor indigo = PdfColors.indigo;  
127 - @deprecated  
128 - static const PdfColor lightBlue = PdfColors.lightBlue;  
129 - @deprecated  
130 - static const PdfColor cyan = PdfColors.cyan;  
131 - @deprecated  
132 - static const PdfColor teal = PdfColors.teal;  
133 - @deprecated  
134 - static const PdfColor lightGreen = PdfColors.lightGreen;  
135 - @deprecated  
136 - static const PdfColor lime = PdfColors.lime;  
137 - @deprecated  
138 - static const PdfColor yellow = PdfColors.yellow;  
139 - @deprecated  
140 - static const PdfColor amber = PdfColors.amber;  
141 - @deprecated  
142 - static const PdfColor orange = PdfColors.orange;  
143 - @deprecated  
144 - static const PdfColor deepOrange = PdfColors.deepOrange;  
145 - @deprecated  
146 - static const PdfColor brown = PdfColors.brown;  
147 - @deprecated  
148 - static const PdfColor grey = PdfColors.grey;  
149 - @deprecated  
150 - static const PdfColor blueGrey = PdfColors.blueGrey;  
151 -  
152 - @deprecated  
153 - double get r => red;  
154 -  
155 - @deprecated  
156 - double get g => green;  
157 -  
158 - @deprecated  
159 - double get b => blue;  
160 -}  
161 -  
162 -@deprecated  
163 -class PDFFontDescriptor extends PdfFontDescriptor {  
164 - PDFFontDescriptor(PdfTtfFont ttfFont, PdfObjectStream file)  
165 - : super(ttfFont, file);  
166 -}  
167 -  
168 -@deprecated  
169 -class PDFFont extends PdfFont {  
170 - factory PDFFont(PdfDocument pdfDocument, {String subtype, String baseFont}) {  
171 - subtype ??= baseFont;  
172 - return PdfFont.helvetica(pdfDocument);  
173 - }  
174 -  
175 - @override  
176 - PdfFontMetrics glyphMetrics(int charCode) {  
177 - return PdfFontMetrics.zero;  
178 - }  
179 -}  
180 -  
181 -@deprecated  
182 -class PDFFormXObject extends PdfFormXObject {  
183 - PDFFormXObject(PdfDocument pdfDocument) : super(pdfDocument);  
184 -}  
185 -  
186 -@deprecated  
187 -class PDFGraphics extends PdfGraphics {  
188 - PDFGraphics(PdfPage page, PdfStream buf) : super(page, buf);  
189 -}  
190 -  
191 -@deprecated  
192 -class PDFImage extends PdfImage {  
193 - PDFImage(  
194 - PdfDocument pdfDocument, {  
195 - @required Uint8List image,  
196 - @required int width,  
197 - @required int height,  
198 - bool alpha = true,  
199 - }) : super._(pdfDocument,  
200 - image: image,  
201 - width: width,  
202 - height: height,  
203 - alpha: alpha,  
204 - alphaChannel: false,  
205 - isRGB: true,  
206 - jpeg: false,  
207 - orientation: PdfImageOrientation.topLeft);  
208 -}  
209 -  
210 -@deprecated  
211 -class PDFInfo extends PdfInfo {  
212 - PDFInfo(PdfDocument pdfDocument,  
213 - {String title,  
214 - String author,  
215 - String creator,  
216 - String subject,  
217 - String keywords})  
218 - : super(pdfDocument,  
219 - title: title,  
220 - author: author,  
221 - creator: creator,  
222 - subject: subject,  
223 - keywords: keywords);  
224 -}  
225 -  
226 -@deprecated  
227 -class PDFObjectStream extends PdfObjectStream {  
228 - PDFObjectStream(PdfDocument pdfDocument, {String type, bool isBinary = false})  
229 - : super(pdfDocument, type: type, isBinary: isBinary);  
230 -}  
231 -  
232 -@deprecated  
233 -class PDFObject extends PdfObject {  
234 - PDFObject(PdfDocument pdfDocument, [String type]) : super(pdfDocument, type);  
235 -}  
236 -  
237 -@deprecated  
238 -class PDFOutline extends PdfOutline {  
239 - PDFOutline(PdfDocument pdfDocument,  
240 - {String title, PdfPage dest, double l, double b, double r, double t})  
241 - : super(pdfDocument,  
242 - title: title, dest: dest, rect: PdfRect.fromLTRB(l, t, r, b));  
243 -  
244 - @deprecated  
245 - static const PdfOutlineMode FITPAGE = PdfOutlineMode.fitpage;  
246 -  
247 - @deprecated  
248 - static const PdfOutlineMode FITRECT = PdfOutlineMode.fitrect;  
249 -}  
250 -  
251 -@deprecated  
252 -class PDFOutput extends PdfOutput {  
253 - PDFOutput(PdfStream os) : super(os);  
254 -}  
255 -  
256 -@deprecated  
257 -class PDFPageFormat extends PdfPageFormat {  
258 - const PDFPageFormat(double width, double height) : super(width, height);  
259 -  
260 - static const PdfPageFormat a4 = PdfPageFormat.a4;  
261 - static const PdfPageFormat a3 = PdfPageFormat.a3;  
262 - static const PdfPageFormat a5 = PdfPageFormat.a5;  
263 - static const PdfPageFormat letter = PdfPageFormat.letter;  
264 - static const PdfPageFormat legal = PdfPageFormat.legal;  
265 - static const double point = PdfPageFormat.point;  
266 - static const double inch = PdfPageFormat.inch;  
267 - static const double cm = PdfPageFormat.cm;  
268 - static const double mm = PdfPageFormat.mm;  
269 - static const PdfPageFormat A4 = a4;  
270 - static const PdfPageFormat A3 = a3;  
271 - static const PdfPageFormat A5 = a5;  
272 - static const PdfPageFormat LETTER = letter;  
273 - static const PdfPageFormat LEGAL = legal;  
274 - static const double PT = point;  
275 - static const double IN = inch;  
276 - static const double CM = cm;  
277 - static const double MM = mm;  
278 -}  
279 -  
280 -@deprecated  
281 -class PDFPageList extends PdfPageList {  
282 - PDFPageList(PdfDocument pdfDocument) : super(pdfDocument);  
283 -}  
284 -  
285 -@deprecated  
286 -class PDFPage extends PdfPage {  
287 - PDFPage(PdfDocument pdfDocument, {PdfPageFormat pageFormat})  
288 - : super(pdfDocument, pageFormat: pageFormat);  
289 -  
290 - /// Returns the page's PageFormat.  
291 - /// @return PageFormat describing the page size in device units (72dpi)  
292 - /// use pageFormat  
293 - @deprecated  
294 - PdfPageFormat getPageFormat() {  
295 - return pageFormat;  
296 - }  
297 -  
298 - /// Gets the dimensions of the page.  
299 - /// @return a Dimension object containing the width and height of the page.  
300 - /// use pageFormat.dimension  
301 - @deprecated  
302 - PdfPoint getDimension() => PdfPoint(pageFormat.width, pageFormat.height);  
303 -  
304 - /// This method adds a text note to the document.  
305 - /// @param note Text of the note  
306 - /// @param x Coordinate of note  
307 - /// @param y Coordinate of note  
308 - /// @param w Width of the note  
309 - /// @param h Height of the note  
310 - /// @return Returns the annotation, so other settings can be changed.  
311 - @deprecated  
312 - PdfAnnot addNote(String note, double x, double y, double w, double h) {  
313 - final PdfPoint xy1 = cxy(x, y + h);  
314 - final PdfPoint xy2 = cxy(x + w, y);  
315 - final PdfAnnot ob = PdfAnnot.text(this,  
316 - rect: PdfRect.fromLTRB(xy1.x, xy1.y, xy2.x, xy2.y), content: note);  
317 - return ob;  
318 - }  
319 -  
320 - /// Adds a hyperlink to the document.  
321 - /// @param x Coordinate of active area  
322 - /// @param y Coordinate of active area  
323 - /// @param w Width of the active area  
324 - /// @param h Height of the active area  
325 - /// @param dest Page that will be displayed when the link is activated. When  
326 - /// displayed, the zoom factor will be changed to fit the display.  
327 - /// @param vx Coordinate of view area  
328 - /// @param vy Coordinate of view area  
329 - /// @param vw Width of the view area  
330 - /// @param vh Height of the view area  
331 - /// @return Returns the annotation, so other settings can be changed.  
332 - @deprecated  
333 - PdfAnnot addLink(double x, double y, double w, double h, PdfObject dest,  
334 - [double vx = PDFAnnot.FULL_PAGE,  
335 - double vy = PDFAnnot.FULL_PAGE,  
336 - double vw = PDFAnnot.FULL_PAGE,  
337 - double vh = PDFAnnot.FULL_PAGE]) {  
338 - final PdfPoint xy1 = cxy(x, y + h);  
339 - final PdfPoint xy2 = cxy(x + w, y);  
340 - final PdfAnnot ob = PdfAnnot.urlLink(  
341 - this,  
342 - rect: PdfRect.fromLTRB(xy1.x, xy1.y, xy2.x, xy2.y),  
343 - dest: 'https://github.com/DavBfr/dart_pdf',  
344 - );  
345 - return ob;  
346 - }  
347 -  
348 - /// This method attaches an outline to the current page being generated. When  
349 - /// selected, the outline displays the top of the page.  
350 - /// @param title Outline title to attach  
351 - /// @param x Left coordinate of region  
352 - /// @param y Bottom coordinate of region  
353 - /// @param w Width of region  
354 - /// @param h Height coordinate of region  
355 - /// @return [PdfOutline] object created, for addSubOutline if required.  
356 - @deprecated  
357 - PdfOutline addOutline(String title,  
358 - {double x, double y, double w, double h}) {  
359 - final PdfPoint xy1 = cxy(x, y + h);  
360 - final PdfPoint xy2 = cxy(x + w, y);  
361 - final PdfOutline outline = PdfOutline(pdfDocument,  
362 - title: title,  
363 - dest: this,  
364 - rect: PdfRect.fromLTRB(xy1.x, xy2.y, xy2.x, xy1.y));  
365 - pdfDocument.outline.outlines.add(outline);  
366 - return outline;  
367 - }  
368 -  
369 - /// This utility method converts the y coordinate to User space  
370 - /// within the page.  
371 - /// @param x Coordinate in User space  
372 - /// @param y Coordinate in User space  
373 - /// @return y Coordinate in User space  
374 - @deprecated  
375 - double cy(double x, double y) => cxy(x, y).y;  
376 -  
377 - /// This utility method converts the x coordinate to User space  
378 - /// within the page.  
379 - /// @param x Coordinate in User space  
380 - /// @param y Coordinate in User space  
381 - /// @return x Coordinate in User space  
382 - @deprecated  
383 - double cx(double x, double y) => cxy(x, y).x;  
384 -  
385 - /// This utility method converts the coordinates to User space  
386 - /// within the page.  
387 - /// @param x Coordinate in User space  
388 - /// @param y Coordinate in User space  
389 - /// @return array containing the x & y Coordinate in User space  
390 - @deprecated  
391 - PdfPoint cxy(double x, double y) => PdfPoint(x, pageFormat.height - y);  
392 -}  
393 -  
394 -@deprecated  
395 -class PDFPoint extends PdfPoint {  
396 - const PDFPoint(double w, double h) : super(w, h);  
397 -}  
398 -  
399 -@deprecated  
400 -class PDFRect extends PdfRect {  
401 - const PDFRect(double x, double y, double w, double h) : super(x, y, w, h);  
402 -}  
403 -  
404 -@deprecated  
405 -class PDFStream extends PdfStream {}  
406 -  
407 -@deprecated  
408 -class TTFParser extends TtfParser {  
409 - TTFParser(ByteData bytes) : super(bytes);  
410 -}  
411 -  
412 -@deprecated  
413 -class PDFTTFFont extends PdfTtfFont {  
414 - PDFTTFFont(PdfDocument pdfDocument, ByteData bytes)  
415 - : super(pdfDocument, bytes);  
416 -}  
417 -  
418 -@deprecated  
419 -class PDFXObject extends PdfXObject {  
420 - PDFXObject(PdfDocument pdfDocument, String subtype)  
421 - : super(pdfDocument, subtype);  
422 -}  
423 -  
424 -@deprecated  
425 -enum PDFPageMode { NONE, OUTLINES, THUMBS, FULLSCREEN }  
426 -  
427 -@deprecated  
428 -enum PDFLineCap { JOIN_MITER, JOIN_ROUND, JOIN_BEVEL }  
429 -  
430 -@deprecated  
431 -class PDFXref extends PdfXref {  
432 - PDFXref(int id, int offset) : super(id, offset);  
433 -}  
@@ -149,9 +149,7 @@ class _BarcodeWidget extends Widget { @@ -149,9 +149,7 @@ class _BarcodeWidget extends Widget {
149 class BarcodeWidget extends StatelessWidget { 149 class BarcodeWidget extends StatelessWidget {
150 BarcodeWidget({ 150 BarcodeWidget({
151 @required this.data, 151 @required this.data,
152 - @Deprecated('Use `Barcode.fromType(type)` instead')  
153 - BarcodeType type = BarcodeType.Code39,  
154 - Barcode barcode, 152 + @required this.barcode,
155 this.color = PdfColors.black, 153 this.color = PdfColors.black,
156 this.backgroundColor, 154 this.backgroundColor,
157 this.decoration, 155 this.decoration,
@@ -161,9 +159,7 @@ class BarcodeWidget extends StatelessWidget { @@ -161,9 +159,7 @@ class BarcodeWidget extends StatelessWidget {
161 this.height, 159 this.height,
162 this.drawText = true, 160 this.drawText = true,
163 this.textStyle, 161 this.textStyle,
164 - }) :  
165 - // ignore: deprecated_member_use,deprecated_member_use_from_same_package  
166 - barcode = barcode ?? Barcode.fromType(type); 162 + }) : assert(barcode != null);
167 163
168 /// the barcode data 164 /// the barcode data
169 final String data; 165 final String data;