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);
}