PdfEditingToolbar class

A ready-made toolbar for PdfEditingController.

The bar is organised as a dock with a compact Hand / Select navigation cluster followed by the editing tool groups - Markup, Draw, Shapes, Insert, Measure and Edit - and the global undo/redo, flatten and save actions. Tapping an editing group raises a contextual strip above the dock: the group's tools on the left and the active tool's live settings (colour, stroke, opacity, font, scale…) on the right, so each tool shows only the settings it supports. Selecting an annotation or a page element raises its own strip with the actions and restyle controls that apply to it.

On narrow (phone) widths the dock collapses to an active-tool switcher, a quick-colour row and a Tools handle. The switcher recalls recently used tools and clears back to Hand mode; the handle opens a bottom sheet with group tabs, a tool grid and the active tool's settings.

Place it in a Scaffold's bottomNavigationBar or as the bottom child of a Column - it sizes to its content. Apps wanting different chrome can skip this widget entirely and drive the controller from their own UI, or add focused host actions with leading and trailing.

Inheritance

Constructors

PdfEditingToolbar({Key? key, required PdfEditingController controller, required PdfViewerController viewerController, void onSave(Uint8List bytes)?, PdfTextPrompt textPrompt = showPdfTextPrompt, PdfStyledTextPrompt styledTextPrompt = showPdfStyledTextPrompt, PdfImagePicker? imagePicker, PdfFormImagePicker? formImagePicker, PdfSelectedContentImageHandler? onExportSelectedContentImage, PdfFontPicker? fontPicker, PdfStampExportCallback? onExportCustomStamps, PdfStampImportCallback? onImportCustomStamps, List<Color> palette = defaultPalette, Set<PdfEditTool>? tools, Set<PdfEditToolGroup>? groups, Map<PdfEditTool, PdfToolShortcut> toolShortcuts = pdfEditToolShortcuts, bool showMarkup = true, bool showUndoRedo = true, bool showColor = true, bool showStyle = true, bool showFlatten = true, bool showColorProcessing = true, List<PdfEditingToolbarWidgetBuilder> leading = const [], List<PdfEditingToolbarWidgetBuilder> trailing = const []})
const

Properties

controller PdfEditingController
final
fontPicker PdfFontPicker?
How the font menu's "Load font…" entry obtains a custom .ttf/.otf file. When null, only the standard families and bundled fonts are offered (no custom loading).
final
formImagePicker PdfFormImagePicker?
How the selected push-button field's toolbar action obtains an image. PNG and JPEG bytes are accepted. When null, the action is disabled.
final
groups Set<PdfEditToolGroup>?
The tool types (dock groups) to expose, null meaning all of them. A group not in the set vanishes from the dock entirely - this is the way to disable a whole tool type (Measure, Markup, Draw…) without enumerating each of its tools in tools.
final
hashCode int
The hash code for this object.
no setterinherited
imagePicker PdfFontPicker?
How the image tool (PdfEditTool.image) sources a picture to insert, and how selected page-content images are replaced from the element strip. Typically a file picker returning PNG or JPEG bytes.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
leading List<PdfEditingToolbarWidgetBuilder>
Custom widgets shown before the stock dock controls. Builders run inside the toolbar's listenable rebuild, so they can reflect controller or viewerController state directly.
final
onExportCustomStamps PdfStampExportCallback?
Host-provided export for the Manage Stamps dialog.
final
onExportSelectedContentImage PdfSelectedContentImageHandler?
How selected page-content images are exported from the element strip. When null, the Save image button is hidden.
final
onImportCustomStamps PdfStampImportCallback?
Host-provided import for the Manage Stamps dialog.
final
onSave → void Function(Uint8List bytes)?
Receives the current revision's bytes when the save button is pressed; the button is hidden when null. Writing the bytes somewhere is the app's job.
final
palette List<Color>
The colors offered for new annotations.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showColor bool
Whether the colour controls - the palette swatches, the "More colours…" picker, the eyedropper, and the text-box fill/border colour rows in the style popup - are shown. Split from showStyle so a colour-locked session can hide the colour changer while leaving stroke/opacity/font editable.
final
showColorProcessing bool
Whether the Edit group includes the colour-processing action.
final
showFlatten bool
Whether the flatten-annotations button is shown.
final
showMarkup bool
Whether text markup actions (highlight, underline, strike out, squiggly - they act on the viewer's text selection) are shown. A convenience for the common case; equivalent to dropping PdfEditToolGroup.markup from groups. The Draw group's freehand Highlight tool is controlled by PdfEditTool.highlight.
final
showStyle bool
Whether the style popup (the stroke/opacity/font controls) is shown. Independent of showColor: the popup can show its sliders and font controls with its colour rows hidden.
final
showUndoRedo bool
Whether the undo/redo buttons are shown. The viewer's ⌘Z/⇧⌘Z shortcuts work either way.
final
styledTextPrompt PdfStyledTextPrompt
How the "Edit text & style" button asks for replacement text plus rich-text overrides (colour, size, bold, italic).
final
textPrompt PdfTextPrompt
How the edit-text button asks for replacement text.
final
tools Set<PdfEditTool>?
The tools to expose, null meaning all of them. A group disappears from the dock when none of its tools are in the set. Sub-controls tied to an armed tool (the form field-type menu, signature redraw) follow their tool. Hiding a tool doesn't disable it - it can still be armed through the controller.
final
toolShortcuts Map<PdfEditTool, PdfToolShortcut>
Shortcut labels to show in tooltips. Keep this in sync with PdfViewer.toolShortcuts when rebinding keys in the stock editor UI. Tools omitted from the map show no shortcut label.
final
trailing List<PdfEditingToolbarWidgetBuilder>
Custom widgets shown after the stock dock controls.
final
viewerController PdfViewerController
The viewer the markup buttons read the text selection from.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<PdfEditingToolbar>
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

Constants

defaultPalette → const List<Color>
mobileBreakpoint → const double
Below this width the dock collapses to a solid bar and tools move into a bottom sheet. Above it, the desktop dock + contextual strip show as floating cards. Hosts can read this to decide whether to dock the toolbar (below this width it's a solid bar, so floating it over the page would hide content) or let it float.