espresso3389 / pdfrx

pdfrx is yet another PDF viewer implementation that built on the top of PDFium. The plugin currently supports Android, iOS, Windows, macOS, Linux, and Web.
MIT License
115 stars 55 forks source link

PdfViewer display error between screen transitions #147

Open reddeath1 opened 7 months ago

reddeath1 commented 7 months ago

Error displaying pdf after screen transition.. I ran out of ideas on how to solve this, as the pdf is been fetched successful from the device but when it reaches the viewer the error displayed.

Surprisingly the pdf is loaded as the error screen shows the page numbers, but can't get the view to display the pdf.

Simulator Screen Recording - iPhone 15 Pro Max - 2024-04-26 at 03 42 47


======== Exception caught by widgets library =======================================================
The following _TypeError was thrown building StreamBuilder<Matrix4>(state: _StreamBuilderBaseState<Matrix4, AsyncSnapshot<Matrix4>>#fc631):
Null check operator used on a null value

The relevant error-causing widget was: 
  PdfViewer PdfViewer:file:///Volumes/xx/lib/ui/screens/NewsPapers/Widgets/PDFViewerAdvance.dart:260:40
When the exception was thrown, this was the stack: 
#0      _PdfViewerState._guessCurrentPage (package:pdfrx/src/widgets/pdf_viewer.dart:569:27)
#1      _PdfViewerState._determineCurrentPage (package:pdfrx/src/widgets/pdf_viewer.dart:551:24)
#2      _PdfViewerState.build.<anonymous closure>.<anonymous closure> (package:pdfrx/src/widgets/pdf_viewer.dart:406:17)
#3      StreamBuilder.build (package:flutter/src/widgets/async.dart:437:81)
#4      _StreamBuilderBaseState.build (package:flutter/src/widgets/async.dart:120:48)
#5      StatefulElement.build (package:flutter/src/widgets/framework.dart:5592:27)
#6      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5480:15)
#7      StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5643:11)
#8      Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#9      StatefulElement.update (package:flutter/src/widgets/framework.dart:5666:5)
#10     Element.updateChild (package:flutter/src/widgets/framework.dart:3824:15)
#11     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6765:14)
#12     Element.updateChild (package:flutter/src/widgets/framework.dart:3824:15)
#13     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#14     Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#15     ProxyElement.update (package:flutter/src/widgets/framework.dart:5809:5)
#16     _InheritedNotifierElement.update (package:flutter/src/widgets/inherited_notifier.dart:105:11)
#17     Element.updateChild (package:flutter/src/widgets/framework.dart:3824:15)
#18     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#19     StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5643:11)
#20     Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#21     StatefulElement.update (package:flutter/src/widgets/framework.dart:5666:5)
#22     Element.updateChild (package:flutter/src/widgets/framework.dart:3824:15)
#23     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6765:14)
#24     Element.updateChild (package:flutter/src/widgets/framework.dart:3824:15)
#25     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5505:16)
#26     Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#27     StatelessElement.update (package:flutter/src/widgets/framework.dart:5556:5)
#28     Element.updateChild (package:flutter/src/widgets/framework.dart:3824:15)
#29     _LayoutBuilderElement._layout.layoutCallback (package:flutter/src/widgets/layout_builder.dart:155:18)
#30     BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2844:19)
#31     _LayoutBuilderElement._layout (package:flutter/src/widgets/layout_builder.dart:173:12)
#32     RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:2686:59)
#33     PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:1097:15)
#34     RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:2686:14)
#35     RenderConstrainedLayoutBuilder.rebuildIfNecessary (package:flutter/src/widgets/layout_builder.dart:248:7)
#36     _RenderLayoutBuilder.performLayout (package:flutter/src/widgets/layout_builder.dart:331:5)
#37     RenderObject.layout (package:flutter/src/rendering/object.dart:2575:7)
#38     RenderBox.layout (package:flutter/src/rendering/box.dart:2389:11)
#39     RenderPadding.performLayout (package:flutter/src/rendering/shifted_box.dart:239:12)
#40     RenderObject.layout (package:flutter/src/rendering/object.dart:2575:7)
#41     RenderBox.layout (package:flutter/src/rendering/box.dart:2389:11)
#42     RenderConstrainedBox.performLayout (package:flutter/src/rendering/proxy_box.dart:280:14)
#43     RenderObject.layout (package:flutter/src/rendering/object.dart:2575:7)
#44     RenderBox.layout (package:flutter/src/rendering/box.dart:2389:11)
#45     MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:173:12)
#46     _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:1063:7)
#47     MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:237:7)
#48     RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:404:14)
#49     RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:2414:7)
#50     PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1051:18)
#51     PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1064:15)
#52     RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:582:23)
#53     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:991:13)
#54     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:448:5)
#55     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1386:15)
#56     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1311:9)
#57     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1169:5)
#58     _invoke (dart:ui/hooks.dart:312:13)
#59     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:399:5)
#60     _drawFrame (dart:ui/hooks.dart:283:31)
====================================================================================================
espresso3389 commented 7 months ago

Fixed on 1.0.59.

reddeath1 commented 7 months ago

Fixed on 1.0.59.

Great, let me upgrade to it.

reddeath1 commented 7 months ago

Fixed on 1.0.59.

Didn't work, I just implemented a pop(), to navigate back from the second screen it worked on my use case.

espresso3389 commented 7 months ago

Didn't work, I just implemented a pop(), to navigate back from the second screen it worked on my use case.

Could you give me the error log for it?

reddeath1 commented 7 months ago

Didn't work, I just implemented a pop(), to navigate back from the second screen it worked on my use case.

Could you give me the error log for it?

Kindly see below


======== Exception caught by widgets library =======================================================
The following _TypeError was thrown building StreamBuilder<Matrix4>(dirty, state: _StreamBuilderBaseState<Matrix4, AsyncSnapshot<Matrix4>>#61ff0):
Null check operator used on a null value

The relevant error-causing widget was: 
  PdfViewer PdfViewer:file:///Volumes/***/**/lib/ui/screens/NewsPapers/Widgets/PDFViewerAdvance.dart:259:40
When the exception was thrown, this was the stack: 
#0      _PdfViewerState._calcAlternativeFitScale (package:pdfrx/src/widgets/pdf_viewer.dart:597:26)
#1      _PdfViewerState.build.<anonymous closure>.<anonymous closure> (package:pdfrx/src/widgets/pdf_viewer.dart:407:17)
#2      StreamBuilder.build (package:flutter/src/widgets/async.dart:437:81)
#3      _StreamBuilderBaseState.build (package:flutter/src/widgets/async.dart:120:48)
#4      StatefulElement.build (package:flutter/src/widgets/framework.dart:5592:27)
#5      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5480:15)
#6      StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5643:11)
#7      Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#8      ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462:5)
#9      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5634:11)
#10     ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
...     Normal element mounting (27 frames)
#37     Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#38     Element.updateChild (package:flutter/src/widgets/framework.dart:3840:20)
#39     _LayoutBuilderElement._layout.layoutCallback (package:flutter/src/widgets/layout_builder.dart:155:18)
#40     BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2844:19)
#41     _LayoutBuilderElement._layout (package:flutter/src/widgets/layout_builder.dart:173:12)
#42     RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:2686:59)
#43     PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:1097:15)
#44     RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:2686:14)
#45     RenderConstrainedLayoutBuilder.rebuildIfNecessary (package:flutter/src/widgets/layout_builder.dart:248:7)
#46     _RenderLayoutBuilder.performLayout (package:flutter/src/widgets/layout_builder.dart:331:5)
#47     RenderObject.layout (package:flutter/src/rendering/object.dart:2575:7)
#48     RenderBox.layout (package:flutter/src/rendering/box.dart:2389:11)
#49     RenderPadding.performLayout (package:flutter/src/rendering/shifted_box.dart:239:12)
#50     RenderObject.layout (package:flutter/src/rendering/object.dart:2575:7)
#51     RenderBox.layout (package:flutter/src/rendering/box.dart:2389:11)
#52     RenderConstrainedBox.performLayout (package:flutter/src/rendering/proxy_box.dart:280:14)
#53     RenderObject.layout (package:flutter/src/rendering/object.dart:2575:7)
#54     RenderBox.layout (package:flutter/src/rendering/box.dart:2389:11)
#55     MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:173:12)
#56     _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:1063:7)
#57     MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:237:7)
#58     RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:404:14)
#59     RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:2414:7)
#60     PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1051:18)
#61     PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1064:15)
#62     RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:582:23)
#63     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:991:13)
#64     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:448:5)
#65     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1386:15)
#66     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1311:9)
#67     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1169:5)
#68     _invoke (dart:ui/hooks.dart:312:13)
#69     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:399:5)
#70     _drawFrame (dart:ui/hooks.dart:283:31)
====================================================================================================