Showing
5 changed files
with
25 additions
and
25 deletions
@@ -197,6 +197,7 @@ class BarcodeWidget extends StatelessWidget { | @@ -197,6 +197,7 @@ class BarcodeWidget extends StatelessWidget { | ||
197 | fontItalic: Font.courierOblique(), | 197 | fontItalic: Font.courierOblique(), |
198 | fontBoldItalic: Font.courierBoldOblique(), | 198 | fontBoldItalic: Font.courierBoldOblique(), |
199 | lineSpacing: 1, | 199 | lineSpacing: 1, |
200 | + fontSize: height != null ? height * 0.2 : null, | ||
200 | ); | 201 | ); |
201 | final TextStyle _textStyle = defaultstyle.merge(textStyle); | 202 | final TextStyle _textStyle = defaultstyle.merge(textStyle); |
202 | 203 |
@@ -4,7 +4,7 @@ description: A pdf producer for Dart. It can create pdf files for both web or fl | @@ -4,7 +4,7 @@ description: A pdf producer for Dart. It can create pdf files for both web or fl | ||
4 | homepage: https://github.com/DavBfr/dart_pdf/tree/master/pdf | 4 | homepage: https://github.com/DavBfr/dart_pdf/tree/master/pdf |
5 | repository: https://github.com/DavBfr/dart_pdf | 5 | repository: https://github.com/DavBfr/dart_pdf |
6 | issue_tracker: https://github.com/DavBfr/dart_pdf/issues | 6 | issue_tracker: https://github.com/DavBfr/dart_pdf/issues |
7 | -version: 1.4.0 | 7 | +version: 1.4.1 |
8 | 8 | ||
9 | environment: | 9 | environment: |
10 | sdk: ">=2.3.0 <3.0.0" | 10 | sdk: ">=2.3.0 <3.0.0" |
@@ -16,7 +16,7 @@ dependencies: | @@ -16,7 +16,7 @@ dependencies: | ||
16 | crypto: ^2.0.6 | 16 | crypto: ^2.0.6 |
17 | archive: ^2.0.10 | 17 | archive: ^2.0.10 |
18 | qr: ^1.2.0 | 18 | qr: ^1.2.0 |
19 | - barcode: ^1.4.0 | 19 | + barcode: ^1.5.0 |
20 | 20 | ||
21 | dev_dependencies: | 21 | dev_dependencies: |
22 | test: | 22 | test: |
@@ -25,7 +25,7 @@ import 'package:test/test.dart'; | @@ -25,7 +25,7 @@ import 'package:test/test.dart'; | ||
25 | 25 | ||
26 | Document pdf; | 26 | Document pdf; |
27 | 27 | ||
28 | -Widget barcode(Barcode barcode, String data) { | 28 | +Widget barcode(Barcode barcode, String data, {double width = 200}) { |
29 | return Row( | 29 | return Row( |
30 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, | 30 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
31 | children: <Widget>[ | 31 | children: <Widget>[ |
@@ -37,21 +37,13 @@ Widget barcode(Barcode barcode, String data) { | @@ -37,21 +37,13 @@ Widget barcode(Barcode barcode, String data) { | ||
37 | ), | 37 | ), |
38 | Flexible( | 38 | Flexible( |
39 | fit: FlexFit.tight, | 39 | fit: FlexFit.tight, |
40 | - child: BarcodeWidget( | ||
41 | - barcode: barcode, | ||
42 | - data: data, | ||
43 | - width: 200, | ||
44 | - height: 80, | ||
45 | - margin: const EdgeInsets.symmetric(vertical: 20), | ||
46 | - padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 3), | ||
47 | - decoration: const BoxDecoration( | ||
48 | - border: BoxBorder( | ||
49 | - color: PdfColors.blue, | ||
50 | - top: true, | ||
51 | - bottom: true, | ||
52 | - left: true, | ||
53 | - right: true, | ||
54 | - ), | 40 | + child: Center( |
41 | + child: BarcodeWidget( | ||
42 | + barcode: barcode, | ||
43 | + data: data, | ||
44 | + width: width, | ||
45 | + height: 80, | ||
46 | + margin: const EdgeInsets.symmetric(vertical: 20), | ||
55 | ), | 47 | ), |
56 | ), | 48 | ), |
57 | ), | 49 | ), |
@@ -72,11 +64,14 @@ void main() { | @@ -72,11 +64,14 @@ void main() { | ||
72 | barcode(Barcode.code39(), 'CODE 39'), | 64 | barcode(Barcode.code39(), 'CODE 39'), |
73 | barcode(Barcode.code93(), 'CODE 93'), | 65 | barcode(Barcode.code93(), 'CODE 93'), |
74 | barcode(Barcode.code128(), 'Barcode 128'), | 66 | barcode(Barcode.code128(), 'Barcode 128'), |
75 | - barcode(Barcode.ean13(), '590123412345'), | ||
76 | - barcode(Barcode.ean8(), '9638507'), | ||
77 | - barcode(Barcode.isbn(), '978316148410'), | ||
78 | - barcode(Barcode.upcA(), '98765432109'), | ||
79 | - barcode(Barcode.upcE(), '06510000432'), | 67 | + barcode(Barcode.ean13(), '590123412345', width: 150), |
68 | + barcode(Barcode.ean8(), '9638507', width: 80), | ||
69 | + barcode(Barcode.isbn(), '978316148410', width: 150), | ||
70 | + barcode(Barcode.upcA(), '98765432109', width: 150), | ||
71 | + barcode(Barcode.upcE(), '06510000432', width: 100), | ||
72 | + barcode(Barcode.ean2(), '44', width: 40), | ||
73 | + barcode(Barcode.ean5(), '30897', width: 60), | ||
74 | + barcode(Barcode.itf14(), '2578639587234'), | ||
80 | ], | 75 | ], |
81 | ), | 76 | ), |
82 | ); | 77 | ); |
No preview for this file type
-
Please register or login to post a comment