From 62348162102a33fbfe06d91f74c1c85e9f2c3a07 Mon Sep 17 00:00:00 2001 From: Jean-Paul Lekkerkerker Date: Thu, 31 Jul 2025 09:46:56 +0200 Subject: [PATCH] expose InteractiveViewer onInteractionX-methods --- .../pdfx/lib/src/viewer/pinch/pdf_view_pinch.dart | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/pdfx/lib/src/viewer/pinch/pdf_view_pinch.dart b/packages/pdfx/lib/src/viewer/pinch/pdf_view_pinch.dart index 294ddc98..894712c8 100644 --- a/packages/pdfx/lib/src/viewer/pinch/pdf_view_pinch.dart +++ b/packages/pdfx/lib/src/viewer/pinch/pdf_view_pinch.dart @@ -26,6 +26,9 @@ class PdfViewPinch extends StatefulWidget { this.onPageChanged, this.onDocumentLoaded, this.onDocumentError, + this.onInteractionStart, + this.onInteractionUpdate, + this.onInteractionEnd, this.builders = const PdfViewPinchBuilders( options: DefaultBuilderOptions(), ), @@ -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 createState() => _PdfViewPinchState(); @@ -564,6 +576,9 @@ class _PdfViewPinchState extends State _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,