flutter_pdf_render icon indicating copy to clipboard operation
flutter_pdf_render copied to clipboard

Scrollbar support?

Open arjunj132 opened this issue 1 year ago • 1 comments

Just want to say - I love this library, and is probably the easiest out of all of them to use.

Is there any scrollbar support, or do we have to add it manually or something?

arjunj132 avatar Oct 15 '23 22:10 arjunj132

The viewer is based on InteractiveViewer. And it won't support scrollbars.

By the way, I've just added a small update to the viewer, which makes it easier to implement scroll position indicator (not scroll bar) though I don't know whether it's enough to your app or not:

Stack(
  children: [
    PdfViewer(...),
    // Simple scroll position indicator
    ValueListenableBuilder(
      valueListenable: controller,
      builder: (context, m, child) {
        if (!controller.isReady) return Container();
        final v = controller.viewRect;
        final all = controller.fullSize;
        final top = v.top / all.height * v.height;
        final height = v.height / all.height * v.height;
        return Positioned(
          right: 0,
          top: top,
          height: height,
          width: 8,
          child: Container(color: Colors.red),
        );
      },
    ),
  ],
),

Of course, it is possible to implement thumb-drag-to-move feature using PdfViewerController. But I don't have enough time to do that just now.

Anyway, I'll keep the issue to do extra work to fully support scroll bar.

espresso3389 avatar Oct 18 '23 12:10 espresso3389