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
2022-03-20 08:17:28 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
673a513b8e0a00fa04dc28fdc613df1632aedc2d
673a513b
1 parent
f88573b2
Add OverflowBox
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
1 deletions
pdf/CHANGELOG.md
pdf/lib/src/widgets/basic.dart
pdf/CHANGELOG.md
View file @
673a513
...
...
@@ -6,6 +6,7 @@
-
Fix missing smask subtype
-
Add missing final "~>" to Ascii85 encoder
-
Fix typo "horizontalCenter"
-
Add OverflowBox
## 3.7.2
...
...
pdf/lib/src/widgets/basic.dart
View file @
673a513
...
...
@@ -135,6 +135,7 @@ class Transform extends SingleChildWidget {
this
.
origin
,
this
.
alignment
,
this
.
adjustLayout
=
false
,
this
.
unconstrained
=
false
,
Widget
?
child
,
})
:
super
(
child:
child
);
...
...
@@ -147,6 +148,7 @@ class Transform extends SingleChildWidget {
Widget
?
child
,
})
:
transform
=
Matrix4
.
rotationZ
(
angle
),
adjustLayout
=
false
,
unconstrained
=
false
,
super
(
child:
child
);
/// Creates a widget that transforms its child using a rotation around the
...
...
@@ -154,6 +156,7 @@ class Transform extends SingleChildWidget {
Transform
.
rotateBox
({
required
double
angle
,
Widget
?
child
,
this
.
unconstrained
=
false
,
})
:
transform
=
Matrix4
.
rotationZ
(
angle
),
adjustLayout
=
true
,
alignment
=
null
,
...
...
@@ -168,6 +171,7 @@ class Transform extends SingleChildWidget {
origin
=
null
,
alignment
=
null
,
adjustLayout
=
false
,
unconstrained
=
false
,
super
(
child:
child
);
/// Creates a widget that scales its child uniformly.
...
...
@@ -178,6 +182,7 @@ class Transform extends SingleChildWidget {
Widget
?
child
,
})
:
transform
=
Matrix4
.
diagonal3Values
(
scale
,
scale
,
1
),
adjustLayout
=
false
,
unconstrained
=
false
,
super
(
child:
child
);
/// The matrix to transform the child by during painting.
...
...
@@ -191,6 +196,8 @@ class Transform extends SingleChildWidget {
final
bool
adjustLayout
;
final
bool
unconstrained
;
Matrix4
get
_effectiveTransform
{
final
result
=
Matrix4
.
identity
();
if
(
origin
!=
null
)
{
...
...
@@ -220,7 +227,11 @@ class Transform extends SingleChildWidget {
}
if
(
child
!=
null
)
{
child
!.
layout
(
context
,
constraints
,
parentUsesSize:
parentUsesSize
);
child
!.
layout
(
context
,
unconstrained
?
const
BoxConstraints
()
:
constraints
,
parentUsesSize:
parentUsesSize
,
);
assert
(
child
!.
box
!=
null
);
final
mat
=
transform
;
...
...
@@ -910,3 +921,62 @@ class VerticalDivider extends StatelessWidget {
);
}
}
class
OverflowBox
extends
SingleChildWidget
{
/// Creates a widget that lets its child overflow itself.
OverflowBox
({
this
.
alignment
=
Alignment
.
center
,
this
.
minWidth
,
this
.
maxWidth
,
this
.
minHeight
,
this
.
maxHeight
,
Widget
?
child
,
})
:
super
(
child:
child
);
/// How to align the child.
final
Alignment
alignment
;
/// The minimum width constraint to give the child. Set this to null (the
/// default) to use the constraint from the parent instead.
final
double
?
minWidth
;
/// The maximum width constraint to give the child. Set this to null (the
/// default) to use the constraint from the parent instead.
final
double
?
maxWidth
;
/// The minimum height constraint to give the child. Set this to null (the
/// default) to use the constraint from the parent instead.
final
double
?
minHeight
;
/// The maximum height constraint to give the child. Set this to null (the
/// default) to use the constraint from the parent instead.
final
double
?
maxHeight
;
BoxConstraints
_getInnerConstraints
(
BoxConstraints
constraints
)
{
return
BoxConstraints
(
minWidth:
minWidth
??
constraints
.
minWidth
,
maxWidth:
maxWidth
??
constraints
.
maxWidth
,
minHeight:
minHeight
??
constraints
.
minHeight
,
maxHeight:
maxHeight
??
constraints
.
maxHeight
,
);
}
@override
void
layout
(
Context
context
,
BoxConstraints
constraints
,
{
bool
parentUsesSize
=
false
})
{
box
=
PdfRect
.
fromPoints
(
PdfPoint
.
zero
,
constraints
.
smallest
);
if
(
child
!=
null
)
{
child
!.
layout
(
context
,
_getInnerConstraints
(
constraints
),
parentUsesSize:
true
);
assert
(
child
!.
box
!=
null
);
child
!.
box
=
alignment
.
inscribe
(
child
!.
box
!.
size
,
box
!);
}
}
@override
void
paint
(
Context
context
)
{
super
.
paint
(
context
);
paintChild
(
context
);
}
}
...
...
Please
register
or
login
to post a comment