Unverified 提交 17d956d2 authored 作者: Sachin's avatar Sachin 提交者: GitHub

Merge pull request #13 from gallinaettore/patch-1

Add method 'captureAsUiImage()'
......@@ -42,8 +42,27 @@ class ScreenshotController {
}
});
}
Future<ui.Image> captureAsUiImage({
double pixelRatio: 1,
Duration delay: const Duration(milliseconds: 20)
}) {
//Delay is required. See Issue https://github.com/flutter/flutter/issues/22308
return new Future.delayed(delay, () async {
try {
RenderRepaintBoundary boundary =
this._containerKey.currentContext.findRenderObject();
return await boundary.toImage(pixelRatio: pixelRatio);
} catch (Exception) {
throw (Exception);
}
});
}
}
class Screenshot<T> extends StatefulWidget {
final Widget child;
final ScreenshotController controller;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论