Skip to content

Commit

Permalink
pixel ratio param added
Browse files Browse the repository at this point in the history
  • Loading branch information
hashirshoaeb committed Jul 12, 2021
1 parent 4dd2301 commit ea9045f
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 ea9045f

Please sign in to comment.