David PHAM-VAN

Remove width and height parameters from wrapWidget helper

# Changelog
## 3.3.1
- Remove width and height parameters from wrapWidget helper
## 3.3.0
- Add wrapWidget helper
... ...
... ... @@ -35,44 +35,10 @@ Future<PdfImage> wrapWidget(
final RenderRepaintBoundary wrappedWidget =
key.currentContext.findRenderObject();
ui.Image image = await wrappedWidget.toImage(pixelRatio: pixelRatio);
image = await _resize(image, width, height);
final ui.Image image = await wrappedWidget.toImage(pixelRatio: pixelRatio);
final ByteData byteData =
await image.toByteData(format: ui.ImageByteFormat.rawRgba);
final Uint8List imageData = byteData.buffer.asUint8List();
return PdfImage(document,
image: imageData, width: image.width, height: image.height);
}
Future<ui.Image> _resize(
ui.Image image,
int width,
int height,
) async {
if (width == null && height == null) {
return image;
}
width ??= (height / image.height * image.width).toInt();
height ??= (width / image.width * image.height).toInt();
final Completer<ui.Image> ptr = Completer<ui.Image>();
final Uint8List data =
(await image.toByteData(format: ui.ImageByteFormat.rawRgba))
.buffer
.asUint8List();
ui.decodeImageFromPixels(
data,
image.width,
image.height,
ui.PixelFormat.rgba8888,
(ui.Image result) {
ptr.complete(result);
},
targetWidth: width,
targetHeight: height,
);
return ptr.future;
}
... ...
... ... @@ -4,7 +4,7 @@ description: Plugin that allows Flutter apps to generate and print documents to
homepage: https://github.com/DavBfr/dart_pdf/tree/master/printing
repository: https://github.com/DavBfr/dart_pdf
issue_tracker: https://github.com/DavBfr/dart_pdf/issues
version: 3.3.0
version: 3.3.1
environment:
sdk: ">=2.3.0 <3.0.0"
... ...