On mobile devices, when widgets are added to pageOverlaysBuilder, if I tap on added widget and start panning, it's not working. If pan starting on PDF page itself, everything works.
pageOverlaysBuilder: (
BuildContext context,
Rect pageRect,
PdfRx.PdfPage page,
) {
final Rect? viewport = _viewerController?.visibleRect;
final List<Rect>? pages =
_viewerController?.layout.pageLayouts;
if (viewport == null ||
pages == null ||
!pages[page.pageNumber - 1].overlaps(viewport)) {
return const [];
}
final inputs = _inputsByPage[page.pageNumber] ?? const [];
return _buildPdfInputItems(
inputs,
pageRect.width,
pageRect.height,
);
},
List<Widget> _buildPdfInputItems(
List<DocumentInput> inputs,
double pageWidth,
double pageHeight,
) {
List<Widget> result = [];
for (var input in inputs) {
if (widget.signDate != null) {
Widget? inputView = _buildSingleInputItem(
input,
pageWidth,
pageHeight,
widget.signDate!,
);
if (inputView != null) {
result.add(inputView);
}
}
}
return result;
}
Widget? _buildSingleInputItem(
DocumentInput item,
double renderPageWidth,
double renderedPageHeight,
DateTime signDate,
) {
int originalDocWidth = item.signature.pageSize.x;
int originalDocHeight = item.signature.pageSize.y;
int originalTopLeftX = item.signature.topLeft.x;
int originalTopLeftY = item.signature.topLeft.y;
int originalBottomRightX = item.signature.bottomRight.x;
int originalBottomRightY = item.signature.bottomRight.y;
item.proportionX = renderPageWidth / originalDocWidth;
item.proportionY = renderedPageHeight / originalDocHeight;
double left = (originalTopLeftX * item.proportionX);
double top = (originalTopLeftY * item.proportionY);
double actualWidth =
((originalBottomRightX - originalTopLeftX) * item.proportionX);
double actualHeight =
((originalBottomRightY - originalTopLeftY) * item.proportionY);
DocumentInputWidget documentInput = DocumentInputFactory.makeDocumentInput(
documentInput: item,
actualHeight: actualHeight,
actualWidth: actualWidth,
screenWidth: renderPageWidth,
inputUpdateListener: this,
signDate: signDate,
biometricValidation: widget.biometricValidation,
);
return Positioned(
left: left,
top: top,
child: Container(
key: Key(item.signature.name),
alignment: Alignment.center,
width: actualWidth,
height: actualHeight,
child: documentInput,
),
);
}
On mobile devices, when widgets are added to pageOverlaysBuilder, if I tap on added widget and start panning, it's not working. If pan starting on PDF page itself, everything works.