我正在使用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/>