Unverified 提交 64e9a8e2 authored 作者: Sachin's avatar Sachin 提交者: GitHub

Merge pull request #59 from hashirshoaeb/master

pixel ratio param for captureFromWidget method
......@@ -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;
......@@ -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);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论