Merge pull request #121 from flixcoo/feature/116-overview-of-points-won-lost-per-round
Overview of points won lost per round
This commit is contained in:
@@ -13,6 +13,10 @@ class CustomTheme {
|
|||||||
static const Color graphColor4 = Color(0xFF9C27B0);
|
static const Color graphColor4 = Color(0xFF9C27B0);
|
||||||
static final Color graphColor5 = primaryColor;
|
static final Color graphColor5 = primaryColor;
|
||||||
|
|
||||||
|
// Colors for PointsView
|
||||||
|
static Color pointLossColor = primaryColor;
|
||||||
|
static const Color pointGainColor = Color(0xFFF44336);
|
||||||
|
|
||||||
static TextStyle modeTitle = TextStyle(
|
static TextStyle modeTitle = TextStyle(
|
||||||
color: primaryColor,
|
color: primaryColor,
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
|
|||||||
@@ -92,7 +92,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
"end_game": "Spiel beenden",
|
"end_game": "Spiel beenden",
|
||||||
"delete_game": "Spiel löschen",
|
"delete_game": "Spiel löschen",
|
||||||
"new_game_same_settings": "Neues Spiel mit gleichen Einstellungen",
|
"new_game_same_settings": "Neues Spiel mit gleichen Einstellungen",
|
||||||
@@ -102,7 +101,9 @@
|
|||||||
"end_game_title": "Spiel beenden?",
|
"end_game_title": "Spiel beenden?",
|
||||||
"end_game_message": "Möchtest du das Spiel beenden? Das Spiel wird als beendet markiert und kann nicht fortgeführt werden.",
|
"end_game_message": "Möchtest du das Spiel beenden? Das Spiel wird als beendet markiert und kann nicht fortgeführt werden.",
|
||||||
|
|
||||||
"game_process": "Spielverlauf",
|
"statistics": "Statistiken",
|
||||||
|
"point_overview": "Punkteübersicht",
|
||||||
|
"scoring_history": "Spielverlauf",
|
||||||
"empty_graph_text": "Du musst mindestens eine Runde 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",
|
"settings": "Einstellungen",
|
||||||
|
|||||||
@@ -92,7 +92,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
"end_game": "End Game",
|
"end_game": "End Game",
|
||||||
"delete_game": "Delete Game",
|
"delete_game": "Delete Game",
|
||||||
"new_game_same_settings": "New Game with same Settings",
|
"new_game_same_settings": "New Game with same Settings",
|
||||||
@@ -102,7 +101,9 @@
|
|||||||
"end_game_title": "End the game?",
|
"end_game_title": "End the game?",
|
||||||
"end_game_message": "Do you want to end the game? The game gets marked as finished and cannot be continued.",
|
"end_game_message": "Do you want to end the game? The game gets marked as finished and cannot be continued.",
|
||||||
|
|
||||||
"game_process": "Scoring History",
|
"statistics": "Statistics",
|
||||||
|
"point_overview": "Point Overview",
|
||||||
|
"scoring_history": "Scoring History",
|
||||||
"empty_graph_text": "You must play at least one round 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",
|
"settings": "Settings",
|
||||||
|
|||||||
@@ -477,11 +477,23 @@ abstract class AppLocalizations {
|
|||||||
/// **'Möchtest du das Spiel beenden? Das Spiel wird als beendet markiert und kann nicht fortgeführt werden.'**
|
/// **'Möchtest du das Spiel beenden? Das Spiel wird als beendet markiert und kann nicht fortgeführt werden.'**
|
||||||
String get end_game_message;
|
String get end_game_message;
|
||||||
|
|
||||||
/// No description provided for @game_process.
|
/// No description provided for @statistics.
|
||||||
|
///
|
||||||
|
/// In de, this message translates to:
|
||||||
|
/// **'Statistiken'**
|
||||||
|
String get statistics;
|
||||||
|
|
||||||
|
/// No description provided for @point_overview.
|
||||||
|
///
|
||||||
|
/// In de, this message translates to:
|
||||||
|
/// **'Punkteübersicht'**
|
||||||
|
String get point_overview;
|
||||||
|
|
||||||
|
/// No description provided for @scoring_history.
|
||||||
///
|
///
|
||||||
/// In de, this message translates to:
|
/// In de, this message translates to:
|
||||||
/// **'Spielverlauf'**
|
/// **'Spielverlauf'**
|
||||||
String get game_process;
|
String get scoring_history;
|
||||||
|
|
||||||
/// No description provided for @empty_graph_text.
|
/// No description provided for @empty_graph_text.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -222,7 +222,13 @@ class AppLocalizationsDe extends AppLocalizations {
|
|||||||
'Möchtest du das Spiel beenden? Das Spiel wird als beendet markiert und kann nicht fortgeführt werden.';
|
'Möchtest du das Spiel beenden? Das Spiel wird als beendet markiert und kann nicht fortgeführt werden.';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get game_process => 'Spielverlauf';
|
String get statistics => 'Statistiken';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get point_overview => 'Punkteübersicht';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get scoring_history => 'Spielverlauf';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get empty_graph_text =>
|
String get empty_graph_text =>
|
||||||
|
|||||||
@@ -220,7 +220,13 @@ class AppLocalizationsEn extends AppLocalizations {
|
|||||||
'Do you want to end the game? The game gets marked as finished and cannot be continued.';
|
'Do you want to end the game? The game gets marked as finished and cannot be continued.';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get game_process => 'Scoring History';
|
String get statistics => 'Statistics';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get point_overview => 'Point Overview';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get scoring_history => 'Scoring History';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get empty_graph_text =>
|
String get empty_graph_text =>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'package:cabo_counter/data/game_session.dart';
|
|||||||
import 'package:cabo_counter/l10n/generated/app_localizations.dart';
|
import 'package:cabo_counter/l10n/generated/app_localizations.dart';
|
||||||
import 'package:cabo_counter/presentation/views/create_game_view.dart';
|
import 'package:cabo_counter/presentation/views/create_game_view.dart';
|
||||||
import 'package:cabo_counter/presentation/views/graph_view.dart';
|
import 'package:cabo_counter/presentation/views/graph_view.dart';
|
||||||
|
import 'package:cabo_counter/presentation/views/points_view.dart';
|
||||||
import 'package:cabo_counter/presentation/views/round_view.dart';
|
import 'package:cabo_counter/presentation/views/round_view.dart';
|
||||||
import 'package:cabo_counter/services/local_storage_service.dart';
|
import 'package:cabo_counter/services/local_storage_service.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
@@ -117,7 +118,7 @@ class _ActiveGameViewState extends State<ActiveGameView> {
|
|||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(10, 10, 0, 0),
|
padding: const EdgeInsets.fromLTRB(10, 10, 0, 0),
|
||||||
child: Text(
|
child: Text(
|
||||||
AppLocalizations.of(context).game,
|
AppLocalizations.of(context).statistics,
|
||||||
style: CustomTheme.rowTitle,
|
style: CustomTheme.rowTitle,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -125,7 +126,7 @@ class _ActiveGameViewState extends State<ActiveGameView> {
|
|||||||
children: [
|
children: [
|
||||||
CupertinoListTile(
|
CupertinoListTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
AppLocalizations.of(context).game_process,
|
AppLocalizations.of(context).scoring_history,
|
||||||
),
|
),
|
||||||
backgroundColorActivated:
|
backgroundColorActivated:
|
||||||
CustomTheme.backgroundColor,
|
CustomTheme.backgroundColor,
|
||||||
@@ -135,6 +136,29 @@ class _ActiveGameViewState extends State<ActiveGameView> {
|
|||||||
builder: (_) => GraphView(
|
builder: (_) => GraphView(
|
||||||
gameSession: gameSession,
|
gameSession: gameSession,
|
||||||
)))),
|
)))),
|
||||||
|
CupertinoListTile(
|
||||||
|
title: Text(
|
||||||
|
AppLocalizations.of(context).point_overview,
|
||||||
|
),
|
||||||
|
backgroundColorActivated:
|
||||||
|
CustomTheme.backgroundColor,
|
||||||
|
onTap: () => Navigator.push(
|
||||||
|
context,
|
||||||
|
CupertinoPageRoute(
|
||||||
|
builder: (_) => PointsView(
|
||||||
|
gameSession: gameSession,
|
||||||
|
)))),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(10, 10, 0, 0),
|
||||||
|
child: Text(
|
||||||
|
AppLocalizations.of(context).game,
|
||||||
|
style: CustomTheme.rowTitle,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: !gameSession.isPointsLimitEnabled,
|
visible: !gameSession.isPointsLimitEnabled,
|
||||||
child: CupertinoListTile(
|
child: CupertinoListTile(
|
||||||
|
|||||||
@@ -27,24 +27,36 @@ class _GraphViewState extends State<GraphView> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return CupertinoPageScaffold(
|
return CupertinoPageScaffold(
|
||||||
navigationBar: CupertinoNavigationBar(
|
navigationBar: CupertinoNavigationBar(
|
||||||
middle: Text(AppLocalizations.of(context).game_process),
|
middle: Text(AppLocalizations.of(context).scoring_history),
|
||||||
previousPageTitle: AppLocalizations.of(context).back,
|
previousPageTitle: AppLocalizations.of(context).back,
|
||||||
),
|
),
|
||||||
child: widget.gameSession.roundNumber > 1
|
child: widget.gameSession.roundNumber > 1
|
||||||
? Padding(
|
? Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(0, 100, 0, 0),
|
padding: const EdgeInsets.fromLTRB(0, 100, 0, 0),
|
||||||
child: SfCartesianChart(
|
child: SfCartesianChart(
|
||||||
|
enableAxisAnimation: true,
|
||||||
legend: const Legend(
|
legend: const Legend(
|
||||||
overflowMode: LegendItemOverflowMode.wrap,
|
overflowMode: LegendItemOverflowMode.wrap,
|
||||||
isVisible: true,
|
isVisible: true,
|
||||||
position: LegendPosition.bottom),
|
position: LegendPosition.bottom),
|
||||||
primaryXAxis: const NumericAxis(
|
primaryXAxis: const NumericAxis(
|
||||||
|
labelStyle: TextStyle(fontWeight: FontWeight.bold),
|
||||||
interval: 1,
|
interval: 1,
|
||||||
decimalPlaces: 0,
|
decimalPlaces: 0,
|
||||||
),
|
),
|
||||||
primaryYAxis: const NumericAxis(
|
primaryYAxis: NumericAxis(
|
||||||
|
labelStyle: const TextStyle(fontWeight: FontWeight.bold),
|
||||||
|
labelAlignment: LabelAlignment.center,
|
||||||
|
labelPosition: ChartDataLabelPosition.inside,
|
||||||
interval: 1,
|
interval: 1,
|
||||||
decimalPlaces: 0,
|
decimalPlaces: 0,
|
||||||
|
axisLabelFormatter: (AxisLabelRenderDetails details) {
|
||||||
|
if (details.value == 0) {
|
||||||
|
return ChartAxisLabel('', const TextStyle());
|
||||||
|
}
|
||||||
|
return ChartAxisLabel(
|
||||||
|
'${details.value.toInt()}', const TextStyle());
|
||||||
|
},
|
||||||
),
|
),
|
||||||
series: getCumulativeScores(),
|
series: getCumulativeScores(),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -118,8 +118,15 @@ class _MainMenuViewState extends State<MainMenuView> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: ListView.builder(
|
: ListView.separated(
|
||||||
itemCount: gameManager.gameList.length,
|
itemCount: gameManager.gameList.length,
|
||||||
|
separatorBuilder: (context, index) => Divider(
|
||||||
|
height: 1,
|
||||||
|
thickness: 0.5,
|
||||||
|
color: CustomTheme.white.withAlpha(50),
|
||||||
|
indent: 50,
|
||||||
|
endIndent: 50,
|
||||||
|
),
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final session = gameManager.gameList[index];
|
final session = gameManager.gameList[index];
|
||||||
return ListenableBuilder(
|
return ListenableBuilder(
|
||||||
|
|||||||
141
lib/presentation/views/points_view.dart
Normal file
141
lib/presentation/views/points_view.dart
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
import 'package:cabo_counter/core/custom_theme.dart';
|
||||||
|
import 'package:cabo_counter/data/game_session.dart';
|
||||||
|
import 'package:cabo_counter/l10n/generated/app_localizations.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class PointsView extends StatefulWidget {
|
||||||
|
final GameSession gameSession;
|
||||||
|
|
||||||
|
const PointsView({super.key, required this.gameSession});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<PointsView> createState() => _PointsViewState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PointsViewState extends State<PointsView> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return CupertinoPageScaffold(
|
||||||
|
navigationBar: CupertinoNavigationBar(
|
||||||
|
middle: Text(AppLocalizations.of(context).point_overview),
|
||||||
|
previousPageTitle: AppLocalizations.of(context).back,
|
||||||
|
),
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
padding: const EdgeInsets.fromLTRB(0, 100, 0, 0),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||||
|
child: DataTable(
|
||||||
|
dataRowMinHeight: 60,
|
||||||
|
dataRowMaxHeight: 60,
|
||||||
|
dividerThickness: 0.5,
|
||||||
|
columnSpacing: 20,
|
||||||
|
columns: [
|
||||||
|
const DataColumn(
|
||||||
|
numeric: true,
|
||||||
|
headingRowAlignment: MainAxisAlignment.center,
|
||||||
|
label: Text(
|
||||||
|
'#',
|
||||||
|
style: TextStyle(fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
columnWidth: IntrinsicColumnWidth(flex: 0.5)),
|
||||||
|
...widget.gameSession.players.map(
|
||||||
|
(player) => DataColumn(
|
||||||
|
label: FittedBox(
|
||||||
|
fit: BoxFit.fill,
|
||||||
|
child: Text(
|
||||||
|
player,
|
||||||
|
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||||
|
)),
|
||||||
|
headingRowAlignment: MainAxisAlignment.center,
|
||||||
|
columnWidth: const IntrinsicColumnWidth(flex: 1)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
rows: [
|
||||||
|
...List<DataRow>.generate(
|
||||||
|
widget.gameSession.roundList.length,
|
||||||
|
(roundIndex) {
|
||||||
|
final round = widget.gameSession.roundList[roundIndex];
|
||||||
|
return DataRow(
|
||||||
|
cells: [
|
||||||
|
DataCell(Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
'${roundIndex + 1}',
|
||||||
|
style: const TextStyle(fontSize: 20),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
...List.generate(widget.gameSession.players.length,
|
||||||
|
(playerIndex) {
|
||||||
|
final int score = round.scores[playerIndex];
|
||||||
|
final int update = round.scoreUpdates[playerIndex];
|
||||||
|
final bool saidCabo =
|
||||||
|
round.caboPlayerIndex == playerIndex;
|
||||||
|
return DataCell(
|
||||||
|
Center(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 6, vertical: 2),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: update <= 0
|
||||||
|
? CustomTheme.pointLossColor
|
||||||
|
: CustomTheme.pointGainColor,
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'${update >= 0 ? '+' : ''}$update',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: CupertinoColors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
Text('$score',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: saidCabo
|
||||||
|
? FontWeight.bold
|
||||||
|
: FontWeight.normal,
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
DataRow(
|
||||||
|
cells: [
|
||||||
|
const DataCell(Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
'Σ',
|
||||||
|
style:
|
||||||
|
TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
...widget.gameSession.playerScores.map(
|
||||||
|
(score) => DataCell(
|
||||||
|
Center(
|
||||||
|
child: Text(
|
||||||
|
'$score',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 20, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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.7+512
|
version: 0.4.8+525
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.5.4
|
sdk: ^3.5.4
|
||||||
|
|||||||
Reference in New Issue
Block a user