From ea9045fa1e59905a2a05d4bf5dab508cb3ded127 Mon Sep 17 00:00:00 2001 From: hashirshoaeb Date: Mon, 12 Jul 2021 11:39:11 +0500 Subject: [PATCH] pixel ratio param added --- lib/screenshot.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/screenshot.dart b/lib/screenshot.dart index d859978..34b1885 100644 --- a/lib/screenshot.dart +++ b/lib/screenshot.dart @@ -87,7 +87,7 @@ class ScreenshotController { } Future 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; @@ -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);