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