David PHAM-VAN

PdfPreview supports generic Widgets as actions

1 # Changelog 1 # Changelog
2 2
  3 +## 5.8.0
  4 +
  5 +- PdfPreview supports generic Widgets as actions
  6 +
3 ## 5.7.5 7 ## 5.7.5
4 8
5 - Update SWIFT code formatter to version 5 9 - Update SWIFT code formatter to version 5
@@ -95,8 +95,8 @@ class PdfPreview extends StatefulWidget { @@ -95,8 +95,8 @@ class PdfPreview extends StatefulWidget {
95 /// Add a switch to show debug view 95 /// Add a switch to show debug view
96 final bool canDebug; 96 final bool canDebug;
97 97
98 - /// Additionnal actions to add to the widget  
99 - final List<PdfPreviewAction>? actions; 98 + /// Additional actions to add to the widget
  99 + final List<Widget>? actions;
100 100
101 /// List of page formats the user can choose 101 /// List of page formats the user can choose
102 final Map<String, PdfPageFormat> pageFormats; 102 final Map<String, PdfPageFormat> pageFormats;
@@ -107,7 +107,7 @@ class PdfPreview extends StatefulWidget { @@ -107,7 +107,7 @@ class PdfPreview extends StatefulWidget {
107 /// Called if the user prints the pdf document 107 /// Called if the user prints the pdf document
108 final void Function(BuildContext context)? onPrinted; 108 final void Function(BuildContext context)? onPrinted;
109 109
110 - /// Called if an error creating the Pdf occured 110 + /// Called if an error creating the Pdf occurred
111 final void Function(BuildContext context, dynamic error)? onPrintError; 111 final void Function(BuildContext context, dynamic error)? onPrintError;
112 112
113 /// Called if the user shares the pdf document 113 /// Called if the user shares the pdf document
@@ -258,7 +258,7 @@ class _PdfPreviewState extends State<PdfPreview> { @@ -258,7 +258,7 @@ class _PdfPreviewState extends State<PdfPreview> {
258 258
259 final actions = <Widget>[]; 259 final actions = <Widget>[];
260 260
261 - if (widget.allowPrinting && info?.canPrint == true) { 261 + if (widget.useActions && widget.allowPrinting && info?.canPrint == true) {
262 actions.add(PdfPrintAction( 262 actions.add(PdfPrintAction(
263 jobName: widget.pdfFileName, 263 jobName: widget.pdfFileName,
264 dynamicLayout: widget.dynamicLayout, 264 dynamicLayout: widget.dynamicLayout,
@@ -270,7 +270,7 @@ class _PdfPreviewState extends State<PdfPreview> { @@ -270,7 +270,7 @@ class _PdfPreviewState extends State<PdfPreview> {
270 )); 270 ));
271 } 271 }
272 272
273 - if (widget.allowSharing && info?.canShare == true) { 273 + if (widget.useActions && widget.allowSharing && info?.canShare == true) {
274 actions.add(PdfShareAction( 274 actions.add(PdfShareAction(
275 filename: widget.pdfFileName, 275 filename: widget.pdfFileName,
276 onShared: 276 onShared:
@@ -278,12 +278,12 @@ class _PdfPreviewState extends State<PdfPreview> { @@ -278,12 +278,12 @@ class _PdfPreviewState extends State<PdfPreview> {
278 )); 278 ));
279 } 279 }
280 280
281 - if (widget.canChangePageFormat) { 281 + if (widget.useActions && widget.canChangePageFormat) {
282 actions.add(PdfPageFormatAction( 282 actions.add(PdfPageFormatAction(
283 pageFormats: widget.pageFormats, 283 pageFormats: widget.pageFormats,
284 )); 284 ));
285 285
286 - if (widget.canChangeOrientation) { 286 + if (widget.useActions && widget.canChangeOrientation) {
287 // ignore: prefer_const_constructors 287 // ignore: prefer_const_constructors
288 actions.add(PdfPageOrientationAction()); 288 actions.add(PdfPageOrientationAction());
289 } 289 }
@@ -335,7 +335,7 @@ class _PdfPreviewState extends State<PdfPreview> { @@ -335,7 +335,7 @@ class _PdfPreviewState extends State<PdfPreview> {
335 ); 335 );
336 }), 336 }),
337 ), 337 ),
338 - if (actions.isNotEmpty && widget.useActions) 338 + if (actions.isNotEmpty)
339 IconTheme.merge( 339 IconTheme.merge(
340 data: IconThemeData( 340 data: IconThemeData(
341 color: iconColor, 341 color: iconColor,
@@ -6,7 +6,7 @@ description: > @@ -6,7 +6,7 @@ description: >
6 homepage: https://github.com/DavBfr/dart_pdf/tree/master/printing 6 homepage: https://github.com/DavBfr/dart_pdf/tree/master/printing
7 repository: https://github.com/DavBfr/dart_pdf 7 repository: https://github.com/DavBfr/dart_pdf
8 issue_tracker: https://github.com/DavBfr/dart_pdf/issues 8 issue_tracker: https://github.com/DavBfr/dart_pdf/issues
9 -version: 5.7.5 9 +version: 5.8.0
10 10
11 environment: 11 environment:
12 sdk: ">=2.12.0 <3.0.0" 12 sdk: ">=2.12.0 <3.0.0"