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-03-02 13:36:58 -0500
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
913195c4b97e73e9b32e904e54dabf6afb3f4ace
913195c4
1 parent
e141a391
Widget.paint() must call super
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
49 additions
and
41 deletions
pdf/lib/widgets/basic.dart
pdf/lib/widgets/clip.dart
pdf/lib/widgets/container.dart
pdf/lib/widgets/flex.dart
pdf/lib/widgets/stack.dart
pdf/lib/widgets/widget.dart
pdf/lib/widgets/basic.dart
View file @
913195c
...
...
@@ -57,6 +57,12 @@ class LimitedBox extends SingleChildWidget {
}
box
=
PdfRect
.
fromPoints
(
PdfPoint
.
zero
,
size
);
}
@override
void
paint
(
Context
context
)
{
super
.
paint
(
context
);
paintChild
(
context
);
}
}
class
Padding
extends
SingleChildWidget
{
...
...
@@ -101,12 +107,7 @@ class Padding extends SingleChildWidget {
@override
void
paint
(
Context
context
)
{
assert
(()
{
if
(
Document
.
debug
)
{
debugPaint
(
context
);
}
return
true
;
}());
super
.
paint
(
context
);
if
(
child
!=
null
)
{
final
Matrix4
mat
=
Matrix4
.
identity
();
...
...
@@ -191,12 +192,7 @@ class Transform extends SingleChildWidget {
@override
void
paint
(
Context
context
)
{
assert
(()
{
if
(
Document
.
debug
)
{
debugPaint
(
context
);
}
return
true
;
}());
super
.
paint
(
context
);
if
(
child
!=
null
)
{
final
Matrix4
mat
=
_effectiveTransform
;
...
...
@@ -258,6 +254,12 @@ class Align extends SingleChildWidget {
height:
shrinkWrapHeight
?
0.0
:
double
.
infinity
);
}
}
@override
void
paint
(
Context
context
)
{
super
.
paint
(
context
);
paintChild
(
context
);
}
}
/// A widget that imposes additional constraints on its child.
...
...
@@ -282,6 +284,12 @@ class ConstrainedBox extends SingleChildWidget {
this
.
constraints
.
enforce
(
constraints
).
constrain
(
PdfPoint
.
zero
));
}
}
@override
void
paint
(
Context
context
)
{
super
.
paint
(
context
);
paintChild
(
context
);
}
}
class
Center
extends
Align
{
...
...
@@ -323,6 +331,8 @@ class FittedBox extends SingleChildWidget {
@override
void
paint
(
Context
context
)
{
super
.
paint
(
context
);
if
(
child
!=
null
)
{
final
PdfPoint
childSize
=
child
.
box
.
size
;
final
FittedSizes
sizes
=
applyBoxFit
(
fit
,
childSize
,
box
.
size
);
...
...
@@ -404,6 +414,12 @@ class AspectRatio extends SingleChildWidget {
BoxConstraints
.
tightFor
(
width:
box
.
width
,
height:
box
.
height
));
assert
(
child
.
box
!=
null
);
}
@override
void
paint
(
Context
context
)
{
super
.
paint
(
context
);
paintChild
(
context
);
}
}
typedef
CustomPainter
=
Function
(
PdfGraphics
canvas
,
PdfPoint
size
);
...
...
@@ -435,12 +451,7 @@ class CustomPaint extends SingleChildWidget {
@override
void
paint
(
Context
context
)
{
assert
(()
{
if
(
Document
.
debug
)
{
debugPaint
(
context
);
}
return
true
;
}());
super
.
paint
(
context
);
final
Matrix4
mat
=
Matrix4
.
identity
();
mat
.
translate
(
box
.
x
,
box
.
y
);
...
...
pdf/lib/widgets/clip.dart
View file @
913195c
...
...
@@ -29,12 +29,7 @@ class ClipRect extends SingleChildWidget {
@override
void
paint
(
Context
context
)
{
assert
(()
{
if
(
Document
.
debug
)
{
debugPaint
(
context
);
}
return
true
;
}());
super
.
paint
(
context
);
if
(
child
!=
null
)
{
final
Matrix4
mat
=
Matrix4
.
identity
();
...
...
@@ -71,12 +66,7 @@ class ClipRRect extends SingleChildWidget {
@override
void
paint
(
Context
context
)
{
assert
(()
{
if
(
Document
.
debug
)
{
debugPaint
(
context
);
}
return
true
;
}());
super
.
paint
(
context
);
if
(
child
!=
null
)
{
final
Matrix4
mat
=
Matrix4
.
identity
();
...
...
@@ -109,12 +99,7 @@ class ClipOval extends SingleChildWidget {
@override
void
paint
(
Context
context
)
{
assert
(()
{
if
(
Document
.
debug
)
{
debugPaint
(
context
);
}
return
true
;
}());
super
.
paint
(
context
);
final
double
rx
=
box
.
width
/
2.0
;
final
double
ry
=
box
.
height
/
2.0
;
...
...
pdf/lib/widgets/container.dart
View file @
913195c
...
...
@@ -147,11 +147,12 @@ class DecoratedBox extends SingleChildWidget {
@override
void
paint
(
Context
context
)
{
super
.
paint
(
context
);
if
(
position
==
DecorationPosition
.
background
)
{
decoration
.
paintBackground
(
context
,
box
);
decoration
.
border
?.
paintBorders
(
context
,
box
);
}
super
.
paint
(
context
);
paintChild
(
context
);
if
(
position
==
DecorationPosition
.
foreground
)
{
decoration
.
paintBackground
(
context
,
box
);
decoration
.
border
?.
paintBorders
(
context
,
box
);
...
...
pdf/lib/widgets/flex.dart
View file @
913195c
...
...
@@ -506,6 +506,12 @@ class Expanded extends SingleChildWidget {
final
int
flex
;
final
FlexFit
fit
;
@override
void
paint
(
Context
context
)
{
super
.
paint
(
context
);
paintChild
(
context
);
}
}
class
ListView
extends
Flex
{
...
...
pdf/lib/widgets/stack.dart
View file @
913195c
...
...
@@ -44,6 +44,12 @@ class Positioned extends SingleChildWidget {
double
get
width
=>
box
?.
width
;
double
get
height
=>
box
?.
height
;
@override
void
paint
(
Context
context
)
{
super
.
paint
(
context
);
paintChild
(
context
);
}
}
/// A widget that positions its children relative to the edges of its box.
...
...
pdf/lib/widgets/widget.dart
View file @
913195c
...
...
@@ -74,6 +74,7 @@ abstract class Widget {
/// Draw itself and its children, according to the calculated
/// [box.offset]
@protected
@mustCallSuper
void
paint
(
Context
context
)
{
assert
(()
{
if
(
Document
.
debug
)
{
...
...
@@ -147,10 +148,8 @@ abstract class SingleChildWidget extends Widget {
}
}
@override
void
paint
(
Context
context
)
{
super
.
paint
(
context
);
@protected
void
paintChild
(
Context
context
)
{
if
(
child
!=
null
)
{
final
Matrix4
mat
=
Matrix4
.
identity
();
mat
.
translate
(
box
.
x
,
box
.
y
);
...
...
Please
register
or
login
to post a comment