David PHAM-VAN

Fix PdfPreview page format and orientation updates

@@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
5 - Update pdfium version to 4861 5 - Update pdfium version to 4861
6 - Fix crash when Android load a PDF file which had password 6 - Fix crash when Android load a PDF file which had password
7 - Fix parsing TTF fonts with zero-length glyphs 7 - Fix parsing TTF fonts with zero-length glyphs
  8 +- Fix PdfPreview page format and orientation updates
8 9
9 ## 5.7.2 10 ## 5.7.2
10 11
@@ -315,21 +315,24 @@ class _PdfPreviewState extends State<PdfPreview> { @@ -315,21 +315,24 @@ class _PdfPreviewState extends State<PdfPreview> {
315 mainAxisAlignment: MainAxisAlignment.center, 315 mainAxisAlignment: MainAxisAlignment.center,
316 children: <Widget>[ 316 children: <Widget>[
317 Expanded( 317 Expanded(
318 - child: PdfPreviewCustom(  
319 - key: previewWidget,  
320 - build: widget.build,  
321 - loadingWidget: widget.loadingWidget,  
322 - maxPageWidth: widget.maxPageWidth,  
323 - onError: widget.onError,  
324 - padding: widget.padding,  
325 - pageFormat: previewData.pageFormat,  
326 - pages: widget.pages,  
327 - pdfPreviewPageDecoration: widget.pdfPreviewPageDecoration,  
328 - previewPageMargin: widget.previewPageMargin,  
329 - scrollViewDecoration: widget.scrollViewDecoration,  
330 - shouldRepaint: widget.shouldRepaint,  
331 - dpi: widget.dpi,  
332 - ), 318 + child: Builder(builder: (context) {
  319 + final controller = PdfPreviewController.listen(context);
  320 + return PdfPreviewCustom(
  321 + key: previewWidget,
  322 + build: controller.buildDocument,
  323 + loadingWidget: widget.loadingWidget,
  324 + maxPageWidth: widget.maxPageWidth,
  325 + onError: widget.onError,
  326 + padding: widget.padding,
  327 + pageFormat: controller.pageFormat,
  328 + pages: widget.pages,
  329 + pdfPreviewPageDecoration: widget.pdfPreviewPageDecoration,
  330 + previewPageMargin: widget.previewPageMargin,
  331 + scrollViewDecoration: widget.scrollViewDecoration,
  332 + shouldRepaint: widget.shouldRepaint,
  333 + dpi: widget.dpi,
  334 + );
  335 + }),
333 ), 336 ),
334 if (actions.isNotEmpty && widget.useActions) 337 if (actions.isNotEmpty && widget.useActions)
335 IconTheme.merge( 338 IconTheme.merge(