Chart im Export
This commit is contained in:
@@ -716,6 +716,11 @@ class _IgelDetailState extends ConsumerState<IgelDetailScreen> {
|
||||
if (ctx == null) return null;
|
||||
final boundary = ctx.findRenderObject() as RenderRepaintBoundary?;
|
||||
if (boundary == null) return null;
|
||||
// Ensure the chart has been painted before capturing, otherwise toImage can return empty.
|
||||
if (boundary.debugNeedsPaint) {
|
||||
await Future.delayed(Duration.zero);
|
||||
await WidgetsBinding.instance.endOfFrame;
|
||||
}
|
||||
final ui.Image img = await boundary.toImage(pixelRatio: 3);
|
||||
final byteData = await img.toByteData(format: ui.ImageByteFormat.png);
|
||||
return byteData?.buffer.asUint8List();
|
||||
|
||||
Reference in New Issue
Block a user