flutter_pdf_render
flutter_pdf_render copied to clipboard
Feature request: ability to set scroll physics
I briefly looked at the code and to achieve setting scroll physics, a major rewrite would be required. You are currently using InteractiveViewer, which doesn't have a physics property or the concept of scrolling (just panning, which is scrolling in all directions, basically).
My experience with Dart and Flutter are limited, but I think the InteractiveViewer would need to be replaced with something like a ListView, which does support just setting physics.
Let me know what you think.
Basically, InteractiveViewer is vital to support zooming feature and it takes considerable (I don't know actually) time to implement physics with it.
But, for your purpose, you can simply use List.builder; the following fragment is from Multi-page view using ListView.builder:
@override
Widget build(BuildContext context) {
return new MaterialApp(
home: new Scaffold(
appBar: new AppBar(
title: const Text('Pdf_render example app'),
),
backgroundColor: Colors.grey,
body: Center(
child: PdfDocumentLoader.openAsset(
'assets/hello.pdf',
documentBuilder: (context, pdfDocument, pageCount) => LayoutBuilder(
builder: (context, constraints) => ListView.builder(
itemCount: pageCount,
itemBuilder: (context, index) => Container(
margin: EdgeInsets.all(margin),
padding: EdgeInsets.all(padding),
color: Colors.black12,
child: PdfPageView(
pdfDocument: pdfDocument,
pageNumber: index + 1,
)
)
)
),
)
)
),
);
}
Related: InteractiveViewer should allow us to easily customize the inertia physics #71676 flutter/flutter
That let's me achieve the scroll physics I want, but it disables zooming in. I tried re-adding it using InteractiveViewer, but as I said, I'm not an experienced Flutter dev, so I was not able to get it to work... Any idea?
@ricardoboss It's not so easy task for any developer to implement such mechanism to InteractiveViewer :(