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
2021-02-09 08:25:06 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e76cf66161338f9242f9b468c33587e767de3119
e76cf661
1 parent
4ff598d8
Fix Table border
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
36 deletions
pdf/CHANGELOG.md
pdf/lib/src/widgets/box_border.dart
pdf/lib/src/widgets/grid_paper.dart
pdf/lib/src/widgets/table.dart
pdf/pubspec.yaml
pdf/CHANGELOG.md
View file @
e76cf66
# Changelog
## 3.0.0-nullsafety.1
-
Fix Table border
## 3.0.0-nullsafety.0
-
Fix SVG fit alignment
...
...
pdf/lib/src/widgets/box_border.dart
View file @
e76cf66
...
...
@@ -41,8 +41,8 @@ abstract class BoxBorder {
BorderRadius
?
borderRadius
,
});
static
void
_setStyle
(
Context
context
,
BorderStyle
?
style
)
{
switch
(
style
!)
{
static
void
setStyle
(
Context
context
,
BorderStyle
style
)
{
switch
(
style
)
{
case
BorderStyle
.
none
:
case
BorderStyle
.
solid
:
break
;
...
...
@@ -59,8 +59,8 @@ abstract class BoxBorder {
}
}
static
void
_unsetStyle
(
Context
context
,
BorderStyle
?
style
)
{
switch
(
style
!)
{
static
void
unsetStyle
(
Context
context
,
BorderStyle
style
)
{
switch
(
style
)
{
case
BorderStyle
.
none
:
case
BorderStyle
.
solid
:
break
;
...
...
@@ -73,40 +73,40 @@ abstract class BoxBorder {
static
void
_paintUniformBorderWithCircle
(
Context
context
,
PdfRect
box
,
BorderSide
side
)
{
_
setStyle
(
context
,
side
.
style
);
setStyle
(
context
,
side
.
style
);
context
.
canvas
..
setStrokeColor
(
side
.
color
)
..
setLineWidth
(
side
.
width
!
)
..
setLineWidth
(
side
.
width
)
..
drawEllipse
(
box
.
x
+
box
.
width
/
2.0
,
box
.
y
+
box
.
height
/
2.0
,
box
.
width
/
2.0
,
box
.
height
/
2.0
)
..
strokePath
();
_
unsetStyle
(
context
,
side
.
style
);
unsetStyle
(
context
,
side
.
style
);
}
static
void
_paintUniformBorderWithRadius
(
Context
context
,
PdfRect
box
,
BorderSide
side
,
BorderRadius
borderRadius
)
{
_
setStyle
(
context
,
side
.
style
);
setStyle
(
context
,
side
.
style
);
context
.
canvas
..
setLineJoin
(
PdfLineJoin
.
miter
)
..
setMiterLimit
(
4
)
..
setStrokeColor
(
side
.
color
)
..
setLineWidth
(
side
.
width
!
);
..
setLineWidth
(
side
.
width
);
borderRadius
.
paint
(
context
,
box
);
context
.
canvas
.
strokePath
();
_
unsetStyle
(
context
,
side
.
style
);
unsetStyle
(
context
,
side
.
style
);
}
static
void
_paintUniformBorderWithRectangle
(
Context
context
,
PdfRect
box
,
BorderSide
side
)
{
_
setStyle
(
context
,
side
.
style
);
setStyle
(
context
,
side
.
style
);
context
.
canvas
..
setLineJoin
(
PdfLineJoin
.
miter
)
..
setMiterLimit
(
4
)
..
setStrokeColor
(
side
.
color
)
..
setLineWidth
(
side
.
width
!
)
..
setLineWidth
(
side
.
width
)
..
drawBox
(
box
)
..
strokePath
();
_
unsetStyle
(
context
,
side
.
style
);
unsetStyle
(
context
,
side
.
style
);
}
}
...
...
@@ -124,13 +124,13 @@ class BorderSide {
BorderSide
(
width:
0.0
,
style:
BorderStyle
.
none
);
/// The color of this side of the border.
final
PdfColor
?
color
;
final
PdfColor
color
;
/// The width of this side of the border.
final
double
?
width
;
final
double
width
;
/// The style of this side of the border.
final
BorderStyle
?
style
;
final
BorderStyle
style
;
BorderSide
copyWith
({
PdfColor
?
color
,
...
...
@@ -138,9 +138,9 @@ class BorderSide {
BorderStyle
?
style
,
})
=>
BorderSide
(
color:
color
,
width:
width
,
style:
style
,
color:
color
??
this
.
color
,
width:
width
??
this
.
width
,
style:
style
??
this
.
style
,
);
@override
...
...
@@ -252,43 +252,43 @@ class Border extends BoxBorder {
..
setLineJoin
(
PdfLineJoin
.
miter
);
if
(
top
.
style
!=
BorderStyle
.
none
)
{
BoxBorder
.
_
setStyle
(
context
,
top
.
style
);
BoxBorder
.
setStyle
(
context
,
top
.
style
);
context
.
canvas
..
setStrokeColor
(
top
.
color
)
..
setLineWidth
(
top
.
width
!
)
..
setLineWidth
(
top
.
width
)
..
drawLine
(
box
.
left
,
box
.
top
,
box
.
right
,
box
.
top
)
..
strokePath
();
BoxBorder
.
_
unsetStyle
(
context
,
top
.
style
);
BoxBorder
.
unsetStyle
(
context
,
top
.
style
);
}
if
(
right
.
style
!=
BorderStyle
.
none
)
{
BoxBorder
.
_
setStyle
(
context
,
right
.
style
);
BoxBorder
.
setStyle
(
context
,
right
.
style
);
context
.
canvas
..
setStrokeColor
(
right
.
color
)
..
setLineWidth
(
right
.
width
!
)
..
setLineWidth
(
right
.
width
)
..
drawLine
(
box
.
right
,
box
.
top
,
box
.
right
,
box
.
bottom
)
..
strokePath
();
BoxBorder
.
_
unsetStyle
(
context
,
right
.
style
);
BoxBorder
.
unsetStyle
(
context
,
right
.
style
);
}
if
(
bottom
.
style
!=
BorderStyle
.
none
)
{
BoxBorder
.
_
setStyle
(
context
,
bottom
.
style
);
BoxBorder
.
setStyle
(
context
,
bottom
.
style
);
context
.
canvas
..
setStrokeColor
(
bottom
.
color
)
..
setLineWidth
(
bottom
.
width
!
)
..
setLineWidth
(
bottom
.
width
)
..
drawLine
(
box
.
right
,
box
.
bottom
,
box
.
left
,
box
.
bottom
)
..
strokePath
();
BoxBorder
.
_
unsetStyle
(
context
,
bottom
.
style
);
BoxBorder
.
unsetStyle
(
context
,
bottom
.
style
);
}
if
(
left
.
style
!=
BorderStyle
.
none
)
{
BoxBorder
.
_
setStyle
(
context
,
left
.
style
);
BoxBorder
.
setStyle
(
context
,
left
.
style
);
context
.
canvas
..
setStrokeColor
(
left
.
color
)
..
setLineWidth
(
left
.
width
!
)
..
setLineWidth
(
left
.
width
)
..
drawLine
(
box
.
left
,
box
.
top
,
box
.
left
,
box
.
bottom
)
..
strokePath
();
BoxBorder
.
_
unsetStyle
(
context
,
left
.
style
);
BoxBorder
.
unsetStyle
(
context
,
left
.
style
);
}
}
}
...
...
pdf/lib/src/widgets/grid_paper.dart
View file @
e76cf66
...
...
@@ -271,36 +271,44 @@ class GridPaper extends SingleChildWidget {
}
if
(
border
.
left
.
style
!=
BorderStyle
.
none
)
{
BoxBorder
.
setStyle
(
context
,
border
.
left
.
style
);
context
.
canvas
..
setStrokeColor
(
border
.
left
.
color
)
..
setLineWidth
(
border
.
left
.
width
!
)
..
setLineWidth
(
border
.
left
.
width
)
..
drawLine
(
box
!.
left
+
margin
.
left
,
box
!.
top
,
box
!.
left
+
margin
.
left
,
box
!.
bottom
)
..
strokePath
();
BoxBorder
.
unsetStyle
(
context
,
border
.
left
.
style
);
}
if
(
border
.
right
.
style
!=
BorderStyle
.
none
)
{
BoxBorder
.
setStyle
(
context
,
border
.
right
.
style
);
context
.
canvas
..
setStrokeColor
(
border
.
right
.
color
)
..
setLineWidth
(
border
.
right
.
width
!
)
..
setLineWidth
(
border
.
right
.
width
)
..
drawLine
(
box
!.
right
-
margin
.
right
,
box
!.
top
,
box
!.
right
-
margin
.
right
,
box
!.
bottom
)
..
strokePath
();
BoxBorder
.
unsetStyle
(
context
,
border
.
right
.
style
);
}
if
(
border
.
top
.
style
!=
BorderStyle
.
none
)
{
BoxBorder
.
setStyle
(
context
,
border
.
top
.
style
);
context
.
canvas
..
setStrokeColor
(
border
.
top
.
color
)
..
setLineWidth
(
border
.
top
.
width
!
)
..
setLineWidth
(
border
.
top
.
width
)
..
drawLine
(
box
!.
left
,
box
!.
top
-
margin
.
top
,
box
!.
right
,
box
!.
top
-
margin
.
top
)
..
strokePath
();
BoxBorder
.
unsetStyle
(
context
,
border
.
top
.
style
);
}
if
(
border
.
bottom
.
style
!=
BorderStyle
.
none
)
{
BoxBorder
.
setStyle
(
context
,
border
.
bottom
.
style
);
context
.
canvas
..
setStrokeColor
(
border
.
bottom
.
color
)
..
setLineWidth
(
border
.
bottom
.
width
!
)
..
setLineWidth
(
border
.
bottom
.
width
)
..
drawLine
(
box
!.
left
,
box
!.
bottom
+
margin
.
bottom
,
box
!.
right
,
box
!.
bottom
+
margin
.
bottom
)
..
strokePath
();
BoxBorder
.
unsetStyle
(
context
,
border
.
bottom
.
style
);
}
context
.
canvas
.
restoreContext
();
...
...
pdf/lib/src/widgets/table.dart
View file @
e76cf66
...
...
@@ -106,23 +106,32 @@ class TableBorder extends Border {
super
.
paint
(
context
,
box
);
if
(
verticalInside
.
style
!=
BorderStyle
.
none
)
{
BoxBorder
.
setStyle
(
context
,
verticalInside
.
style
);
var
offset
=
box
.
x
;
for
(
var
width
in
widths
!.
sublist
(
0
,
widths
.
length
-
1
))
{
offset
+=
width
!;
context
.
canvas
.
moveTo
(
offset
,
box
.
y
);
context
.
canvas
.
lineTo
(
offset
,
box
.
top
);
}
context
.
canvas
.
setStrokeColor
(
verticalInside
.
color
);
context
.
canvas
.
setLineWidth
(
verticalInside
.
width
);
context
.
canvas
.
strokePath
();
BoxBorder
.
unsetStyle
(
context
,
verticalInside
.
style
);
}
if
(
horizontalInside
.
style
!=
BorderStyle
.
none
)
{
BoxBorder
.
setStyle
(
context
,
verticalInside
.
style
);
var
offset
=
box
.
top
;
for
(
var
height
in
heights
!.
sublist
(
0
,
heights
.
length
-
1
))
{
offset
-=
height
;
context
.
canvas
.
moveTo
(
box
.
x
,
offset
);
context
.
canvas
.
lineTo
(
box
.
right
,
offset
);
}
context
.
canvas
.
setStrokeColor
(
verticalInside
.
color
);
context
.
canvas
.
setLineWidth
(
verticalInside
.
width
);
context
.
canvas
.
strokePath
();
BoxBorder
.
unsetStyle
(
context
,
verticalInside
.
style
);
}
}
}
...
...
pdf/pubspec.yaml
View file @
e76cf66
...
...
@@ -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
:
3.0.0-nullsafety.
0
version
:
3.0.0-nullsafety.
1
environment
:
sdk
:
"
>=2.12.0-0
<3.0.0"
...
...
Please
register
or
login
to post a comment