PdfFlowView class
A "reading flow" PDF widget that lays out every page as a vertical column of images, sized to the height of its content and without any internal scrolling of its own.
Unlike PdfViewer — which is an interactive viewer that owns its own scroll and pinch-to-zoom — PdfFlowView is a static, content-sized block meant to be dropped inside a scrolling parent (e.g. a CustomScrollView via a SliverToBoxAdapter, or a ListView/SingleChildScrollView). The parent handles all scrolling; this widget never steals the gesture. This is the PDF counterpart of a content-sized WebView with internal scrolling disabled.
Pages are rendered lazily: each page slot decodes its image only when it becomes (close to) visible in the parent viewport, showing a placeholder until then, and releases the decoded image again once it scrolls far enough off screen. Visibility is derived from the nearest ancestor Scrollable; if there is none, every page is rendered.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- PdfFlowView
Constructors
- PdfFlowView({Key? key, Uint8List? pdfData, String? pdfPath, double pageSpacing = 8, EdgeInsets padding = EdgeInsets.zero, Color? backgroundColor, void onPageTap(int page)?, Widget pagePlaceholderBuilder(BuildContext context, int page)?, double cacheExtent = 600, void onError(Object error)?, Widget errorBuilder(BuildContext context, Object error)?})
-
Creates a PdfFlowView.
const
Properties
- backgroundColor → Color?
-
Background color used behind pages and by the default placeholder.
final
- cacheExtent → double
-
How far outside the visible viewport (in logical pixels) a page is still
considered "visible" and kept rendered. Larger values pre-render more
pages ahead of scrolling at the cost of memory.
final
- errorBuilder → Widget Function(BuildContext context, Object error)?
-
Builds the widget shown when the document fails to load or parse.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onError → void Function(Object error)?
-
Called when the document fails to load or parse (network/asset error or a
corrupt/encrypted PDF). Use it to log the error or surface an app-level
message. The widget still shows its own error state (see errorBuilder).
final
- onPageTap → void Function(int page)?
-
Called when a page is tapped. The page number is 1-indexed.
final
- padding → EdgeInsets
-
Padding around the whole column of pages.
final
- pagePlaceholderBuilder → Widget Function(BuildContext context, int page)?
-
Builds the placeholder shown for a page (1-indexed) while it is not yet
rendered. Defaults to a plain grey skeleton.
final
- pageSpacing → double
-
Vertical space inserted between consecutive pages.
final
- pdfData → Uint8List?
-
Raw bytes of a PDF document, displayed directly without any path or URL.
final
- pdfPath → String?
-
Path to a PDF file. Can be a URL (starting with http:// or https://) or an
asset path.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< PdfFlowView> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited