Implemented mounted checks & changed return type

This commit is contained in:
2025-07-14 10:09:12 +02:00
parent 0a0da96a3f
commit db6d4690cb
2 changed files with 6 additions and 5 deletions

View File

@@ -293,6 +293,7 @@ class _RoundViewState extends State<RoundView> {
await _showBonusPopup(context, boni);
}
LocalStorageService.saveGameSessions();
if (!context.mounted) return;
Navigator.pop(context);
}
: null,
@@ -307,9 +308,10 @@ class _RoundViewState extends State<RoundView> {
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<RoundView> {
}
/// Shows a popup dialog with the bonus information.
Future<bool> _showBonusPopup(
Future<void> _showBonusPopup(
BuildContext context, List<int> bonusPlayers) async {
print('Bonus Popup wird angezeigt');
int pointLimit = widget.gameSession.pointLimit;
@@ -419,7 +421,6 @@ class _RoundViewState extends State<RoundView> {
],
),
);
return true;
}
/// Generates the message string for the bonus popup.

View File

@@ -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