Flutter/dart capture entire partially OFFSCREEN widget as image

与世无争的帅哥 提交于 2019-12-02 10:09:41

问题


Some comments on this answer suggest that it is possible to capture every pixel of a widget, even if it is partially offscreen. Comments in this answer suggest the opposite. I haven't been able to figure it out, I've only started messing with it today. Here's the code I have so far:

RenderRepaintBoundary boundary = globalKey.currentContext.findRenderObject();
ui.Image image = await boundary.toImage();
ByteData byteData = await image.toByteData(format: ui.ImageByteFormat.png);
Uint8List pngBytes = byteData.buffer.asUint8List();

Anyone know how to modify this so it will capture the full widget? Or does this only work with the portions of the widget that are on-screen?

来源:https://stackoverflow.com/questions/57583965/flutter-dart-capture-entire-partially-offscreen-widget-as-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!