PdfPreview.builder constructor
const
PdfPreview.builder({
- Key? key,
- required LayoutCallback build,
- PdfPageFormat? initialPageFormat,
- bool allowPrinting = true,
- bool allowSharing = true,
- double? maxPageWidth,
- bool canChangePageFormat = true,
- bool canChangeOrientation = true,
- bool canDebug = true,
- List<
Widget> ? actions, - Map<
String, PdfPageFormat> pageFormats = _defaultPageFormats, - Widget onError(
- BuildContext context,
- Object error
- void onPrinted(
- BuildContext context
- void onPrintError(
- BuildContext context,
- dynamic error
- Decoration? scrollViewDecoration,
- Decoration? pdfPreviewPageDecoration,
- String? pdfFileName,
- bool useActions = true,
- List<
int> ? pages, - bool dynamicLayout = true,
- EdgeInsets? previewPageMargin,
- EdgeInsets? padding,
- bool shouldRepaint = false,
- Widget? loadingWidget,
- ValueChanged<
PdfPageFormat> ? onPageFormatChanged, - double? dpi,
- PdfActionBarTheme actionBarTheme = const PdfActionBarTheme(),
- required CustomPdfPagesBuilder pagesBuilder,
- bool enableScrollToPage = false,
- ValueChanged<
bool> ? onZoomChanged,
Build a custom layout.
PdfPreview.builder(
build: (format) => _generatePdf(format, title),
pagesBuilder: (context, pages) => SingleChildScrollView(
child: Wrap(
spacing: 8,
runSpacing: 8,
children: [
for (final page in pages)
Container(
color: Colors.white,
child: Image(
image: page.image,
width: 300,
),
)
],
),
),
)
Implementation
const PdfPreview.builder({
super.key,
required this.build,
this.initialPageFormat,
this.allowPrinting = true,
this.allowSharing = true,
this.maxPageWidth,
this.canChangePageFormat = true,
this.canChangeOrientation = true,
this.canDebug = true,
this.actions,
this.pageFormats = _defaultPageFormats,
this.onError,
this.onPrinted,
this.onPrintError,
this.onShared,
this.scrollViewDecoration,
this.pdfPreviewPageDecoration,
this.pdfFileName,
this.useActions = true,
this.pages,
this.dynamicLayout = true,
this.shareActionExtraBody,
this.shareActionExtraSubject,
this.shareActionExtraEmails,
this.previewPageMargin,
this.padding,
this.shouldRepaint = false,
this.loadingWidget,
this.onPageFormatChanged,
this.dpi,
this.actionBarTheme = const PdfActionBarTheme(),
required CustomPdfPagesBuilder pagesBuilder,
this.enableScrollToPage = false,
this.onZoomChanged,
}) : _pagesBuilder = pagesBuilder;