calculateMetrics abstract method
PdfViewerLayoutMetrics
calculateMetrics({
- required Size viewSize,
- required PdfPageLayout? layout,
- required int? pageNumber,
- required double pageMargin,
- 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,
});