如何拍打Webview的屏幕截图?

时间:2019-05-30 09:34:12

标签: flutter dart

我正在使用RenderRepaintBoundary来截屏,但还是空白。

网络视图的代码。

class _CustomWebViewState extends State<CustomWebView> {

  final GlobalKey screen = GlobalKey();

  @override
  Widget build(BuildContext context) {
    super.build(context);

    return RepaintBoundary(
      key: screen,
      child: InAppWebView(),
    );
  }
}

屏幕截图的代码。

RenderRepaintBoundary boundary = screen.currentContext.findRenderObject();
ui.Image image = await boundary.toImage();

Flutter在执行boundary.toImage()时引发异常:

[VERBOSE-2:platform_view_layer.cc(19)] Trying to embed a platform view but the PrerollContext does not support embedding
[VERBOSE-2:platform_view_layer.cc(28)] Trying to embed a platform view but the PaintContext does not support embedding

我已经设置了Info.plist文件:

<key>io.flutter.embedded_views_preview</key>
<true/>

0 个答案:

没有答案