Open mumairofficial opened 1 year ago
I am trying to jump to a specific page once the PDF file is loaded from either URL or File. Here is what I have tried, not sure what's wrong.
class _PublicationReaderScreenState extends State<PublicationReaderScreen> { late PDFDocument document; bool _loading = true; final PageController _pageController = PageController(); @override void initState() { super.initState(); loadDocument(); // _pageController.jumpTo(5.0); } loadDocument() async { document = await PDFDocument.fromURL(widget.publication.downloadUrl); setState(() { _loading = false; }); } @override void dispose() { super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( elevation: 1, ), body: _loading ? const Center(child: CircularProgressIndicator()) : PDFViewer( document: document, zoomSteps: 1, lazyLoad: true, pickerButtonColor: Theme.of(context).colorScheme.primary, controller: _pageController, showIndicator: true, onPageChanged: (int p) { print(p+1); }, ), ); } }
Tried PageController but no success!
PageController
I am trying to jump to a specific page once the PDF file is loaded from either URL or File. Here is what I have tried, not sure what's wrong.
Tried
PageController
but no success!