Refactored logic and added comments

This commit is contained in:
2025-07-19 17:40:34 +02:00
parent 5b704d3937
commit f0cfafd5e3
2 changed files with 12 additions and 6 deletions

View File

@@ -351,8 +351,7 @@ class _RoundViewState extends State<RoundView> {
final name = entry.value;
return CupertinoActionSheetAction(
onPressed: () {
_kamikazePlayerIndex =
_kamikazePlayerIndex == index ? null : index;
_kamikazePlayerIndex = index;
Navigator.pop(context, true);
},
child: Text(name),
@@ -504,12 +503,19 @@ class _RoundViewState extends State<RoundView> {
LocalStorageService.saveGameSessions();
if (context.mounted) {
if (!navigateToNextRound || widget.gameSession.isGameFinished) {
// If the game is finished, pop the context and return to the previous screen.
if (widget.gameSession.isGameFinished) {
Navigator.pop(context);
return;
} else {
Navigator.pop(context, widget.roundNumber + 1);
}
// If navigateToNextRound is false, pop the context and return to the previous screen.
if (!navigateToNextRound) {
Navigator.pop(context);
return;
}
// If navigateToNextRound is true and the game isn't finished yet,
// pop the context and navigate to the next round.
Navigator.pop(context, widget.roundNumber + 1);
}
}

View File

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