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:
@@ -69,6 +69,7 @@ class GameManager extends ChangeNotifier {
|
||||
|
||||
gameList[index].roundNumber--;
|
||||
gameList[index].isGameFinished = true;
|
||||
gameList[index].setWinner();
|
||||
notifyListeners();
|
||||
LocalStorageService.saveGameSessions();
|
||||
}
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
@@ -312,6 +312,7 @@ class _ActiveGameViewState extends State<ActiveGameView> {
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
gameManager.endGame(gameSession.id);
|
||||
_playFinishAnimation(context);
|
||||
});
|
||||
Navigator.pop(context);
|
||||
},
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user