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
2019-07-20 12:48:34 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4d109af5a7d6558850c40fe32ef7a46b7e04c2c1
4d109af5
1 parent
4e4e872a
Add better debugPaint on Align Widget
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
93 additions
and
2 deletions
pdf/CHANGELOG.md
pdf/lib/src/rect.dart
pdf/lib/widgets/basic.dart
pdf/pubspec.yaml
pdf/test/widget_basic_test.dart
pdf/CHANGELOG.md
View file @
4d109af
# Changelog
## 1.3.16
*
Add better debugPaint on Align Widget
## 1.3.15
*
Fix Image shape inside BoxDecoration
...
...
pdf/lib/src/rect.dart
View file @
4d109af
...
...
@@ -38,6 +38,9 @@ class PdfRect {
double
get
right
=>
x
+
width
;
double
get
top
=>
y
+
height
;
double
get
horizondalCenter
=>
x
+
width
/
2
;
double
get
verticalCenter
=>
y
+
height
/
2
;
@deprecated
double
get
l
=>
left
;
@deprecated
...
...
pdf/lib/widgets/basic.dart
View file @
4d109af
...
...
@@ -257,6 +257,82 @@ class Align extends SingleChildWidget {
}
@override
void
debugPaint
(
Context
context
)
{
context
.
canvas
..
setStrokeColor
(
PdfColors
.
green
)
..
drawRect
(
box
.
x
,
box
.
y
,
box
.
width
,
box
.
height
);
if
(
child
==
null
)
{
context
.
canvas
.
strokePath
();
return
;
}
if
(
child
.
box
.
bottom
>
box
.
bottom
)
{
final
double
headSize
=
math
.
min
((
child
.
box
.
bottom
-
box
.
bottom
)
*
0.2
,
10
);
context
.
canvas
..
moveTo
(
box
.
left
+
child
.
box
.
horizondalCenter
,
box
.
bottom
,
)
..
lineTo
(
box
.
left
+
child
.
box
.
horizondalCenter
,
box
.
bottom
+
child
.
box
.
bottom
)
..
lineTo
(
box
.
left
+
child
.
box
.
horizondalCenter
-
headSize
,
box
.
bottom
+
child
.
box
.
bottom
-
headSize
)
..
moveTo
(
box
.
left
+
child
.
box
.
horizondalCenter
,
box
.
bottom
+
child
.
box
.
bottom
)
..
lineTo
(
box
.
left
+
child
.
box
.
horizondalCenter
+
headSize
,
box
.
bottom
+
child
.
box
.
bottom
-
headSize
);
}
if
(
box
.
bottom
+
child
.
box
.
top
<
box
.
top
)
{
final
double
headSize
=
math
.
min
((
box
.
top
-
child
.
box
.
top
-
box
.
bottom
)
*
0.2
,
10
);
context
.
canvas
..
moveTo
(
box
.
left
+
child
.
box
.
horizondalCenter
,
box
.
top
)
..
lineTo
(
box
.
left
+
child
.
box
.
horizondalCenter
,
box
.
bottom
+
child
.
box
.
top
)
..
lineTo
(
box
.
left
+
child
.
box
.
horizondalCenter
-
headSize
,
box
.
bottom
+
child
.
box
.
top
+
headSize
)
..
moveTo
(
box
.
left
+
child
.
box
.
horizondalCenter
,
box
.
bottom
+
child
.
box
.
top
)
..
lineTo
(
box
.
left
+
child
.
box
.
horizondalCenter
+
headSize
,
box
.
bottom
+
child
.
box
.
top
+
headSize
);
}
if
(
child
.
box
.
left
>
box
.
left
)
{
final
double
headSize
=
math
.
min
((
child
.
box
.
left
-
box
.
left
)
*
0.2
,
10
);
context
.
canvas
..
moveTo
(
box
.
left
,
box
.
bottom
+
child
.
box
.
verticalCenter
)
..
lineTo
(
box
.
left
+
child
.
box
.
left
,
box
.
bottom
+
child
.
box
.
verticalCenter
)
..
lineTo
(
box
.
left
+
child
.
box
.
left
-
headSize
,
box
.
bottom
+
child
.
box
.
verticalCenter
-
headSize
)
..
moveTo
(
box
.
left
+
child
.
box
.
left
,
box
.
bottom
+
child
.
box
.
verticalCenter
)
..
lineTo
(
box
.
left
+
child
.
box
.
left
-
headSize
,
box
.
bottom
+
child
.
box
.
verticalCenter
+
headSize
);
}
if
(
box
.
left
+
child
.
box
.
right
<
box
.
right
)
{
final
double
headSize
=
math
.
min
((
box
.
right
-
child
.
box
.
right
-
box
.
left
)
*
0.2
,
10
);
context
.
canvas
..
moveTo
(
box
.
right
,
box
.
bottom
+
child
.
box
.
verticalCenter
)
..
lineTo
(
box
.
left
+
child
.
box
.
right
,
box
.
bottom
+
child
.
box
.
verticalCenter
)
..
lineTo
(
box
.
left
+
child
.
box
.
right
+
headSize
,
box
.
bottom
+
child
.
box
.
verticalCenter
-
headSize
)
..
moveTo
(
box
.
left
+
child
.
box
.
right
,
box
.
bottom
+
child
.
box
.
verticalCenter
)
..
lineTo
(
box
.
left
+
child
.
box
.
right
+
headSize
,
box
.
bottom
+
child
.
box
.
verticalCenter
+
headSize
);
}
context
.
canvas
.
strokePath
();
}
@override
void
paint
(
Context
context
)
{
super
.
paint
(
context
);
paintChild
(
context
);
...
...
pdf/pubspec.yaml
View file @
4d109af
...
...
@@ -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.1
5
version
:
1.3.1
6
environment
:
sdk
:
"
>=2.1.0
<3.0.0"
...
...
pdf/test/widget_basic_test.dart
View file @
4d109af
...
...
@@ -28,7 +28,7 @@ void main() {
pdf
=
Document
();
});
test
(
'Basic Widgets Align'
,
()
{
test
(
'Basic Widgets Align
1
'
,
()
{
pdf
.
addPage
(
Page
(
build:
(
Context
context
)
=>
Align
(
alignment:
Alignment
.
bottomRight
,
...
...
@@ -36,6 +36,14 @@ void main() {
)));
});
test
(
'Basic Widgets Align 2'
,
()
{
pdf
.
addPage
(
Page
(
build:
(
Context
context
)
=>
Align
(
alignment:
const
Alignment
(
0.8
,
0.2
),
child:
SizedBox
(
width:
100
,
height:
100
,
child:
PdfLogo
()),
)));
});
test
(
'Basic Widgets AspectRatio'
,
()
{
pdf
.
addPage
(
Page
(
build:
(
Context
context
)
=>
AspectRatio
(
...
...
Please
register
or
login
to post a comment