From 8d5ea0a14605ae33be3d878c00b94049612d1920 Mon Sep 17 00:00:00 2001 From: CodeDoctorDE Date: Tue, 12 Dec 2023 17:34:03 +0100 Subject: [PATCH] Fix exporting documents as png or svg --- app/lib/dialogs/export/image.dart | 5 +++-- app/lib/dialogs/export/svg.dart | 6 +++--- fastlane/metadata/android/en-US/changelogs/83.txt | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/lib/dialogs/export/image.dart b/app/lib/dialogs/export/image.dart index 1dbe6d504168..8e75d3b3a86e 100644 --- a/app/lib/dialogs/export/image.dart +++ b/app/lib/dialogs/export/image.dart @@ -145,7 +145,6 @@ class _ImageExportDialogState extends State { child: Text(AppLocalizations.of(context).export), onPressed: () async { final state = context.read().state; - Navigator.of(context).pop(); if (state is! DocumentLoadSuccess) { return; } @@ -153,7 +152,9 @@ class _ImageExportDialogState extends State { if (data == null) { return; } - exportImage(context, data.buffer.asUint8List()); + await exportImage( + context, data.buffer.asUint8List()); + if (mounted) Navigator.of(context).pop(); }, ), ], diff --git a/app/lib/dialogs/export/svg.dart b/app/lib/dialogs/export/svg.dart index 975f876d6a0e..85c34e0c2576 100644 --- a/app/lib/dialogs/export/svg.dart +++ b/app/lib/dialogs/export/svg.dart @@ -105,7 +105,7 @@ class _SvgExportDialogState extends State { ); if (!mounted) return; - exportSvg( + return exportSvg( context, data.toXmlString(), ); @@ -162,8 +162,8 @@ class _SvgExportDialogState extends State { ElevatedButton( child: Text(AppLocalizations.of(context).export), onPressed: () async { - Navigator.of(context).pop(); - _exportSvg(); + await _exportSvg(); + if (mounted) Navigator.of(context).pop(); }, ), ], diff --git a/fastlane/metadata/android/en-US/changelogs/83.txt b/fastlane/metadata/android/en-US/changelogs/83.txt index dfc00abebac5..5b49972c3518 100644 --- a/fastlane/metadata/android/en-US/changelogs/83.txt +++ b/fastlane/metadata/android/en-US/changelogs/83.txt @@ -1,4 +1,5 @@ * Improve performance when saving ([#547](https://github.com/LinwoodDev/Butterfly/issues/547)) * Fix calling onScale to tools on moving on touch devices ([#546](https://github.com/LinwoodDev/Butterfly/issues/546)) +* Fix exporting documents as png or svg View all changes in the blog: https://linwood.dev/butterfly/2.0.0-rc.2 \ No newline at end of file