From f0cfafd5e3678d71c1125a970742d1ff4e42bc3e Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Sat, 19 Jul 2025 17:40:34 +0200 Subject: [PATCH] Refactored logic and added comments --- lib/presentation/views/round_view.dart | 16 +++++++++++----- pubspec.yaml | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/presentation/views/round_view.dart b/lib/presentation/views/round_view.dart index 7d5739a..3d65d17 100644 --- a/lib/presentation/views/round_view.dart +++ b/lib/presentation/views/round_view.dart @@ -351,8 +351,7 @@ class _RoundViewState extends State { 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 { 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); } } diff --git a/pubspec.yaml b/pubspec.yaml index f1bf78c..d9cb654 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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