From 5c4acdb71641272a254ab734f5299d037f594535 Mon Sep 17 00:00:00 2001 From: Herwig Birke Date: Sun, 16 Nov 2025 23:05:40 +0100 Subject: [PATCH] Chart im Export --- lib/features/igel/presentation/igel_detail_screen.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/features/igel/presentation/igel_detail_screen.dart b/lib/features/igel/presentation/igel_detail_screen.dart index 7cfa956..aa8be1e 100644 --- a/lib/features/igel/presentation/igel_detail_screen.dart +++ b/lib/features/igel/presentation/igel_detail_screen.dart @@ -716,6 +716,11 @@ class _IgelDetailState extends ConsumerState { 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();