Merge pull request #98 from flixcoo/enhance/91-fixing-next-round-button-behaviour

Updated RoundView buttons when game is finished
This commit is contained in:
2025-07-11 11:53:49 +02:00
committed by GitHub
2 changed files with 23 additions and 16 deletions

View File

@@ -73,13 +73,19 @@ class _RoundViewState extends State<RoundView> {
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
navigationBar: CupertinoNavigationBar( navigationBar: CupertinoNavigationBar(
transitionBetweenRoutes: true, transitionBetweenRoutes: true,
middle: Text(AppLocalizations.of(context).results),
leading: CupertinoButton( leading: CupertinoButton(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
onPressed: () => onPressed: () =>
{LocalStorageService.saveGameSessions(), Navigator.pop(context)}, {LocalStorageService.saveGameSessions(), Navigator.pop(context)},
child: Text(AppLocalizations.of(context).cancel), child: Text(AppLocalizations.of(context).cancel),
), ),
middle: Text(AppLocalizations.of(context).results),
trailing: widget.gameSession.isGameFinished
? const Icon(
CupertinoIcons.lock,
size: 25,
)
: null,
), ),
child: Stack( child: Stack(
children: [ children: [
@@ -293,21 +299,22 @@ class _RoundViewState extends State<RoundView> {
: null, : null,
child: Text(AppLocalizations.of(context).done), child: Text(AppLocalizations.of(context).done),
), ),
CupertinoButton( if (!widget.gameSession.isGameFinished)
onPressed: _areRoundInputsValid() CupertinoButton(
? () { onPressed: _areRoundInputsValid()
_finishRound(); ? () {
LocalStorageService.saveGameSessions(); _finishRound();
if (widget.gameSession.isGameFinished == true) { LocalStorageService.saveGameSessions();
Navigator.pop(context); if (widget.gameSession.isGameFinished) {
} else { Navigator.pop(context);
Navigator.pop( } else {
context, widget.roundNumber + 1); Navigator.pop(
context, widget.roundNumber + 1);
}
} }
} : null,
: null, child: Text(AppLocalizations.of(context).next_round),
child: Text(AppLocalizations.of(context).next_round), ),
),
], ],
), ),
); );

View File

@@ -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.2+473 version: 0.4.3+476
environment: environment:
sdk: ^3.5.4 sdk: ^3.5.4