Fixed bug with no popup shown

This commit is contained in:
2025-07-21 13:05:22 +02:00
parent 9aaba18858
commit afa52488b0
4 changed files with 6 additions and 4 deletions

View File

@@ -69,7 +69,8 @@ class GameManager extends ChangeNotifier {
gameList[index].roundNumber--; gameList[index].roundNumber--;
gameList[index].isGameFinished = true; gameList[index].isGameFinished = true;
notifyListeners(); gameList[index].setWinner();
gameList[index].notifyListeners();
LocalStorageService.saveGameSessions(); LocalStorageService.saveGameSessions();
} }
} }

View File

@@ -255,7 +255,7 @@ class GameSession extends ChangeNotifier {
isGameFinished = true; isGameFinished = true;
print('${players[i]} hat die 100 Punkte ueberschritten, ' print('${players[i]} hat die 100 Punkte ueberschritten, '
'deswegen wurde das Spiel beendet'); 'deswegen wurde das Spiel beendet');
_setWinner(); setWinner();
} }
} }
} }
@@ -298,7 +298,7 @@ class GameSession extends ChangeNotifier {
/// Determines the winner of the game session. /// Determines the winner of the game session.
/// It iterates through the player scores and finds the player /// It iterates through the player scores and finds the player
/// with the lowest score. /// with the lowest score.
void _setWinner() { void setWinner() {
int minScore = playerScores.reduce((a, b) => a < b ? a : b); int minScore = playerScores.reduce((a, b) => a < b ? a : b);
List<String> lowestPlayers = []; List<String> lowestPlayers = [];
for (int i = 0; i < players.length; i++) { for (int i = 0; i < players.length; i++) {

View File

@@ -312,6 +312,7 @@ class _ActiveGameViewState extends State<ActiveGameView> {
onPressed: () { onPressed: () {
setState(() { setState(() {
gameManager.endGame(gameSession.id); gameManager.endGame(gameSession.id);
_playFinishAnimation(context);
}); });
Navigator.pop(context); Navigator.pop(context);
}, },

View File

@@ -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.5.3+589 version: 0.5.3+593
environment: environment:
sdk: ^3.5.4 sdk: ^3.5.4