From accd3f977197478d4149e8dbf30b007716917887 Mon Sep 17 00:00:00 2001 From: Ashita Prasad <ashitaprasad92@gmail.com> Date: Fri, 6 Dec 2024 05:43:01 +0530 Subject: [PATCH] Show error message on import failure --- lib/screens/home_page/collection_pane.dart | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/screens/home_page/collection_pane.dart b/lib/screens/home_page/collection_pane.dart index 620182e8..3105a63a 100644 --- a/lib/screens/home_page/collection_pane.dart +++ b/lib/screens/home_page/collection_pane.dart @@ -47,6 +47,7 @@ class CollectionPane extends ConsumerWidget { }, onFileDropped: (file) { final importFormatType = ref.read(importFormatStateProvider); + String? msg; file.readAsString().then( (content) { kImporter @@ -57,17 +58,18 @@ class CollectionPane extends ConsumerWidget { .read(collectionStateNotifierProvider.notifier) .addRequestModel(importedRequestModel); } else { - // TODO: show in status bar - debugPrint("Unable to parse ${file.name}"); + msg = "Unable to parse ${file.name}"; } }); }, onError: (e) { - // TODO: show in status bar - debugPrint("Unable to import ${file.name}"); + msg = "Unable to import ${file.name}"; }, ); Navigator.of(context).pop(); + if (msg != null) { + showTextDialog(context, content: msg); + } }, ); },