You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
juliandambrosio
changed the title
OnShared call widget.onPrinted function
When I press the shared button it calls onPrinted instead of onShared
Apr 19, 2024
you pressed onShared but you called onPrinted, so it's normal. Sorry , i couldn't understand. Can you explain more ?
I think this function should be called when I press the shared button.
/// Called if the user shares the pdf document
final void Function(BuildContext context)? onShared;
But in both cases, this other function is called when I print or share a PDF.
/// Called if the user prints the pdf document
final void Function(BuildContext context)? onPrinted;
These functions are found in the pdf_preview.dart file
Describe the bug
PdfPreview
if (widget.useActions && widget.allowSharing && info?.canShare == true) {
actions.add(PdfShareAction(
filename: widget.pdfFileName,
onShared:
widget.onPrinted == null ? null : () => widget.onPrinted!(context),
));
}
To Reproduce
return PdfPreview(
build: (format) => _buildPdfDocument(credential, image, format).save(),
allowSharing: true,
allowPrinting: true,
pageFormats: defaultPageFormats,
canChangeOrientation: false,
canDebug: false,
dpi: 72,
initialPageFormat: _getInitialPageFormat(credential),
pdfFileName: '${credential.fileName}.pdf',
onPrinted: (BuildContext context) async {
NavigatorService.pushReplacementNamed(HomeScreen.routeName);
},
onPrintError: (BuildContext context, dynamic error) async {
NavigatorService.pushReplacementNamed(HomeScreen.routeName);
});
}
When I press the shared button it calls onPrinted instead of onShared
Expected behavior
Custom onShared is never used, but must be called
The text was updated successfully, but these errors were encountered: