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-09-07 20:07:08 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
31f681a5c82269c8ecac5fffe3846a59ac311c6c
31f681a5
1 parent
b617d920
Fix Transform.adjustLayout
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
23 deletions
pdf/CHANGELOG.md
pdf/lib/widgets/basic.dart
pdf/pubspec.yaml
pdf/test/widget_test.dart
pdf/CHANGELOG.md
View file @
31f681a
# Changelog
## 1.3.20
-
Fix Transform.rotateBox
## 1.3.19
-
Fix Ascii85 encoding
...
...
pdf/lib/widgets/basic.dart
View file @
31f681a
...
...
@@ -126,9 +126,9 @@ class Transform extends SingleChildWidget {
@required
this
.
transform
,
this
.
origin
,
this
.
alignment
,
this
.
adjustLayout
=
false
,
Widget
child
,
})
:
assert
(
transform
!=
null
),
_relayout
=
false
,
super
(
child:
child
);
/// Creates a widget that transforms its child using a rotation around the
...
...
@@ -139,7 +139,7 @@ class Transform extends SingleChildWidget {
this
.
alignment
=
Alignment
.
center
,
Widget
child
,
})
:
transform
=
Matrix4
.
rotationZ
(
angle
),
_rel
ayout
=
false
,
adjustL
ayout
=
false
,
super
(
child:
child
);
/// Creates a widget that transforms its child using a rotation around the
...
...
@@ -148,7 +148,7 @@ class Transform extends SingleChildWidget {
@required
double
angle
,
Widget
child
,
})
:
transform
=
Matrix4
.
rotationZ
(
angle
),
_rel
ayout
=
true
,
adjustL
ayout
=
true
,
alignment
=
null
,
origin
=
null
,
super
(
child:
child
);
...
...
@@ -160,7 +160,7 @@ class Transform extends SingleChildWidget {
})
:
transform
=
Matrix4
.
translationValues
(
offset
.
x
,
offset
.
y
,
0
),
origin
=
null
,
alignment
=
null
,
_rel
ayout
=
false
,
adjustL
ayout
=
false
,
super
(
child:
child
);
/// Creates a widget that scales its child uniformly.
...
...
@@ -170,7 +170,7 @@ class Transform extends SingleChildWidget {
this
.
alignment
=
Alignment
.
center
,
Widget
child
,
})
:
transform
=
Matrix4
.
diagonal3Values
(
scale
,
scale
,
1
),
_rel
ayout
=
false
,
adjustL
ayout
=
false
,
super
(
child:
child
);
/// The matrix to transform the child by during painting.
...
...
@@ -182,7 +182,7 @@ class Transform extends SingleChildWidget {
/// The alignment of the origin, relative to the size of the box.
final
Alignment
alignment
;
final
bool
_rel
ayout
;
final
bool
adjustL
ayout
;
Matrix4
get
_effectiveTransform
{
final
Matrix4
result
=
Matrix4
.
identity
();
...
...
@@ -208,14 +208,13 @@ class Transform extends SingleChildWidget {
@override
void
layout
(
Context
context
,
BoxConstraints
constraints
,
{
bool
parentUsesSize
=
false
})
{
if
(!
_rel
ayout
)
{
if
(!
adjustL
ayout
)
{
return
super
.
layout
(
context
,
constraints
,
parentUsesSize:
parentUsesSize
);
}
if
(
child
!=
null
)
{
child
.
layout
(
context
,
constraints
,
parentUsesSize:
parentUsesSize
);
assert
(
child
.
box
!=
null
);
box
=
child
.
box
;
final
Matrix4
mat
=
transform
;
final
List
<
double
>
values
=
mat
.
applyToVector3Array
(<
double
>[
...
...
@@ -233,17 +232,23 @@ class Transform extends SingleChildWidget {
0
,
]);
final
double
dx
=
-
math
.
min
(
math
.
min
(
math
.
min
(
values
[
0
],
values
[
3
]),
values
[
6
]),
values
[
9
]);
final
double
dy
=
-
math
.
min
(
math
.
min
(
math
.
min
(
values
[
1
],
values
[
4
]),
values
[
7
]),
values
[
10
]);
box
=
PdfRect
.
fromLTRB
(
math
.
min
(
math
.
min
(
math
.
min
(
values
[
0
],
values
[
3
]),
values
[
6
]),
values
[
9
]),
math
.
min
(
math
.
min
(
math
.
min
(
values
[
1
],
values
[
4
]),
values
[
7
]),
values
[
10
]),
math
.
max
(
math
.
max
(
math
.
max
(
values
[
0
],
values
[
3
]),
values
[
6
]),
values
[
9
]),
math
.
max
(
math
.
max
(
math
.
max
(
values
[
1
],
values
[
4
]),
values
[
7
]),
values
[
10
]),
0
,
0
,
math
.
max
(
math
.
max
(
math
.
max
(
values
[
0
],
values
[
3
]),
values
[
6
]),
values
[
9
])
+
dx
,
math
.
max
(
math
.
max
(
math
.
max
(
values
[
1
],
values
[
4
]),
values
[
7
]),
values
[
10
])
+
dy
,
);
transform
.
leftTranslate
(-
box
.
x
,
-
box
.
y
);
transform
.
leftTranslate
(
dx
,
dy
);
}
else
{
box
=
PdfRect
.
fromPoints
(
PdfPoint
.
zero
,
constraints
.
smallest
);
}
...
...
pdf/pubspec.yaml
View file @
31f681a
...
...
@@ -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.
19
version
:
1.3.
20
environment
:
sdk
:
"
>=2.1.0
<3.0.0"
...
...
pdf/test/widget_test.dart
View file @
31f681a
...
...
@@ -80,11 +80,13 @@ void main() {
padding:
const
EdgeInsets
.
only
(
left:
30
,
top:
20
),
child:
Lorem
(
textAlign:
TextAlign
.
justify
)),
Expanded
(
child:
Transform
.
scale
(
child:
Transform
.
rotate
(
child:
FittedBox
(
child:
Text
(
'Expanded'
)),
angle:
0.2
),
scale:
0.9
)),
child:
FittedBox
(
child:
Transform
.
rotateBox
(
angle:
0.2
,
child:
Text
(
'Expanded'
),
),
),
),
Container
(
padding:
const
EdgeInsets
.
only
(
top:
5
),
decoration:
const
BoxDecoration
(
...
...
Please
register
or
login
to post a comment