Closed erwinagpasa closed 2 years ago
I copied the code
bool _isLoading = true; late PDFDocument document;
@override void initState() { super.initState(); loadDocument(); }
loadDocument() async { document = await PDFDocument.fromURL('http://www.africau.edu/images/default/sample.pdf'); setState(() => _isLoading = false);
}
In my scaffold
Center( child: _isLoading ? const Center(child: CircularProgressIndicator()) : PDFViewer( document: document, zoomSteps: 1, scrollDirection: Axis.vertical, showPicker: false, ), ),
Fixed
I copied the code
bool _isLoading = true; late PDFDocument document;
@override void initState() { super.initState(); loadDocument(); }
loadDocument() async { document = await PDFDocument.fromURL('http://www.africau.edu/images/default/sample.pdf'); setState(() => _isLoading = false);
}
In my scaffold
Center( child: _isLoading ? const Center(child: CircularProgressIndicator()) : PDFViewer( document: document, zoomSteps: 1, scrollDirection: Axis.vertical, showPicker: false, ), ),