From f23ea07f4488cda3a2a1160ca9481dcad6db763f Mon Sep 17 00:00:00 2001 From: faiyaz-shaikh <89002539+faiyaz-shaikh@users.noreply.github.com> Date: Wed, 15 Dec 2021 11:56:12 +0530 Subject: [PATCH] Fix bug #150 --- CHANGELOG.md | 1 + lib/src/layout_overlays.dart | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92cdeac8..b2bd9e5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## [1.1.5] - November 29, 2021 [Unreleased] - Fixed [#173](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/173) - showArrow not working +- Fixed [#179](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/179) - Add condition for determine state is active ## [1.1.4] - November 26, 2021 diff --git a/lib/src/layout_overlays.dart b/lib/src/layout_overlays.dart index 3418e04d..ade32d3f 100644 --- a/lib/src/layout_overlays.dart +++ b/lib/src/layout_overlays.dart @@ -167,12 +167,14 @@ class _OverlayBuilderState extends State { } void addToOverlay(OverlayEntry overlayEntry) async { - if (ShowCaseWidget.of(context)?.context != null && - Overlay.of(ShowCaseWidget.of(context)!.context) != null) { - Overlay.of(ShowCaseWidget.of(context)!.context)!.insert(overlayEntry); - } else { - if (Overlay.of(context) != null) { - Overlay.of(context)!.insert(overlayEntry); + if (mounted) { + if (ShowCaseWidget.of(context)?.context != null && + Overlay.of(ShowCaseWidget.of(context)!.context) != null) { + Overlay.of(ShowCaseWidget.of(context)!.context)!.insert(overlayEntry); + } else { + if (Overlay.of(context) != null) { + Overlay.of(context)!.insert(overlayEntry); + } } } }