Skip to content

Commit

Permalink
Merge pull request #24 from Nolence/patch-1
Browse files Browse the repository at this point in the history
Check mounted status before calling setState
  • Loading branch information
Pyozer committed Jun 30, 2020
2 parents dcb7a21 + 4dad6e4 commit 77f1c2f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/src/introduction_screen.dart
Expand Up @@ -152,7 +152,9 @@ class IntroductionScreenState extends State<IntroductionScreen> {
Future<void> skipToEnd() async {
setState(() => _isSkipPressed = true);
await animateScroll(widget.pages.length - 1);
setState(() => _isSkipPressed = false);
if (mounted) {
setState(() => _isSkipPressed = false);
}
}

Future<void> animateScroll(int page) async {
Expand All @@ -162,7 +164,9 @@ class IntroductionScreenState extends State<IntroductionScreen> {
duration: Duration(milliseconds: widget.animationDuration),
curve: widget.curve,
);
setState(() => _isScrolling = false);
if (mounted) {
setState(() => _isScrolling = false);
}
}

bool _onScroll(ScrollNotification notification) {
Expand Down

0 comments on commit 77f1c2f

Please sign in to comment.