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 != null || _svgParser.width != null
      ? constraints.constrainWidth(width ?? _svgParser.width!)
      : constraints.hasBoundedWidth
          ? constraints.maxWidth
          : constraints.constrainWidth(_svgParser.viewBox.width);
  final h = height != null || _svgParser.height != null
      ? constraints.constrainHeight(height ?? _svgParser.height!)
      : constraints.hasBoundedHeight
          ? constraints.maxHeight
          : constraints.constrainHeight(_svgParser.viewBox.height);

  sizes = applyBoxFit(fit, _svgParser.viewBox.size, PdfPoint(w, h));
  box = PdfRect.fromPoints(PdfPoint.zero, sizes.destination!);
}