Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
dart_pdf
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
David PHAM-VAN
2020-01-01 09:36:56 -0500
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c09ad49dbd2b438ee17bb99b8216c1a3863f6382
c09ad49d
1 parent
b6e6ae2c
Fix BarcodeWidget positioning
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
12 deletions
pdf/CHANGELOG.md
pdf/lib/widgets/barcode.dart
pdf/pubspec.yaml
pdf/test/widget_barcode_test.dart
test/golden/widgets-barcode.pdf
pdf/CHANGELOG.md
View file @
c09ad49
# Changelog
## 1.
3.3
0
## 1.
4.
0
-
Improve BarcodeWidget
-
Fix BarcodeWidget positioning
-
Update dependency to barcode ^1.4.0
## 1.3.29
...
...
pdf/lib/widgets/barcode.dart
View file @
c09ad49
...
...
@@ -61,7 +61,7 @@ class _BarcodeWidget extends Widget {
if
(
element
.
black
)
{
context
.
canvas
.
drawRect
(
box
.
left
+
element
.
left
,
box
.
top
+
element
.
top
-
element
.
height
,
box
.
top
-
element
.
top
-
element
.
height
,
element
.
width
,
element
.
height
,
);
...
...
@@ -81,15 +81,28 @@ class _BarcodeWidget extends Widget {
for
(
BarcodeText
text
in
textList
)
{
final
PdfFontMetrics
metrics
=
font
.
stringMetrics
(
text
.
text
);
final
double
left
=
text
.
left
+
box
.
left
+
(
text
.
width
-
metrics
.
width
*
text
.
height
)
/
2
;
final
double
top
=
box
.
top
-
text
.
top
-
metrics
.
descent
*
textStyle
.
fontSize
-
text
.
height
;
double
left
;
switch
(
text
.
align
)
{
case
BarcodeTextAlign
.
left
:
left
=
text
.
left
+
box
.
left
;
break
;
case
BarcodeTextAlign
.
center
:
left
=
text
.
left
+
box
.
left
+
(
text
.
width
-
metrics
.
width
*
text
.
height
)
/
2
;
break
;
case
BarcodeTextAlign
.
right
:
left
=
text
.
left
+
box
.
left
+
(
text
.
width
-
metrics
.
width
*
text
.
height
);
break
;
}
context
.
canvas
..
setFillColor
(
textStyle
.
color
)
..
drawString
(
...
...
pdf/pubspec.yaml
View file @
c09ad49
...
...
@@ -4,7 +4,7 @@ description: A pdf producer for Dart. It can create pdf files for both web or fl
homepage
:
https://github.com/DavBfr/dart_pdf/tree/master/pdf
repository
:
https://github.com/DavBfr/dart_pdf
issue_tracker
:
https://github.com/DavBfr/dart_pdf/issues
version
:
1.
3.3
0
version
:
1.
4.
0
environment
:
sdk
:
"
>=2.3.0
<3.0.0"
...
...
@@ -16,7 +16,7 @@ dependencies:
crypto
:
^2.0.6
archive
:
^2.0.10
qr
:
^1.2.0
barcode
:
^1.
0
.0
barcode
:
^1.
4
.0
dev_dependencies
:
test
:
...
...
pdf/test/widget_barcode_test.dart
View file @
c09ad49
...
...
@@ -44,7 +44,7 @@ Widget barcode(Barcode barcode, String data) {
height:
80
,
margin:
const
EdgeInsets
.
symmetric
(
vertical:
20
),
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
10
,
vertical:
3
),
decoration:
BoxDecoration
(
decoration:
const
BoxDecoration
(
border:
BoxBorder
(
color:
PdfColors
.
blue
,
top:
true
,
...
...
@@ -93,7 +93,7 @@ void main() {
decoration:
BoxDecoration
(
borderRadius:
20
,
color:
PdfColors
.
white
,
border:
BoxBorder
(
border:
const
BoxBorder
(
color:
PdfColors
.
blue
,
top:
true
,
bottom:
true
,
...
...
test/golden/widgets-barcode.pdf
View file @
c09ad49
No preview for this file type
Please
register
or
login
to post a comment