Merge pull request #134 from flixcoo/bug/132-winner-popup-wont-show-on-unlimited-games-ending

Fixed bug with no popup shown
This commit is contained in:
2025-07-21 13:09:39 +02:00
committed by GitHub
4 changed files with 5 additions and 3 deletions

View File

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

View File

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

View File

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

View File

@@ -2,7 +2,7 @@ name: cabo_counter
description: "Mobile app for the card game Cabo"
publish_to: 'none'
version: 0.5.3+589
version: 0.5.3+593
environment:
sdk: ^3.5.4