Implemented mounted checks & changed return type
This commit is contained in:
@@ -293,6 +293,7 @@ class _RoundViewState extends State<RoundView> {
|
|||||||
await _showBonusPopup(context, boni);
|
await _showBonusPopup(context, boni);
|
||||||
}
|
}
|
||||||
LocalStorageService.saveGameSessions();
|
LocalStorageService.saveGameSessions();
|
||||||
|
if (!context.mounted) return;
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
@@ -307,9 +308,10 @@ class _RoundViewState extends State<RoundView> {
|
|||||||
await _showBonusPopup(context, boni);
|
await _showBonusPopup(context, boni);
|
||||||
}
|
}
|
||||||
LocalStorageService.saveGameSessions();
|
LocalStorageService.saveGameSessions();
|
||||||
if (widget.gameSession.isGameFinished) {
|
if (widget.gameSession.isGameFinished &&
|
||||||
|
context.mounted) {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
} else {
|
} else if (context.mounted) {
|
||||||
Navigator.pop(
|
Navigator.pop(
|
||||||
context, widget.roundNumber + 1);
|
context, widget.roundNumber + 1);
|
||||||
}
|
}
|
||||||
@@ -397,7 +399,7 @@ class _RoundViewState extends State<RoundView> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Shows a popup dialog with the bonus information.
|
/// Shows a popup dialog with the bonus information.
|
||||||
Future<bool> _showBonusPopup(
|
Future<void> _showBonusPopup(
|
||||||
BuildContext context, List<int> bonusPlayers) async {
|
BuildContext context, List<int> bonusPlayers) async {
|
||||||
print('Bonus Popup wird angezeigt');
|
print('Bonus Popup wird angezeigt');
|
||||||
int pointLimit = widget.gameSession.pointLimit;
|
int pointLimit = widget.gameSession.pointLimit;
|
||||||
@@ -419,7 +421,6 @@ class _RoundViewState extends State<RoundView> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generates the message string for the bonus popup.
|
/// Generates the message string for the bonus popup.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ name: cabo_counter
|
|||||||
description: "Mobile app for the card game Cabo"
|
description: "Mobile app for the card game Cabo"
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
version: 0.4.5+492
|
version: 0.4.5+493
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.5.4
|
sdk: ^3.5.4
|
||||||
|
|||||||
Reference in New Issue
Block a user