Skip to content

Commit

Permalink
Merge pull request #59 from hashirshoaeb/master
Browse files Browse the repository at this point in the history
pixel ratio param for captureFromWidget method
  • Loading branch information
SachinGanesh authored Jul 12, 2021
2 parents 4dd2301 + ea9045f commit 64e9a8e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/screenshot.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class ScreenshotController {
}

Future<Uint8List> captureFromWidget(Widget widget,
{Duration delay: const Duration(milliseconds: 20)}) async {
{Duration delay: const Duration(milliseconds: 20), double? pixelRatio,}) async {
final RenderRepaintBoundary repaintBoundary = RenderRepaintBoundary();

Size logicalSize = ui.window.physicalSize / ui.window.devicePixelRatio;
Expand Down Expand Up @@ -132,7 +132,7 @@ class ScreenshotController {
pipelineOwner.flushPaint();

final ui.Image image = await repaintBoundary.toImage(
pixelRatio: imageSize.width / logicalSize.width);
pixelRatio: pixelRatio ?? (imageSize.width / logicalSize.width));
final ByteData? byteData =
await image.toByteData(format: ui.ImageByteFormat.png);

Expand Down

0 comments on commit 64e9a8e

Please sign in to comment.