build method Null safety

  1. @override
PdfAnnot build(
  1. Context context,
  2. PdfRect? box
)
override

Implementation

@override
PdfAnnot build(Context context, PdfRect? box) {
  final globalPoints =
      points.map((e) => context.localToGlobalPoint(e)).toList();

  final rect = context.localToGlobal(PdfRect(
      points.map((point) => point.x).reduce(min),
      points.map((point) => point.y).reduce(min),
      points.map((point) => point.x).reduce(max) -
          points.map((point) => point.x).reduce(min),
      points.map((point) => point.y).reduce(max) -
          points.map((point) => point.y).reduce(min)));

  final pdfAnnotPolygon = PdfAnnotPolygon(
    context.document,
    globalPoints,
    rect: rect,
    border: border,
    color: color,
    interiorColor: interiorColor,
    date: date,
    author: author,
    subject: subject,
  );

  return PdfAnnot(context.page, pdfAnnotPolygon);
}