pdf view in flutter code example
Example: pdf viewer flutter
flutter_plugin_pdf_viewer: ^1.0.7
import 'package:flutter_plugin_pdf_viewer/flutter_plugin_pdf_viewer.dart';
class Pdfviewer extends StatefulWidget {
@override
_Pdfviewer createState() => _Pdfviewer(data: this.data);
}
class _Pdfviewer extends State<Pdfviewer> {
PDFDocument doc;
bool _isLoading = true;
PDFDocument document;
@override
void initState() {
super.initState();
loadDocument();
}
loadDocument() async {
document = await PDFDocument.fromURL(
'URL');
setState(() => _isLoading = false);
}
@override
Widget build(BuildContext context) {
// TODO: implement build
return Scaffold(
appBar: AppBar(
title: Text('PdfViewer'),
backgroundColor: primary,
),
body: Center(child: PDFViewer(document: document)));
}
}