Merge pull request #141 from flixcoo/bug/139-cancel-button-triggers-confetti
Cancel button triggers confetti
This commit is contained in:
@@ -24,11 +24,19 @@ class ActiveGameView extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _ActiveGameViewState extends State<ActiveGameView> {
|
class _ActiveGameViewState extends State<ActiveGameView> {
|
||||||
|
/// Constant value to represent a press on the cancel button in round view.
|
||||||
|
static const int kRoundCancelled = -1;
|
||||||
|
|
||||||
final confettiController = ConfettiController(
|
final confettiController = ConfettiController(
|
||||||
duration: const Duration(seconds: 10),
|
duration: const Duration(seconds: 10),
|
||||||
);
|
);
|
||||||
|
|
||||||
late final GameSession gameSession;
|
late final GameSession gameSession;
|
||||||
|
|
||||||
|
/// A list of the ranks for each player corresponding to their index in sortedPlayerIndices
|
||||||
late List<int> denseRanks;
|
late List<int> denseRanks;
|
||||||
|
|
||||||
|
/// A list of player indices sorted by their scores in ascending order.
|
||||||
late List<int> sortedPlayerIndices;
|
late List<int> sortedPlayerIndices;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -453,6 +461,9 @@ class _ActiveGameViewState extends State<ActiveGameView> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// If the user presses the cancel button
|
||||||
|
if (round == kRoundCancelled) return;
|
||||||
|
|
||||||
if (widget.gameSession.isGameFinished && context.mounted) {
|
if (widget.gameSession.isGameFinished && context.mounted) {
|
||||||
_playFinishAnimation(context);
|
_playFinishAnimation(context);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class _RoundViewState extends State<RoundView> {
|
|||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
onPressed: () => {
|
onPressed: () => {
|
||||||
LocalStorageService.saveGameSessions(),
|
LocalStorageService.saveGameSessions(),
|
||||||
Navigator.pop(context)
|
Navigator.pop(context, -1)
|
||||||
},
|
},
|
||||||
child: Text(AppLocalizations.of(context).cancel),
|
child: Text(AppLocalizations.of(context).cancel),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -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.5.3+594
|
version: 0.5.3+595
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.5.4
|
sdk: ^3.5.4
|
||||||
|
|||||||
Reference in New Issue
Block a user