PdfViewerParams class

Viewer customization parameters.

Changes to several builder functions such as layoutPages does not take effect until the viewer is re-layout-ed. You can relayout the viewer by calling PdfViewerController.relayout.

Annotations

Constructors

PdfViewerParams({double margin = 8.0, Color backgroundColor = Colors.grey, PdfPageLayoutFunction? layoutPages, double maxScale = 8.0, double minScale = 0.1, bool useAlternativeFitScaleAsMinScale = true, PanAxis panAxis = PanAxis.free, EdgeInsets? boundaryMargin, PdfAnnotationRenderingMode annotationRenderingMode = PdfAnnotationRenderingMode.annotationAndForms, PdfPageAnchor pageAnchor = PdfPageAnchor.topCenter, PdfPageAnchor pageAnchorEnd = PdfPageAnchor.bottomCenter, double onePassRenderingScaleThreshold = 200 / 72, bool enableTextSelection = false, Color? matchTextColor, Color? activeMatchTextColor, BoxShadow? pageDropShadow = const BoxShadow(color: Colors.black54, blurRadius: 4, spreadRadius: 2, offset: Offset(2, 2)), bool panEnabled = true, bool scaleEnabled = true, GestureScaleEndCallback? onInteractionEnd, GestureScaleStartCallback? onInteractionStart, GestureScaleUpdateCallback? onInteractionUpdate, PdfViewerDocumentChangedCallback? onDocumentChanged, PdfViewerCalculateInitialPageNumberFunction? calculateInitialPageNumber, PdfViewerCalculateCurrentPageNumberFunction? calculateCurrentPageNumber, PdfViewerReadyCallback? onViewerReady, PdfPageChangedCallback? onPageChanged, PdfViewerGetPageRenderingScale? getPageRenderingScale, double? scrollByMouseWheel = 0.2, bool enableKeyboardNavigation = true, double scrollByArrowKey = 25.0, int maxImageBytesCachedOnMemory = 100 * 1024 * 1024, double horizontalCacheExtent = 1.0, double verticalCacheExtent = 1.0, PdfViewerOverlaysBuilder? viewerOverlayBuilder, PdfPageOverlaysBuilder? pageOverlaysBuilder, PdfViewerLoadingBannerBuilder? loadingBannerBuilder, PdfViewerErrorBannerBuilder? errorBannerBuilder, PdfLinkWidgetBuilder? linkWidgetBuilder, List<PdfViewerPagePaintCallback>? pagePaintCallbacks, List<PdfViewerPagePaintCallback>? pageBackgroundPaintCallbacks, PdfViewerTextSelectionChangeCallback? onTextSelectionChange, PerPageSelectionAreaInjector? perPageSelectionAreaInjector, bool forceReload = false})
const

Properties

activeMatchTextColor Color?
Color for active text search match.
final
annotationRenderingMode PdfAnnotationRenderingMode
Annotation rendering mode.
final
backgroundColor Color
Background color of the viewer.
final
boundaryMargin EdgeInsets?
See InteractiveViewer.boundaryMargin for details.
final
calculateCurrentPageNumber PdfViewerCalculateCurrentPageNumberFunction?
Function to guess the current page number based on the visible rectangle and page layouts.
final
calculateInitialPageNumber PdfViewerCalculateInitialPageNumberFunction?
Function to calculate the initial page number.
final
enableKeyboardNavigation bool
Enable keyboard navigation. The default is true.
final
enableTextSelection bool
Experimental: Enable text selection on pages.
final
errorBannerBuilder PdfViewerErrorBannerBuilder?
Build loading error banner.
final
forceReload bool
Force reload the viewer.
final
getPageRenderingScale PdfViewerGetPageRenderingScale?
Function to customize the rendering scale of the page.
final
hashCode int
The hash code for this object.
no setteroverride
horizontalCacheExtent double
The horizontal cache extent specified in ratio to the viewport width. The default is 1.0.
final
layoutPages PdfPageLayoutFunction?
Function to customize the layout of the pages.
final
linkWidgetBuilder PdfLinkWidgetBuilder?
Build link widget.
final
loadingBannerBuilder PdfViewerLoadingBannerBuilder?
Build loading banner.
final
margin double
Margin around the page.
final
matchTextColor Color?
Color for text search match.
final
maxImageBytesCachedOnMemory int
Restrict the total amount of image bytes to be cached on memory. The default is 100 MB.
final
maxScale double
The maximum allowed scale.
final
minScale double
The minimum allowed scale.
final
onDocumentChanged PdfViewerDocumentChangedCallback?
Function to notify that the document is loaded/changed.
final
onePassRenderingScaleThreshold double
If a page is rendered over the scale threshold, the page is rendered with the threshold scale and actual resolution image is rendered after some delay (progressive rendering).
final
onInteractionEnd GestureScaleEndCallback?
See InteractiveViewer.onInteractionEnd for details.
final
onInteractionStart GestureScaleStartCallback?
See InteractiveViewer.onInteractionStart for details.
final
onInteractionUpdate GestureScaleUpdateCallback?
See InteractiveViewer.onInteractionUpdate for details.
final
onPageChanged PdfPageChangedCallback?
Function called when the current page is changed.
final
onTextSelectionChange PdfViewerTextSelectionChangeCallback?
Function to be notified when the text selection is changed.
final
onViewerReady PdfViewerReadyCallback?
Function called when the viewer is ready.
final
pageAnchor PdfPageAnchor
Anchor to position the page.
final
pageAnchorEnd PdfPageAnchor
Anchor to position the page at the end of the page.
final
pageBackgroundPaintCallbacks List<PdfViewerPagePaintCallback>?
Callback to paint on the background of the rendered page (called before painting the page content).
final
pageDropShadow BoxShadow?
Drop shadow for the page.
final
pageOverlaysBuilder PdfPageOverlaysBuilder?
Add overlays to each page.
final
pagePaintCallbacks List<PdfViewerPagePaintCallback>?
Callback to paint over the rendered page.
final
panAxis PanAxis
See InteractiveViewer.panAxis for details.
final
panEnabled bool
See InteractiveViewer.panEnabled for details.
final
perPageSelectionAreaInjector PerPageSelectionAreaInjector?
Function to inject customized SelectionArea for page text selection.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scaleEnabled bool
See InteractiveViewer.scaleEnabled for details.
final
scrollByArrowKey double
Amount of pixels to scroll by arrow keys. The default is 25.0.
final
scrollByMouseWheel double?
Set the scroll amount ratio by mouse wheel. The default is 0.2.
final
useAlternativeFitScaleAsMinScale bool
If true, the minimum scale is set to the calculated PdfViewerController.alternativeFitScale.
final
verticalCacheExtent double
The vertical cache extent specified in ratio to the viewport height. The default is 1.0.
final
viewerOverlayBuilder PdfViewerOverlaysBuilder?
Add overlays to the viewer.
final

Methods

doChangesRequireReload(PdfViewerParams? other) bool
Determine whether the viewer needs to be reloaded or not.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(covariant PdfViewerParams other) bool
The equality operator.
override