Merge pull request #102 from flixcoo/enhance/100-graph-enhancements
Graph Enhancements
This commit is contained in:
@@ -74,7 +74,6 @@
|
||||
"done": "Fertig",
|
||||
"next_round": "Nächste Runde",
|
||||
|
||||
"statistics": "Statistiken",
|
||||
"end_game": "Spiel beenden",
|
||||
"delete_game": "Spiel löschen",
|
||||
"new_game_same_settings": "Neues Spiel mit gleichen Einstellungen",
|
||||
@@ -85,7 +84,7 @@
|
||||
"end_game_message": "Möchtest du das Spiel beenden? Das Spiel wird als beendet markiert und kann nicht fortgeführt werden.",
|
||||
|
||||
"game_process": "Spielverlauf",
|
||||
"empty_graph_text": "Du musst mindestens zwei Runden spielen, damit der Graph des Spielverlaufes angezeigt werden kann.",
|
||||
"empty_graph_text": "Du musst mindestens eine Runde spielen, damit der Graph des Spielverlaufes angezeigt werden kann.",
|
||||
|
||||
"settings": "Einstellungen",
|
||||
"cabo_penalty": "Cabo-Strafe",
|
||||
|
||||
@@ -74,8 +74,6 @@
|
||||
"done": "Done",
|
||||
"next_round": "Next Round",
|
||||
|
||||
|
||||
"statistics": "Statistics",
|
||||
"end_game": "End Game",
|
||||
"delete_game": "Delete Game",
|
||||
"new_game_same_settings": "New Game with same Settings",
|
||||
@@ -86,7 +84,7 @@
|
||||
"end_game_message": "Do you want to end the game? The game gets marked as finished and cannot be continued.",
|
||||
|
||||
"game_process": "Scoring History",
|
||||
"empty_graph_text": "You must play at least two rounds for the game progress graph to be displayed.",
|
||||
"empty_graph_text": "You must play at least one round for the game progress graph to be displayed.",
|
||||
|
||||
"settings": "Settings",
|
||||
"cabo_penalty": "Cabo Penalty",
|
||||
|
||||
@@ -416,12 +416,6 @@ abstract class AppLocalizations {
|
||||
/// **'Nächste Runde'**
|
||||
String get next_round;
|
||||
|
||||
/// No description provided for @statistics.
|
||||
///
|
||||
/// In de, this message translates to:
|
||||
/// **'Statistiken'**
|
||||
String get statistics;
|
||||
|
||||
/// No description provided for @end_game.
|
||||
///
|
||||
/// In de, this message translates to:
|
||||
@@ -479,7 +473,7 @@ abstract class AppLocalizations {
|
||||
/// No description provided for @empty_graph_text.
|
||||
///
|
||||
/// In de, this message translates to:
|
||||
/// **'Du musst mindestens zwei Runden spielen, damit der Graph des Spielverlaufes angezeigt werden kann.'**
|
||||
/// **'Du musst mindestens eine Runde spielen, damit der Graph des Spielverlaufes angezeigt werden kann.'**
|
||||
String get empty_graph_text;
|
||||
|
||||
/// No description provided for @settings.
|
||||
|
||||
@@ -178,9 +178,6 @@ class AppLocalizationsDe extends AppLocalizations {
|
||||
@override
|
||||
String get next_round => 'Nächste Runde';
|
||||
|
||||
@override
|
||||
String get statistics => 'Statistiken';
|
||||
|
||||
@override
|
||||
String get end_game => 'Spiel beenden';
|
||||
|
||||
@@ -212,7 +209,7 @@ class AppLocalizationsDe extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get empty_graph_text =>
|
||||
'Du musst mindestens zwei Runden spielen, damit der Graph des Spielverlaufes angezeigt werden kann.';
|
||||
'Du musst mindestens eine Runde spielen, damit der Graph des Spielverlaufes angezeigt werden kann.';
|
||||
|
||||
@override
|
||||
String get settings => 'Einstellungen';
|
||||
|
||||
@@ -175,9 +175,6 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
@override
|
||||
String get next_round => 'Next Round';
|
||||
|
||||
@override
|
||||
String get statistics => 'Statistics';
|
||||
|
||||
@override
|
||||
String get end_game => 'End Game';
|
||||
|
||||
@@ -209,7 +206,7 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get empty_graph_text =>
|
||||
'You must play at least two rounds for the game progress graph to be displayed.';
|
||||
'You must play at least one round for the game progress graph to be displayed.';
|
||||
|
||||
@override
|
||||
String get settings => 'Settings';
|
||||
|
||||
@@ -121,7 +121,7 @@ class _ActiveGameViewState extends State<ActiveGameView> {
|
||||
children: [
|
||||
CupertinoListTile(
|
||||
title: Text(
|
||||
AppLocalizations.of(context).statistics,
|
||||
AppLocalizations.of(context).game_process,
|
||||
),
|
||||
backgroundColorActivated:
|
||||
CustomTheme.backgroundColor,
|
||||
@@ -131,8 +131,9 @@ class _ActiveGameViewState extends State<ActiveGameView> {
|
||||
builder: (_) => GraphView(
|
||||
gameSession: gameSession,
|
||||
)))),
|
||||
if (!gameSession.isPointsLimitEnabled)
|
||||
CupertinoListTile(
|
||||
Visibility(
|
||||
visible: !gameSession.isPointsLimitEnabled,
|
||||
child: CupertinoListTile(
|
||||
title: Text(
|
||||
AppLocalizations.of(context).end_game,
|
||||
style: gameSession.roundNumber > 1 &&
|
||||
@@ -148,6 +149,7 @@ class _ActiveGameViewState extends State<ActiveGameView> {
|
||||
_showEndGameDialog();
|
||||
}
|
||||
}),
|
||||
),
|
||||
CupertinoListTile(
|
||||
title: Text(
|
||||
AppLocalizations.of(context).delete_game,
|
||||
|
||||
@@ -30,17 +30,22 @@ class _GraphViewState extends State<GraphView> {
|
||||
middle: Text(AppLocalizations.of(context).game_process),
|
||||
previousPageTitle: AppLocalizations.of(context).back,
|
||||
),
|
||||
child: widget.gameSession.roundNumber > 2
|
||||
child: widget.gameSession.roundNumber > 1
|
||||
? Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 100, 0, 0),
|
||||
child: SfCartesianChart(
|
||||
legend: const Legend(
|
||||
isVisible: true, position: LegendPosition.bottom),
|
||||
overflowMode: LegendItemOverflowMode.wrap,
|
||||
isVisible: true,
|
||||
position: LegendPosition.bottom),
|
||||
primaryXAxis: const NumericAxis(
|
||||
interval: 1,
|
||||
decimalPlaces: 0,
|
||||
),
|
||||
primaryYAxis: const NumericAxis(),
|
||||
primaryYAxis: const NumericAxis(
|
||||
interval: 1,
|
||||
decimalPlaces: 0,
|
||||
),
|
||||
series: getCumulativeScores(),
|
||||
),
|
||||
)
|
||||
@@ -82,19 +87,21 @@ class _GraphViewState extends State<GraphView> {
|
||||
}
|
||||
}
|
||||
|
||||
const double jitterStep = 0.15;
|
||||
const double jitterStep = 0.03;
|
||||
|
||||
/// Create a list of LineSeries for each player
|
||||
/// Each series contains data points for each round
|
||||
return List.generate(playerCount, (i) {
|
||||
final data = List.generate(
|
||||
cumulativeScores[i].length,
|
||||
cumulativeScores[i].length + 1,
|
||||
(j) => (
|
||||
j + 1,
|
||||
j,
|
||||
j == 0 || cumulativeScores[i][j - 1] == 0
|
||||
? 0 // 0 points at the start of the game or when the value is 0 (don't subtract jitter step)
|
||||
|
||||
// Add a small jitter to the cumulative scores to prevent overlapping data points in the graph.
|
||||
// The jitter is centered around zero by subtracting playerCount ~/ 2 from the player index i.
|
||||
cumulativeScores[i][j] + (i - playerCount ~/ 2) * jitterStep
|
||||
// Adds a small jitter to the cumulative scores to prevent overlapping data points in the graph.
|
||||
// The jitter is centered around zero by subtracting playerCount ~/ 2 from the player index i.
|
||||
: cumulativeScores[i][j - 1] + (i - playerCount ~/ 2) * jitterStep
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ name: cabo_counter
|
||||
description: "Mobile app for the card game Cabo"
|
||||
publish_to: 'none'
|
||||
|
||||
version: 0.4.3+479
|
||||
version: 0.4.4+485
|
||||
|
||||
environment:
|
||||
sdk: ^3.5.4
|
||||
|
||||
Reference in New Issue
Block a user