I have a problem I want my PdfView to fit 100% of the screen Currently I'm using flutter_pdfview 1.2.2
I have tried to wrap the PDFView()
with Container
and give it MediaQuery.of(context).size.height & width
but isn't working
My Code :
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("PDfViewer"),
actions: [
IconButton(
onPressed: () {
setState(() {
isSaved = !isSaved;
if (isSaved) {
bookmarkAdded.add(widget.indexPage);
}
});
},
icon: Icon(
isSaved ? Icons.bookmark : Icons.bookmark_border,
size: 30,
))
],
),
body: SafeArea(
child: PDFView(
fitPolicy: FitPolicy.BOTH,
defaultPage: widget.indexPage,
nightMode: true,
autoSpacing: false,
enableSwipe: false,
swipeHorizontal: true,
pageSnap: true,
filePath: widget.file.path,
onRender: (pages) => setState(() {
this.pages = pages!;
// print("Pages : ${this.pages}");
}),
onViewCreated: (controller) => setState(() {
pdfViewController = controller;
}),
onPageChanged: (indexPage, _) => setState(() {
this.widget.indexPage = indexPage!;
print('IndexPages : ${widget.indexPage}');
}),
),
),
);
}
UI samples