layout method

  1. @protected
PdfPoint layout(
  1. Widget child,
  2. Context context,
  3. BoxConstraints constraints, {
  4. bool parentUsesSize = false,
})

Implementation

@protected
PdfPoint layout(Widget child, Context context, BoxConstraints constraints,
    {bool parentUsesSize = false}) {
  final _margin = resolvedMargin!;
  child.layout(context, constraints, parentUsesSize: parentUsesSize);
  assert(child.box != null);

  final width = pageFormat.width == double.infinity
      ? child.box!.width + _margin.left + _margin.right
      : pageFormat.width;

  final height = pageFormat.height == double.infinity
      ? child.box!.height + _margin.top + _margin.bottom
      : pageFormat.height;

  child.box = PdfRect(_margin.left, height - child.box!.height - _margin.top,
      child.box!.width, child.box!.height);

  return PdfPoint(width, height);
}