How to zoom in PdfPageView
Opened this issue · 4 comments
4-alok commented
This is my code, and how do I implement pinch zoom?
PageView.builder(
physics: const BouncingScrollPhysics(),
controller: controller.pageController,
itemCount: document.pages.length,
onPageChanged: (i) => controller.currentPage.value = i,
itemBuilder: (context, index) => LayoutBuilder(
builder: (context, constraints) => Stack(
children: [
pdfrx.PdfPageView(
document: document,
pageNumber: index + 1,
maximumDpi: 300,
decorationBuilder:
(context, pageSize, page, pageImage) {
return Center(
child: Container(child: pageImage));
},
),
TextView(index: index)
],
),
)),
fuadmostafij6 commented
Use InteractiveViewer
4-alok commented
Could u plz give an example
fuadmostafij6 commented
Listener(
onPointerDown: (details) {
if (details.kind ==
PointerDeviceKind.touch) {
fingersInteracting ++ ;
}
},
onPointerUp: (details) {
if (details.kind ==
PointerDeviceKind.touch) {
fingersInteracting = 0 ;
}
},
onPointerCancel: (details) {
if (details.kind ==
PointerDeviceKind.touch) {
fingersInteracting = 0 ;
}
},
child: InteractiveViewer(
clipBehavior: Clip.hardEdge,
minScale: 1,
maxScale: 3,
panAxis: PanAxis.aligned,
panEnabled: isScrollEnable,
transformationController:
transformationController,
onInteractionUpdate: (details) {
},
onInteractionEnd: (details) {
},
child:
Material(
child: RepaintBoundary(
child: PageView.builder(
controller: pageController,
physics: transformationController
.value
.getMaxScaleOnAxis() <=
1.2 &&
fingersInteracting <=
1 &&
isScrollEnable
? const AlwaysScrollableScrollPhysics()
: const NeverScrollableScrollPhysics(),
onPageChanged: (value){
updateCurrentPageNo(value+1);
},
itemCount:newThumbnailPaths.length,
itemBuilder: (context, index) {
return Container();
},),
),
);
),
);
4-alok commented
ok thanks, now how do I select text in PageView