espresso3389/pdfrx

layoutPages isn't enough

Opened this issue · 3 comments

Hi I am trying to make a book-like pdf viewer.
these are my requirements for the viewer

  • horizontally scrollable with snapping event
  • two pages should be viewed fully (two pages will be centered).
  • when the user taps right for example, pdf viewer should scroll automatically to next page.

I did figure out building it by utilizing PdfDocumentViewBuilder
However, when I had to implement the third requirement(scrolling automatically), it seems that I have to use PdfViewerController(I know this controller is PdfViewer based).

But as far as I know, if I change to PdfViewer, parameter for layoutPage doesn't work with snapping event..

anyway image down below, is what I have made so far.
I need to implement goToPage.. But it is impossible if I use PdfDocumentViewerBuilder. This is so frustrating..
GIF 2024-04-16 오후 10-21-55

I've managed to recreate my own "goToPage" for scroll snap list built inside PdfDocumentViewerBuilder
I just use the state manager for the scroll snap list. (orientation though, works a bit off tho,,)

Anyway, similar function should be added in the future in Pdfviewer for future use.

@ameliacode How did you implement the snap effect? Can you please share your code?

@ameliacode How did you implement the snap effect? Can you please share your code?

Hi musaffa, unfortunately I cannot fully open my code. However I can give you some hints for viewer..

In my previous version, I used the package called scroll snap list and wrapped around with PageDocumentViewBuilder. Somehow, this got orientation error on calculating the offset, so in my current version I have switched to PageView.builder

Hope this helps