packages.flutter icon indicating copy to clipboard operation
packages.flutter copied to clipboard

pdfx web - bouncing behaviour is quite annoying when scrolling

Open BenPoell opened this issue 2 years ago • 4 comments

Describe the bug When scrolling a lager PDF with the mouse (especially with smaller wheel spin) the scrolling behavoiur with it's bouncing is quite annoying. As you can see here in this animation you even get stuck sometimes on the same place (e.g. at page break): ezgif-5-fc51c92db2

To Reproduce I'm taking a fileBase64Decoded PDF but this shouldn't matter though. It just needs to be multiple pages.

I tried playing around a bit with pageSnapping and the physics but there was no real satisfiying result.

Behaviour is same in Chrome and Edge.

PdfController? pdfController = PdfController(
              document: PdfDocument.openData(fileDecoded),
            );

PdfView(
  controller: pdfController!,
  scrollDirection: Axis.vertical,
  pageSnapping: !kIsWeb,
  physics: PageScrollPhysics(),
  builders: PdfViewBuilders<DefaultBuilderOptions>(
    options: const DefaultBuilderOptions(),
    documentLoaderBuilder: (context) => Center(
      child: CircularProgressIndicator(
        valueColor: AlwaysStoppedAnimation(Theme.of(context).primaryColor),
      ),
    ),
    pageLoaderBuilder: (context) => Center(
      child: CircularProgressIndicator(
        valueColor: AlwaysStoppedAnimation(Theme.of(context).primaryColor),
      ),
    ),
  ),
);

Expected behavior pageSnapping: false should actually not pageSnap

OR

Based on the given ScrollPhysics an according scrolling behaviour, e.g.

  • bouncing when BouncingScrollPhysics
  • maintaining the amount of overscroll or underscroll when RangeMaintainingScrollPhysics

OR

it would actually be nice to have a scrollbar available, like already mentioned in #81.

BenPoell avatar May 15 '22 08:05 BenPoell

Maybe it would also be worth a try to implement it's own ScrollController to kinda control the scroll behaviour on your own. But it seems like this whole scrolling stuff is somewhere deep in related packages like photo_view_gallery.

My idea was to create some sort of controller like here in this package and wrap the PdfView with it: https://pub.dev/packages/smooth_scroll_web

BenPoell avatar May 15 '22 09:05 BenPoell

Are there any news regarding this issues. We still have this behavior. Do you have planned to provide a fix for it? Many thanks for your response.

waketeck avatar Apr 15 '23 12:04 waketeck

I would like to push resolution of this issue 🙏 I like the library but this bounding behaviour while viewing PDF will probably make me search for another library if not resolved soon.

FilipObornik avatar Jan 30 '24 08:01 FilipObornik

Same as @FilipObornik, the library is quite useful but having no control over scrolling is annoying

rodriwaw avatar Feb 16 '24 15:02 rodriwaw