layout method

  1. @override
void layout(
  1. Context context,
  2. BoxConstraints constraints, {
  3. bool parentUsesSize = false,
})
override

First widget pass to calculate the children layout and bounding box

Implementation

@override
void layout(Context context, BoxConstraints constraints,
    {bool parentUsesSize = false}) {
  final w = width ??
      (constraints.hasBoundedWidth
          ? constraints.maxWidth
          : constraints.constrainWidth(image.width!.toDouble()));
  final h = height ??
      (constraints.hasBoundedHeight
          ? constraints.maxHeight
          : constraints.constrainHeight(image.height!.toDouble()));

  final sizes = applyBoxFit(
      fit,
      PdfPoint(image.width!.toDouble(), image.height!.toDouble()),
      PdfPoint(w, h));
  box = PdfRect.fromPoints(PdfPoint.zero, sizes.destination!);
}