Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switching the current PDF #13

Open
abaker2010 opened this issue Nov 21, 2019 · 3 comments
Open

Switching the current PDF #13

abaker2010 opened this issue Nov 21, 2019 · 3 comments

Comments

@abaker2010
Copy link

So I have been trying to work with getting PDF files to change when selecting a button from the bottom navigation bar. I am able to see that the path for the pdf is getting changed and the other information for the pdf file is getting changed as well but the actual view from the plugin is not being updated. This I feel is an issue in the library that needs to be looked at. I have posted to StackOverflow about the issue and they believe that it could be an issue with the plugin. Here is the question that I posted: https://stackoverflow.com/questions/58968253/flutter-issue-with-updating-ui-on-setstate?noredirect=1#comment104210699_58968253

The code that I have posted in the question, if you replace the PdfViewer for a Text file that shows say the new index it will update the index as it is suppose to be doing.

@leonardocustodio
Copy link

I'm having the same issue, anyone found a workaround ?

@DavidAriza
Copy link

I'm facing the same issue

@M1Joe
Copy link

M1Joe commented Apr 23, 2020

I worked around this issue with this. Basically, when your path changes, you need to remove the PDF viewer from the screen and then put it back with the new path. I'm using a timer for this, which obviously isn't ideal. Let me know if someone has a better work around!

Widget displayPdf() {
    if (refreshPdfPath == false) {
      return PdfViewer(filePath: knownGoodPdfPath);
    } else {
      refreshPdfTimer = new Timer.periodic(
        Duration(seconds: 1),
        (Timer timer) {
          if (mounted) {
            setState(
              () {
                refreshPdfPath = false;
              },
            );
          }
        },
      );
      return Center(child: Text('Refreshing...'));
    }
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants