pageOverlaysBuilder property

PdfPageOverlaysBuilder? pageOverlaysBuilder
final

Add overlays to each page.

This function is used to decorate each page with overlay widgets.

The return value of the function is a list of widgets to be laid out on the page; they are actually laid out on the page using Stack.

There are many actual overlays on the page; the page overlays are;

  • Page image
  • Selectable page text
  • Links (if linkWidgetBuilder is not null; otherwise links are handled by another logic)
  • Overlay widgets returned by this function

The most typical use case is to add page number footer to each page.

The following fragment illustrates how to add page number footer to each page:

pageOverlaysBuilder: (context, pageRect, page) {
  return [
    Align(
      alignment: Alignment.bottomCenter,
      child: Text(
        page.pageNumber.toString(),
        style: const TextStyle(color: Colors.red),
      ),
    ),
  ];
},

Implementation

final PdfPageOverlaysBuilder? pageOverlaysBuilder;