David PHAM-VAN

Widget.paint() must call super

... ... @@ -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);
... ...
... ... @@ -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;
... ...
... ... @@ -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);
... ...
... ... @@ -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 {
... ...
... ... @@ -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.
... ...
... ... @@ -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);
... ...