diff --git a/lib/flutter_pdfview.dart b/lib/flutter_pdfview.dart index 5e0a1b33..fda7bd03 100644 --- a/lib/flutter_pdfview.dart +++ b/lib/flutter_pdfview.dart @@ -39,6 +39,7 @@ class PDFView extends StatefulWidget { this.defaultPage = 0, this.fitPolicy = FitPolicy.WIDTH, this.preventLinkNavigation = false, + this.useHybridComposition = false, }) : assert(filePath != null || pdfData != null), super(key: key); @@ -80,6 +81,7 @@ class PDFView extends StatefulWidget { final FitPolicy fitPolicy; final bool fitEachPage; final bool preventLinkNavigation; + final bool useHybridComposition; } class _PDFViewState extends State { @@ -101,6 +103,20 @@ class _PDFViewState extends State { ); }, onCreatePlatformView: (PlatformViewCreationParams params) { + if (widget.useHybridComposition) { + return PlatformViewsService.initExpensiveAndroidView( + id: params.id, + viewType: 'plugins.endigo.io/pdfview', + layoutDirection: TextDirection.rtl, + creationParams: _CreationParams.fromWidget(widget).toMap(), + creationParamsCodec: const StandardMessageCodec(), + ) + ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated) + ..addOnPlatformViewCreatedListener((int id) { + _onPlatformViewCreated(id); + }) + ..create(); + } return PlatformViewsService.initSurfaceAndroidView( id: params.id, viewType: 'plugins.endigo.io/pdfview',