calculateMetrics abstract method

PdfViewerLayoutMetrics calculateMetrics({
  1. required Size viewSize,
  2. required PdfPageLayout? layout,
  3. required int? pageNumber,
  4. required double pageMargin,
  5. required EdgeInsets? boundaryMargin,
})

Calculates the layout metrics (min/max scales) for the given environment.

This is called synchronously by the State whenever layout or view size changes to configure the InteractiveViewer constraints.

⚠️ Important: This method is often called before init. Do not access the PdfViewerController inside this method. Use only the provided arguments to perform the calculation.

viewSize: The current size of the widget. layout: The current PDF layout (may be null during first build). pageNumber: The page currently being viewed (used to calculate "fit page" logic). pageMargin: The margin configuration from parameters. boundaryMargin: The boundary margin configuration from parameters.

Implementation

PdfViewerLayoutMetrics calculateMetrics({
  required Size viewSize,
  required PdfPageLayout? layout,
  required int? pageNumber, // Pivot page for calculation
  required double pageMargin,
  required EdgeInsets? boundaryMargin,
});