Showing
2 changed files
with
13 additions
and
2 deletions
| @@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
| 7 | - Fix Linux build on Debian 9 | 7 | - Fix Linux build on Debian 9 |
| 8 | - Added a boolean toggle to show/hide debug switch | 8 | - Added a boolean toggle to show/hide debug switch |
| 9 | - Fix iOS build when not using use_framework! | 9 | - Fix iOS build when not using use_framework! |
| 10 | +- Fix WidgetWraper | ||
| 10 | 11 | ||
| 11 | ## 5.2.1 | 12 | ## 5.2.1 |
| 12 | 13 |
| @@ -78,8 +78,18 @@ class WidgetWraper extends pw.ImageProvider { | @@ -78,8 +78,18 @@ class WidgetWraper extends pw.ImageProvider { | ||
| 78 | final wrappedWidget = | 78 | final wrappedWidget = |
| 79 | key.currentContext!.findRenderObject() as RenderRepaintBoundary; | 79 | key.currentContext!.findRenderObject() as RenderRepaintBoundary; |
| 80 | final image = await wrappedWidget.toImage(pixelRatio: pixelRatio); | 80 | final image = await wrappedWidget.toImage(pixelRatio: pixelRatio); |
| 81 | - final byteData = await (image.toByteData(format: ui.ImageByteFormat.rawRgba) | ||
| 82 | - as FutureOr<ByteData>); | 81 | + final byteData = await image.toByteData(format: ui.ImageByteFormat.rawRgba); |
| 82 | + | ||
| 83 | + if (byteData == null) { | ||
| 84 | + return WidgetWraper._( | ||
| 85 | + Uint8List(0), | ||
| 86 | + 0, | ||
| 87 | + 0, | ||
| 88 | + PdfImageOrientation.topLeft, | ||
| 89 | + dpi, | ||
| 90 | + ); | ||
| 91 | + } | ||
| 92 | + | ||
| 83 | final imageData = byteData.buffer.asUint8List(); | 93 | final imageData = byteData.buffer.asUint8List(); |
| 84 | return WidgetWraper._( | 94 | return WidgetWraper._( |
| 85 | imageData, | 95 | imageData, |
-
Please register or login to post a comment