AnnotationView class

A widget that displays a list of PDF annotations (notes and highlights).

AnnotationView filters the provided annotations to show only PdfTextAnnotation (sticky notes) and PdfMarkupAnnotation with subtype PdfAnnotationType.highlight. Other annotation types are silently ignored.

A header shows the total count and per-type counts, plus a toggle switch that drives ViewerController.renderAnnotations to show or hide annotation rendering in the PDF page.

Cards are sorted in page order. Each card shows:

  • A left accent bar (clay for highlights, ink-500 for notes).
  • A type badge with icon.
  • The page number.
  • The annotation text (contents → markedText → author → dash fallback).
  • Author and formatted date when available.

Accessibility

Each card is wrapped in Semantics with button: true and a label of "Annotation on page N: …".

Example

AnnotationView(
  annotations: pageAnnotations,
  controller: controller,
  noteLabel: l10n.annotationNote,
  highlightLabel: l10n.annotationHighlight,
  totalLabel: (count) => l10n.annotationsTotal(count),
  noneFoundText: l10n.annotationsNoneFound,
  toggleOnLabel: l10n.annotationToggleOn,
  toggleOffLabel: l10n.annotationToggleOff,
)
Inheritance

Constructors

AnnotationView({Key? key, required List<PdfPageAnnotations> annotations, required ViewerController controller, required String noteLabel, required String highlightLabel, required String totalLabel(int count), required String noneFoundText, required String toggleOnLabel, required String toggleOffLabel, String? locale})
Creates a AnnotationView.
const

Properties

annotations List<PdfPageAnnotations>
All page annotations from the document (all pages).
final
controller ViewerController
Controller that drives annotation rendering in the PDF page.
final
hashCode int
The hash code for this object.
no setterinherited
highlightLabel String
Localised label for highlight annotations (e.g. "Highlight").
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
locale String?
Locale for date formatting. Defaults to the system locale.
final
noneFoundText String
Text shown when there are no note or highlight annotations.
final
noteLabel String
Localised label for note annotations (e.g. "Note").
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
toggleOffLabel String
Accessible label for the annotation toggle when annotations are hidden (tapping will show them).
final
toggleOnLabel String
Accessible label for the annotation toggle when annotations are visible (tapping will hide them).
final
totalLabel String Function(int count)
Builds the localised total annotation count string.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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