ThumbnailGrid class
A two-column lazy grid of PDF page thumbnails.
ThumbnailGrid fetches thumbnails on demand as cells scroll into view, caches results in a bounded LRU map, and highlights the currently active page with a coloured border. Tapping a thumbnail navigates to that page via ViewerController.setPage.
Accessibility
Each cell is wrapped in Semantics with button: true and a label built
from pageLabelBuilder (typically l10n.thumbnailPageLabel(i + 1)).
Memory
The cache is bounded to _kMaxCacheSize thumbnails. When the sidebar is
closed and the widget is disposed, all cached ui.Image objects are
disposed immediately.
Example
ThumbnailGrid(
document: doc,
controller: controller,
pageCount: pageCount,
pageLabelBuilder: (i) => l10n.thumbnailPageLabel(i + 1),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- ThumbnailGrid
Constructors
- ThumbnailGrid({Key? key, required PdfDocument document, required ViewerController controller, required int pageCount, required String pageLabelBuilder(int pageIndex), int maxDimension = 160})
-
Creates a ThumbnailGrid.
const
Properties
- controller → ViewerController
-
The controller that drives page navigation and reports the current page
for active-cell highlighting.
final
- document → PdfDocument
-
The PDF document whose pages are shown as thumbnails.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- maxDimension → int
-
The maximum dimension (longest edge) for thumbnail rendering, in logical
pixels. Multiplied by MediaQuery.devicePixelRatioOf before calling
PdfDocument.getThumbnail for sharp high-DPI output.
final
- pageCount → int
-
Total number of pages in document.
final
- pageLabelBuilder → String Function(int pageIndex)
-
Builds the accessible label for the cell at zero-based index pageIndex.
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< ThumbnailGrid> -
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