David PHAM-VAN

Fix lint warnings

... ... @@ -133,9 +133,9 @@ class PdfAnnot extends PdfObject {
} else {
final List<PdfStream> dests = <PdfStream>[];
dests.add(dest.ref());
if (destRect == null)
if (destRect == null) {
dests.add(PdfStream.string('/Fit'));
else {
} else {
dests.add(PdfStream.string('/FitR '));
dests.add(PdfStream()
..putNumList(<double>[
... ...
... ... @@ -108,8 +108,9 @@ class PdfOutput {
os.putString('/Root ');
os.putStream(rootID.ref());
os.putString('\n');
} else
} else {
throw Exception('Root object is not present in document');
}
// the /Info reference (OPTIONAL)
if (infoID != null) {
... ...
... ... @@ -410,9 +410,10 @@ class AspectRatio extends SingleChildWidget {
void layout(Context context, BoxConstraints constraints,
{bool parentUsesSize = false}) {
box = PdfRect.fromPoints(PdfPoint.zero, _applyAspectRatio(constraints));
if (child != null)
if (child != null) {
child.layout(context,
BoxConstraints.tightFor(width: box.width, height: box.height));
}
assert(child.box != null);
}
... ...
... ... @@ -77,9 +77,10 @@ class BoxBorder {
context.canvas.lineTo(box.x, box.top);
} else if (right && top) {
context.canvas.closePath();
} else
} else {
context.canvas.lineTo(box.x, box.top);
}
}
context.canvas.strokePath();
}
... ... @@ -151,12 +152,12 @@ class BoxDecoration {
if (color != null) {
switch (shape) {
case BoxShape.rectangle:
if (borderRadius == null)
if (borderRadius == null) {
context.canvas.drawRect(box.x, box.y, box.width, box.height);
else
} else {
context.canvas.drawRRect(box.x, box.y, box.width, box.height,
borderRadius, borderRadius);
}
break;
case BoxShape.circle:
context.canvas.drawEllipse(box.x + box.width / 2.0,
... ... @@ -259,15 +260,17 @@ class Container extends StatelessWidget {
child: ConstrainedBox(constraints: const BoxConstraints.expand()));
}
if (alignment != null)
if (alignment != null) {
current = Align(alignment: alignment, child: current);
}
if (padding != null) {
current = Padding(padding: padding, child: current);
}
if (decoration != null)
if (decoration != null) {
current = DecoratedBox(decoration: decoration, child: current);
}
if (foregroundDecoration != null) {
current = DecoratedBox(
... ... @@ -276,15 +279,17 @@ class Container extends StatelessWidget {
child: current);
}
if (constraints != null)
if (constraints != null) {
current = ConstrainedBox(constraints: constraints, child: current);
}
if (margin != null) {
current = Padding(padding: margin, child: current);
}
if (transform != null)
if (transform != null) {
current = Transform(transform: transform, child: current);
}
return current;
}
... ...
... ... @@ -144,10 +144,11 @@ class Flex extends MultiChildWidget {
// Size remaining (flexible) items, find the maximum cross size.
for (Widget child in children) {
final int flex = child is Expanded ? child.flex : 0;
if (flex > 0)
if (flex > 0) {
maxCrossSize =
math.max(maxCrossSize, childSize(child, spacePerFlex * flex));
}
}
return maxCrossSize;
}
... ...
... ... @@ -359,8 +359,9 @@ FittedSizes applyBoxFit(BoxFit fit, PdfPoint inputSize, PdfPoint outputSize) {
if (inputSize.y <= 0.0 ||
inputSize.x <= 0.0 ||
outputSize.y <= 0.0 ||
outputSize.x <= 0.0)
outputSize.x <= 0.0) {
return const FittedSizes(PdfPoint.zero, PdfPoint.zero);
}
PdfPoint sourceSize, destinationSize;
switch (fit) {
... ... @@ -370,12 +371,13 @@ FittedSizes applyBoxFit(BoxFit fit, PdfPoint inputSize, PdfPoint outputSize) {
break;
case BoxFit.contain:
sourceSize = inputSize;
if (outputSize.x / outputSize.y > sourceSize.x / sourceSize.y)
if (outputSize.x / outputSize.y > sourceSize.x / sourceSize.y) {
destinationSize =
PdfPoint(sourceSize.x * outputSize.y / sourceSize.y, outputSize.y);
else
} else {
destinationSize =
PdfPoint(outputSize.x, sourceSize.y * outputSize.x / sourceSize.x);
}
break;
case BoxFit.cover:
if (outputSize.x / outputSize.y > inputSize.x / inputSize.y) {
... ... @@ -408,10 +410,12 @@ FittedSizes applyBoxFit(BoxFit fit, PdfPoint inputSize, PdfPoint outputSize) {
sourceSize = inputSize;
destinationSize = inputSize;
final double aspectRatio = inputSize.x / inputSize.y;
if (destinationSize.y > outputSize.y)
if (destinationSize.y > outputSize.y) {
destinationSize = PdfPoint(outputSize.y * aspectRatio, outputSize.y);
if (destinationSize.x > outputSize.x)
}
if (destinationSize.x > outputSize.x) {
destinationSize = PdfPoint(outputSize.x, outputSize.x / aspectRatio);
}
break;
}
return FittedSizes(sourceSize, destinationSize);
... ...
... ... @@ -130,18 +130,20 @@ class Stack extends MultiChildWidget {
final Positioned positioned = child;
BoxConstraints childConstraints = const BoxConstraints();
if (positioned.left != null && positioned.right != null)
if (positioned.left != null && positioned.right != null) {
childConstraints = childConstraints.tighten(
width: box.width - positioned.right - positioned.left);
else if (positioned.width != null)
} else if (positioned.width != null) {
childConstraints = childConstraints.tighten(width: positioned.width);
}
if (positioned.top != null && positioned.bottom != null)
if (positioned.top != null && positioned.bottom != null) {
childConstraints = childConstraints.tighten(
height: box.height - positioned.bottom - positioned.top);
else if (positioned.height != null)
} else if (positioned.height != null) {
childConstraints =
childConstraints.tighten(height: positioned.height);
}
positioned.layout(context, childConstraints, parentUsesSize: true);
assert(positioned.box != null);
... ...