ToolbarItem class sealed
A single item in the viewer's main toolbar.
Hand a list of these to NutrientControllerInterface.setMainToolbarItems
(reachable from NutrientDocumentView.onControllerReady). There are two
kinds, both usable directly in the list — no wrapper needed:
- a ToolbarItemType value (e.g. ToolbarItemType.zoomIn) — a built-in item
- a CustomToolbarItem — a custom button backed by a Dart
onPressed
The call is re-appliable at any time, so you can add / remove / enable / disable items dynamically.
NutrientDocumentView(
documentPath: path,
onControllerReady: (controller) {
controller.setMainToolbarItems([
ToolbarItemType.zoomOut,
ToolbarItemType.zoomIn,
CustomToolbarItem(
id: 'say-hello',
title: 'Hello',
onPressed: () => debugPrint('toolbar button tapped'),
),
]);
},
);
Platform parity
- CustomToolbarItem — a custom button backed by a Dart
onPressedcallback — works on Android, iOS, and Web. On Android/Web it sits in the viewer's document toolbar; on iOS it's added to the navigation bar. - ToolbarItemType — reorder/remove the viewer's built-in items — is honored on Web only; Android and iOS ignore built-in entries (the custom items in the same list still apply).
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
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 ==(
Object other) → bool -
The equality operator.
inherited