diff --git a/lib/presentation/views/round_view.dart b/lib/presentation/views/round_view.dart index fdf2b13..2d1f785 100644 --- a/lib/presentation/views/round_view.dart +++ b/lib/presentation/views/round_view.dart @@ -293,6 +293,7 @@ class _RoundViewState extends State { await _showBonusPopup(context, boni); } LocalStorageService.saveGameSessions(); + if (!context.mounted) return; Navigator.pop(context); } : null, @@ -307,9 +308,10 @@ class _RoundViewState extends State { await _showBonusPopup(context, boni); } LocalStorageService.saveGameSessions(); - if (widget.gameSession.isGameFinished) { + if (widget.gameSession.isGameFinished && + context.mounted) { Navigator.pop(context); - } else { + } else if (context.mounted) { Navigator.pop( context, widget.roundNumber + 1); } @@ -397,7 +399,7 @@ class _RoundViewState extends State { } /// Shows a popup dialog with the bonus information. - Future _showBonusPopup( + Future _showBonusPopup( BuildContext context, List bonusPlayers) async { print('Bonus Popup wird angezeigt'); int pointLimit = widget.gameSession.pointLimit; @@ -419,7 +421,6 @@ class _RoundViewState extends State { ], ), ); - return true; } /// Generates the message string for the bonus popup. diff --git a/pubspec.yaml b/pubspec.yaml index 4444d73..4d0b0f6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: cabo_counter description: "Mobile app for the card game Cabo" publish_to: 'none' -version: 0.4.5+492 +version: 0.4.5+493 environment: sdk: ^3.5.4