diff --git a/lib/src/introduction_screen.dart b/lib/src/introduction_screen.dart index faf6c85..d689521 100644 --- a/lib/src/introduction_screen.dart +++ b/lib/src/introduction_screen.dart @@ -152,7 +152,9 @@ class IntroductionScreenState extends State { Future skipToEnd() async { setState(() => _isSkipPressed = true); await animateScroll(widget.pages.length - 1); - setState(() => _isSkipPressed = false); + if (mounted) { + setState(() => _isSkipPressed = false); + } } Future animateScroll(int page) async { @@ -162,7 +164,9 @@ class IntroductionScreenState extends State { duration: Duration(milliseconds: widget.animationDuration), curve: widget.curve, ); - setState(() => _isScrolling = false); + if (mounted) { + setState(() => _isScrolling = false); + } } bool _onScroll(ScrollNotification notification) {