Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions packages/pdfx/lib/src/viewer/pinch/pdf_view_pinch.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class PdfViewPinch extends StatefulWidget {
this.onPageChanged,
this.onDocumentLoaded,
this.onDocumentError,
this.onInteractionStart,
this.onInteractionUpdate,
this.onInteractionEnd,
this.builders = const PdfViewPinchBuilders<DefaultBuilderOptions>(
options: DefaultBuilderOptions(),
),
Expand Down Expand Up @@ -76,6 +79,15 @@ class PdfViewPinch extends StatefulWidget {
/// Pdf widget page background decoration
final BoxDecoration backgroundDecoration;

/// Called when the user starts a pan or scale gesture on the widget.
final GestureScaleStartCallback? onInteractionStart;

/// Called when the user ends a pan or scale gesture on the widget.
final GestureScaleEndCallback? onInteractionEnd;

/// Called when the user updates a pan or scale gesture on the widget.
final GestureScaleUpdateCallback? onInteractionUpdate;

/// Default page builder
@override
State<PdfViewPinch> createState() => _PdfViewPinchState();
Expand Down Expand Up @@ -564,6 +576,9 @@ class _PdfViewPinchState extends State<PdfViewPinch>
_reLayout(viewSize);
final docSize = _docSize ?? const Size(10, 10); // dummy size
return InteractiveViewer(
onInteractionStart: widget.onInteractionStart,
onInteractionEnd: widget.onInteractionEnd,
onInteractionUpdate: widget.onInteractionUpdate,
transformationController: _controller,
scrollControls: InteractiveViewerScrollControls.scrollPans,
constrained: false,
Expand Down