Refactored logic and added comments
This commit is contained in:
@@ -351,8 +351,7 @@ class _RoundViewState extends State<RoundView> {
|
|||||||
final name = entry.value;
|
final name = entry.value;
|
||||||
return CupertinoActionSheetAction(
|
return CupertinoActionSheetAction(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_kamikazePlayerIndex =
|
_kamikazePlayerIndex = index;
|
||||||
_kamikazePlayerIndex == index ? null : index;
|
|
||||||
Navigator.pop(context, true);
|
Navigator.pop(context, true);
|
||||||
},
|
},
|
||||||
child: Text(name),
|
child: Text(name),
|
||||||
@@ -504,12 +503,19 @@ class _RoundViewState extends State<RoundView> {
|
|||||||
LocalStorageService.saveGameSessions();
|
LocalStorageService.saveGameSessions();
|
||||||
|
|
||||||
if (context.mounted) {
|
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);
|
Navigator.pop(context);
|
||||||
return;
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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.4.8+529
|
version: 0.4.9+529
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.5.4
|
sdk: ^3.5.4
|
||||||
|
|||||||
Reference in New Issue
Block a user