Compare commits
92 Commits
5db008c274
...
feature/88
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e2fe0c7d4d | ||
|
|
b72ab70e02 | ||
|
|
189daf76dd | ||
|
|
0f987f4c7a | ||
|
|
5dd8f31942 | ||
|
|
0394f5edf9 | ||
|
|
d8abad6fd8 | ||
|
|
7e6c309de0 | ||
|
|
3344575132 | ||
|
|
9b66e58dc0 | ||
|
|
56562b22bb | ||
| 906c8d8450 | |||
| 000bdc8cbc | |||
| 497f30421d | |||
| adedb85eb2 | |||
| 2a72332bcd | |||
| 7aa41abe61 | |||
| e1263d51ad | |||
| 8791b5296e | |||
| f2a4327166 | |||
| d34990ed50 | |||
| 2ef671884d | |||
| 2ef8eb6534 | |||
| 6f0e5ba5c2 | |||
| 1c07346aaf | |||
| 830a64b5dd | |||
| 9221f64fa5 | |||
| c4f6749882 | |||
| 14a043785e | |||
| 9eb9c0eb7f | |||
| 54ec865f04 | |||
| d5e7a17127 | |||
| 275f64b296 | |||
| 97ca62b083 | |||
| 32fb1550ff | |||
| d67972624e | |||
| 595cf6ead0 | |||
| 6faafe9fab | |||
| 66b90aac25 | |||
| d22855fc1a | |||
| 1be86bc3c5 | |||
| db3e8215fa | |||
| 2c4cef76d8 | |||
| a4ef9705f9 | |||
| 799c849570 | |||
| 644728a9df | |||
| afb7a5f1d4 | |||
| 3d510d5b3d | |||
| a9d2325eee | |||
| 349ff948de | |||
| c2394c3733 | |||
| 88766652b9 | |||
| 2a1573ee2d | |||
| cfb07bfe28 | |||
| d741990f2f | |||
| 76121eb4fb | |||
| d5ee6449b0 | |||
| 7d9757abb6 | |||
| d94d51c6ea | |||
|
|
803cf8a972 | ||
|
|
13be75a65b | ||
| aef12bd65a | |||
| 02d79574dd | |||
| fdd0e7579a | |||
| cd2770be26 | |||
| e196d6e5ef | |||
| bc3beac866 | |||
| aa936a938d | |||
| 2811ea892e | |||
| 4b1d3923a0 | |||
| 0f824bb30a | |||
| 21c74b74bc | |||
| 6e45e9435b | |||
| a78614851b | |||
| 8df9a27dc7 | |||
| 52180eeb6d | |||
| 0893667e41 | |||
| 1dc5286c6b | |||
|
|
f140ebae2e | ||
| a487e4071f | |||
|
|
99044c0ea0 | ||
| 69effa2b7d | |||
| feaa0709a7 | |||
|
|
2fea3597fe | ||
|
|
7b2314a25e | ||
|
|
7f6c1cb9a6 | ||
| 1a20d7b64c | |||
|
|
d9980edf0e | ||
|
|
4c084cae4a | ||
|
|
cecfd5da4e | ||
| 2f65316a51 | |||
|
|
4a67dae456 |
@@ -2,178 +2,103 @@
|
|||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"games": {
|
"players": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": [
|
"items": {
|
||||||
{
|
"type": "object",
|
||||||
"type": "object",
|
"properties": {
|
||||||
"properties": {
|
"id": {
|
||||||
"id": {
|
"type": "string"
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"createdAt": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"name": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"players": {
|
|
||||||
"type": [
|
|
||||||
"array",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"createdAt": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"name": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"id",
|
|
||||||
"createdAt",
|
|
||||||
"name"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"group": {
|
"createdAt": {
|
||||||
"type": [
|
"type": "string"
|
||||||
"object",
|
|
||||||
"null"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"createdAt": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"name": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"members": {
|
|
||||||
"type": "array",
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"createdAt": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"name": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"id",
|
|
||||||
"createdAt",
|
|
||||||
"name"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"id",
|
|
||||||
"createdAt",
|
|
||||||
"name",
|
|
||||||
"members"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"winner": {
|
"name": {
|
||||||
"type": ["object","null"]
|
"type": "string"
|
||||||
},
|
}
|
||||||
"required": [
|
},
|
||||||
"id",
|
"required": [
|
||||||
"createdAt",
|
"id",
|
||||||
"name"
|
"createdAt",
|
||||||
]
|
"name"
|
||||||
}
|
]
|
||||||
]
|
}
|
||||||
},
|
},
|
||||||
"groups": {
|
"groups": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": [
|
"items": {
|
||||||
{
|
"type": "object",
|
||||||
"type": "object",
|
"properties": {
|
||||||
"properties": {
|
"id": {
|
||||||
"id": {
|
"type": "string"
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"createdAt": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"name": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"members": {
|
|
||||||
"type": "array",
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"createdAt": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"name": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"id",
|
|
||||||
"createdAt",
|
|
||||||
"name"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"required": [
|
"name": {
|
||||||
"id",
|
"type": "string"
|
||||||
"createdAt",
|
},
|
||||||
"name",
|
"createdAt": {
|
||||||
"members"
|
"type": "string"
|
||||||
]
|
},
|
||||||
}
|
"memberIds": {
|
||||||
]
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"id",
|
||||||
|
"name",
|
||||||
|
"createdAt",
|
||||||
|
"memberIds"
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"players": {
|
"matches": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": [
|
"items": {
|
||||||
{
|
"type": "object",
|
||||||
"type": [
|
"properties": {
|
||||||
"object",
|
"id": {
|
||||||
"null"
|
"type": "string"
|
||||||
],
|
},
|
||||||
"properties": {
|
"name": {
|
||||||
"id": {
|
"type": "string"
|
||||||
"type": "string"
|
},
|
||||||
},
|
"createdAt": {
|
||||||
"createdAt": {
|
"type": "string"
|
||||||
"type": "string"
|
},
|
||||||
},
|
"groupId": {
|
||||||
"name": {
|
"anyOf": [
|
||||||
|
{"type": "string"},
|
||||||
|
{"type": "null"}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"playerIds": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"winnerId": {
|
||||||
"id",
|
"anyOf": [
|
||||||
"createdAt",
|
{"type": "string"},
|
||||||
"name"
|
{"type": "null"}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
},
|
||||||
|
"required": [
|
||||||
|
"id",
|
||||||
|
"name",
|
||||||
|
"createdAt",
|
||||||
|
"groupId",
|
||||||
|
"playerIds"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
"required": [
|
||||||
|
"players",
|
||||||
|
"groups",
|
||||||
|
"matches"
|
||||||
|
]
|
||||||
|
}
|
||||||
19
lib/core/adaptive_page_route.dart
Normal file
19
lib/core/adaptive_page_route.dart
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
Route<T> adaptivePageRoute<T>({
|
||||||
|
required Widget Function(BuildContext) builder,
|
||||||
|
bool fullscreenDialog = false,
|
||||||
|
}) {
|
||||||
|
if (Platform.isIOS) {
|
||||||
|
return CupertinoPageRoute<T>(
|
||||||
|
builder: builder,
|
||||||
|
fullscreenDialog: fullscreenDialog,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return MaterialPageRoute<T>(
|
||||||
|
builder: builder,
|
||||||
|
fullscreenDialog: fullscreenDialog,
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,2 +1,6 @@
|
|||||||
/// Minimum duration of all app skeletons
|
class Constants {
|
||||||
Duration minimumSkeletonDuration = const Duration(milliseconds: 250);
|
Constants._(); // Private constructor to prevent instantiation
|
||||||
|
|
||||||
|
/// Minimum duration of all app skeletons
|
||||||
|
static Duration minimumSkeletonDuration = const Duration(milliseconds: 250);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,35 +1,59 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class CustomTheme {
|
class CustomTheme {
|
||||||
|
CustomTheme._(); // Private constructor to prevent instantiation
|
||||||
|
|
||||||
|
// ==================== Colors ====================
|
||||||
static Color primaryColor = const Color(0xFF7505E4);
|
static Color primaryColor = const Color(0xFF7505E4);
|
||||||
static Color secondaryColor = const Color(0xFFAFA2FF);
|
static Color secondaryColor = const Color(0xFFAFA2FF);
|
||||||
static Color backgroundColor = const Color(0xFF0B0B0B);
|
static Color backgroundColor = const Color(0xFF0B0B0B);
|
||||||
static Color boxColor = const Color(0xFF101010);
|
static Color boxColor = const Color(0xFF101010);
|
||||||
static Color onBoxColor = const Color(0xFF181818);
|
static Color onBoxColor = const Color(0xFF181818);
|
||||||
static Color boxBorder = const Color(0xFF272727);
|
static Color boxBorder = const Color(0xFF272727);
|
||||||
|
static const Color textColor = Colors.white;
|
||||||
|
|
||||||
|
// ==================== Border Radius ====================
|
||||||
|
static const double standardBorderRadius = 12.0;
|
||||||
|
static BorderRadius get standardBorderRadiusAll =>
|
||||||
|
BorderRadius.circular(standardBorderRadius);
|
||||||
|
|
||||||
|
// ==================== Padding & Margins ====================
|
||||||
|
static const EdgeInsets standardMargin = EdgeInsets.symmetric(
|
||||||
|
horizontal: 12,
|
||||||
|
vertical: 10,
|
||||||
|
);
|
||||||
|
static const EdgeInsets tileMargin = EdgeInsets.symmetric(
|
||||||
|
horizontal: 12,
|
||||||
|
vertical: 5,
|
||||||
|
);
|
||||||
|
|
||||||
|
// ==================== Decorations ====================
|
||||||
static BoxDecoration standardBoxDecoration = BoxDecoration(
|
static BoxDecoration standardBoxDecoration = BoxDecoration(
|
||||||
color: boxColor,
|
color: boxColor,
|
||||||
border: Border.all(color: boxBorder),
|
border: Border.all(color: boxBorder),
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: standardBorderRadiusAll,
|
||||||
);
|
);
|
||||||
|
|
||||||
static BoxDecoration highlightedBoxDecoration = BoxDecoration(
|
static BoxDecoration highlightedBoxDecoration = BoxDecoration(
|
||||||
color: boxColor,
|
color: boxColor,
|
||||||
border: Border.all(color: primaryColor),
|
border: Border.all(color: primaryColor),
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: standardBorderRadiusAll,
|
||||||
boxShadow: [BoxShadow(color: primaryColor.withAlpha(120), blurRadius: 12)],
|
boxShadow: [BoxShadow(color: primaryColor.withAlpha(120), blurRadius: 12)],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// ==================== App Bar Theme ====================
|
||||||
static AppBarTheme appBarTheme = AppBarTheme(
|
static AppBarTheme appBarTheme = AppBarTheme(
|
||||||
backgroundColor: backgroundColor,
|
backgroundColor: backgroundColor,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: textColor,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
|
scrolledUnderElevation: 0,
|
||||||
|
centerTitle: true,
|
||||||
titleTextStyle: const TextStyle(
|
titleTextStyle: const TextStyle(
|
||||||
color: Colors.white,
|
color: textColor,
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
iconTheme: const IconThemeData(color: Colors.white),
|
iconTheme: const IconThemeData(color: textColor),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
||||||
|
|
||||||
/// Button types used for styling the [CustomWidthButton]
|
/// Button types used for styling the [CustomWidthButton]
|
||||||
|
/// - [ButtonType.primary]: Primary button style.
|
||||||
|
/// - [ButtonType.secondary]: Secondary button style.
|
||||||
|
/// - [ButtonType.tertiary]: Tertiary button style.
|
||||||
enum ButtonType { primary, secondary, tertiary }
|
enum ButtonType { primary, secondary, tertiary }
|
||||||
|
|
||||||
/// Result types for import operations in the [SettingsView]
|
/// Result types for import operations in the [SettingsView]
|
||||||
|
|||||||
@@ -95,6 +95,8 @@ class GroupDao extends DatabaseAccessor<AppDatabase> with _$GroupDaoMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Insert unique groups in batch
|
// Insert unique groups in batch
|
||||||
|
// Using insertOrIgnore to avoid triggering cascade deletes on
|
||||||
|
// player_group associations when groups already exist
|
||||||
await db.batch(
|
await db.batch(
|
||||||
(b) => b.insertAll(
|
(b) => b.insertAll(
|
||||||
groupTable,
|
groupTable,
|
||||||
@@ -107,7 +109,7 @@ class GroupDao extends DatabaseAccessor<AppDatabase> with _$GroupDaoMixin {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
mode: InsertMode.insertOrReplace,
|
mode: InsertMode.insertOrIgnore,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -120,6 +122,8 @@ class GroupDao extends DatabaseAccessor<AppDatabase> with _$GroupDaoMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (uniquePlayers.isNotEmpty) {
|
if (uniquePlayers.isNotEmpty) {
|
||||||
|
// Using insertOrIgnore to avoid triggering cascade deletes on
|
||||||
|
// player_group associations when players already exist
|
||||||
await db.batch(
|
await db.batch(
|
||||||
(b) => b.insertAll(
|
(b) => b.insertAll(
|
||||||
db.playerTable,
|
db.playerTable,
|
||||||
@@ -132,7 +136,7 @@ class GroupDao extends DatabaseAccessor<AppDatabase> with _$GroupDaoMixin {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
mode: InsertMode.insertOrReplace,
|
mode: InsertMode.insertOrIgnore,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,98 +0,0 @@
|
|||||||
import 'package:drift/drift.dart';
|
|
||||||
import 'package:game_tracker/data/db/database.dart';
|
|
||||||
import 'package:game_tracker/data/db/tables/group_match_table.dart';
|
|
||||||
import 'package:game_tracker/data/dto/group.dart';
|
|
||||||
|
|
||||||
part 'group_match_dao.g.dart';
|
|
||||||
|
|
||||||
@DriftAccessor(tables: [GroupMatchTable])
|
|
||||||
class GroupMatchDao extends DatabaseAccessor<AppDatabase>
|
|
||||||
with _$GroupMatchDaoMixin {
|
|
||||||
GroupMatchDao(super.db);
|
|
||||||
|
|
||||||
/// Associates a group with a match by inserting a record into the
|
|
||||||
/// [GroupMatchTable].
|
|
||||||
Future<void> addGroupToMatch({
|
|
||||||
required String matchId,
|
|
||||||
required String groupId,
|
|
||||||
}) async {
|
|
||||||
if (await matchHasGroup(matchId: matchId)) {
|
|
||||||
throw Exception('Match already has a group');
|
|
||||||
}
|
|
||||||
await into(groupMatchTable).insert(
|
|
||||||
GroupMatchTableCompanion.insert(groupId: groupId, matchId: matchId),
|
|
||||||
mode: InsertMode.insertOrIgnore,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Retrieves the [Group] associated with the given [matchId].
|
|
||||||
/// Returns `null` if no group is found.
|
|
||||||
Future<Group?> getGroupOfMatch({required String matchId}) async {
|
|
||||||
final result = await (select(
|
|
||||||
groupMatchTable,
|
|
||||||
)..where((g) => g.matchId.equals(matchId))).getSingleOrNull();
|
|
||||||
|
|
||||||
if (result == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
final group = await db.groupDao.getGroupById(groupId: result.groupId);
|
|
||||||
return group;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Checks if there is a group associated with the given [matchId].
|
|
||||||
/// Returns `true` if there is a group, otherwise `false`.
|
|
||||||
Future<bool> matchHasGroup({required String matchId}) async {
|
|
||||||
final count =
|
|
||||||
await (selectOnly(groupMatchTable)
|
|
||||||
..where(groupMatchTable.matchId.equals(matchId))
|
|
||||||
..addColumns([groupMatchTable.groupId.count()]))
|
|
||||||
.map((row) => row.read(groupMatchTable.groupId.count()))
|
|
||||||
.getSingle();
|
|
||||||
return (count ?? 0) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Checks if a specific group is associated with a specific match.
|
|
||||||
/// Returns `true` if the group is in the match, otherwise `false`.
|
|
||||||
Future<bool> isGroupInMatch({
|
|
||||||
required String matchId,
|
|
||||||
required String groupId,
|
|
||||||
}) async {
|
|
||||||
final count =
|
|
||||||
await (selectOnly(groupMatchTable)
|
|
||||||
..where(
|
|
||||||
groupMatchTable.matchId.equals(matchId) &
|
|
||||||
groupMatchTable.groupId.equals(groupId),
|
|
||||||
)
|
|
||||||
..addColumns([groupMatchTable.groupId.count()]))
|
|
||||||
.map((row) => row.read(groupMatchTable.groupId.count()))
|
|
||||||
.getSingle();
|
|
||||||
return (count ?? 0) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Removes the association of a group from a match based on [groupId] and
|
|
||||||
/// [matchId].
|
|
||||||
/// Returns `true` if more than 0 rows were affected, otherwise `false`.
|
|
||||||
Future<bool> removeGroupFromMatch({
|
|
||||||
required String matchId,
|
|
||||||
required String groupId,
|
|
||||||
}) async {
|
|
||||||
final query = delete(groupMatchTable)
|
|
||||||
..where((g) => g.matchId.equals(matchId) & g.groupId.equals(groupId));
|
|
||||||
final rowsAffected = await query.go();
|
|
||||||
return rowsAffected > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Updates the group associated with a match to [newGroupId] based on
|
|
||||||
/// [matchId].
|
|
||||||
/// Returns `true` if more than 0 rows were affected, otherwise `false`.
|
|
||||||
Future<bool> updateGroupOfMatch({
|
|
||||||
required String matchId,
|
|
||||||
required String newGroupId,
|
|
||||||
}) async {
|
|
||||||
final updatedRows =
|
|
||||||
await (update(groupMatchTable)..where((g) => g.matchId.equals(matchId)))
|
|
||||||
.write(GroupMatchTableCompanion(groupId: Value(newGroupId)));
|
|
||||||
return updatedRows > 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
|
|
||||||
part of 'group_match_dao.dart';
|
|
||||||
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
mixin _$GroupMatchDaoMixin on DatabaseAccessor<AppDatabase> {
|
|
||||||
$GroupTableTable get groupTable => attachedDatabase.groupTable;
|
|
||||||
$MatchTableTable get matchTable => attachedDatabase.matchTable;
|
|
||||||
$GroupMatchTableTable get groupMatchTable => attachedDatabase.groupMatchTable;
|
|
||||||
}
|
|
||||||
@@ -124,6 +124,8 @@ class MatchDao extends DatabaseAccessor<AppDatabase> with _$MatchDaoMixin {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Add all groups of the matches in batch
|
// Add all groups of the matches in batch
|
||||||
|
// Using insertOrIgnore to avoid overwriting existing groups (which would
|
||||||
|
// trigger cascade deletes on player_group associations)
|
||||||
await db.batch(
|
await db.batch(
|
||||||
(b) => b.insertAll(
|
(b) => b.insertAll(
|
||||||
db.groupTable,
|
db.groupTable,
|
||||||
@@ -137,7 +139,7 @@ class MatchDao extends DatabaseAccessor<AppDatabase> with _$MatchDaoMixin {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
mode: InsertMode.insertOrReplace,
|
mode: InsertMode.insertOrIgnore,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -158,6 +160,8 @@ class MatchDao extends DatabaseAccessor<AppDatabase> with _$MatchDaoMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (uniquePlayers.isNotEmpty) {
|
if (uniquePlayers.isNotEmpty) {
|
||||||
|
// Using insertOrIgnore to avoid triggering cascade deletes on
|
||||||
|
// player_group/player_match associations when players already exist
|
||||||
await db.batch(
|
await db.batch(
|
||||||
(b) => b.insertAll(
|
(b) => b.insertAll(
|
||||||
db.playerTable,
|
db.playerTable,
|
||||||
@@ -170,7 +174,7 @@ class MatchDao extends DatabaseAccessor<AppDatabase> with _$MatchDaoMixin {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
mode: InsertMode.insertOrReplace,
|
mode: InsertMode.insertOrIgnore,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ class PlayerDao extends DatabaseAccessor<AppDatabase> with _$PlayerDaoMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Adds multiple [players] to the database in a batch operation.
|
/// Adds multiple [players] to the database in a batch operation.
|
||||||
|
/// Uses insertOrIgnore to avoid triggering cascade deletes on
|
||||||
|
/// player_group associations when players already exist.
|
||||||
Future<bool> addPlayersAsList({required List<Player> players}) async {
|
Future<bool> addPlayersAsList({required List<Player> players}) async {
|
||||||
if (players.isEmpty) return false;
|
if (players.isEmpty) return false;
|
||||||
|
|
||||||
@@ -65,7 +67,7 @@ class PlayerDao extends DatabaseAccessor<AppDatabase> with _$PlayerDaoMixin {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
mode: InsertMode.insertOrReplace,
|
mode: InsertMode.insertOrIgnore,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
import 'package:drift/drift.dart';
|
import 'package:drift/drift.dart';
|
||||||
import 'package:drift_flutter/drift_flutter.dart';
|
import 'package:drift_flutter/drift_flutter.dart';
|
||||||
import 'package:game_tracker/data/dao/group_dao.dart';
|
import 'package:game_tracker/data/dao/group_dao.dart';
|
||||||
import 'package:game_tracker/data/dao/group_match_dao.dart';
|
|
||||||
import 'package:game_tracker/data/dao/match_dao.dart';
|
import 'package:game_tracker/data/dao/match_dao.dart';
|
||||||
import 'package:game_tracker/data/dao/player_dao.dart';
|
import 'package:game_tracker/data/dao/player_dao.dart';
|
||||||
import 'package:game_tracker/data/dao/player_group_dao.dart';
|
import 'package:game_tracker/data/dao/player_group_dao.dart';
|
||||||
import 'package:game_tracker/data/dao/player_match_dao.dart';
|
import 'package:game_tracker/data/dao/player_match_dao.dart';
|
||||||
import 'package:game_tracker/data/db/tables/group_match_table.dart';
|
|
||||||
import 'package:game_tracker/data/db/tables/group_table.dart';
|
import 'package:game_tracker/data/db/tables/group_table.dart';
|
||||||
import 'package:game_tracker/data/db/tables/match_table.dart';
|
import 'package:game_tracker/data/db/tables/match_table.dart';
|
||||||
import 'package:game_tracker/data/db/tables/player_group_table.dart';
|
import 'package:game_tracker/data/db/tables/player_group_table.dart';
|
||||||
@@ -22,16 +20,14 @@ part 'database.g.dart';
|
|||||||
GroupTable,
|
GroupTable,
|
||||||
MatchTable,
|
MatchTable,
|
||||||
PlayerGroupTable,
|
PlayerGroupTable,
|
||||||
PlayerMatchTable,
|
PlayerMatchTable
|
||||||
GroupMatchTable,
|
|
||||||
],
|
],
|
||||||
daos: [
|
daos: [
|
||||||
PlayerDao,
|
PlayerDao,
|
||||||
GroupDao,
|
GroupDao,
|
||||||
MatchDao,
|
MatchDao,
|
||||||
PlayerGroupDao,
|
PlayerGroupDao,
|
||||||
PlayerMatchDao,
|
PlayerMatchDao
|
||||||
GroupMatchDao,
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
class AppDatabase extends _$AppDatabase {
|
class AppDatabase extends _$AppDatabase {
|
||||||
|
|||||||
14
lib/data/db/tables/game_table.dart
Normal file
14
lib/data/db/tables/game_table.dart
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import 'package:drift/drift.dart';
|
||||||
|
|
||||||
|
class GameTable extends Table {
|
||||||
|
TextColumn get id => text()();
|
||||||
|
TextColumn get name => text()();
|
||||||
|
TextColumn get ruleset => text()();
|
||||||
|
TextColumn get description => text().nullable()();
|
||||||
|
TextColumn get color => text().nullable()();
|
||||||
|
TextColumn get icon => text().nullable()();
|
||||||
|
DateTimeColumn get createdAt => dateTime()();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Set<Column<Object>> get primaryKey => {id};
|
||||||
|
}
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
import 'package:drift/drift.dart';
|
|
||||||
import 'package:game_tracker/data/db/tables/group_table.dart';
|
|
||||||
import 'package:game_tracker/data/db/tables/match_table.dart';
|
|
||||||
|
|
||||||
class GroupMatchTable extends Table {
|
|
||||||
TextColumn get groupId =>
|
|
||||||
text().references(GroupTable, #id, onDelete: KeyAction.cascade)();
|
|
||||||
TextColumn get matchId =>
|
|
||||||
text().references(MatchTable, #id, onDelete: KeyAction.cascade)();
|
|
||||||
|
|
||||||
@override
|
|
||||||
Set<Column<Object>> get primaryKey => {groupId, matchId};
|
|
||||||
}
|
|
||||||
@@ -3,6 +3,7 @@ import 'package:drift/drift.dart';
|
|||||||
class GroupTable extends Table {
|
class GroupTable extends Table {
|
||||||
TextColumn get id => text()();
|
TextColumn get id => text()();
|
||||||
TextColumn get name => text()();
|
TextColumn get name => text()();
|
||||||
|
TextColumn get description => text().nullable()();
|
||||||
DateTimeColumn get createdAt => dateTime()();
|
DateTimeColumn get createdAt => dateTime()();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -1,11 +1,17 @@
|
|||||||
import 'package:drift/drift.dart';
|
import 'package:drift/drift.dart';
|
||||||
|
import 'package:game_tracker/data/db/tables/game_table.dart';
|
||||||
|
import 'package:game_tracker/data/db/tables/group_table.dart';
|
||||||
|
|
||||||
class MatchTable extends Table {
|
class MatchTable extends Table {
|
||||||
TextColumn get id => text()();
|
TextColumn get id => text()();
|
||||||
TextColumn get name => text()();
|
TextColumn get gameId =>
|
||||||
late final winnerId = text().nullable()();
|
text().references(GameTable, #id, onDelete: KeyAction.cascade)();
|
||||||
|
TextColumn get groupId =>
|
||||||
|
text().references(GroupTable, #id, onDelete: KeyAction.cascade).nullable()(); // Nullable if not part of a group
|
||||||
|
TextColumn get name => text().nullable()();
|
||||||
|
TextColumn get notes => text().nullable()();
|
||||||
DateTimeColumn get createdAt => dateTime()();
|
DateTimeColumn get createdAt => dateTime()();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Set<Column<Object>> get primaryKey => {id};
|
Set<Column<Object>> get primaryKey => {id};
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,16 @@
|
|||||||
import 'package:drift/drift.dart';
|
import 'package:drift/drift.dart';
|
||||||
import 'package:game_tracker/data/db/tables/match_table.dart';
|
import 'package:game_tracker/data/db/tables/match_table.dart';
|
||||||
import 'package:game_tracker/data/db/tables/player_table.dart';
|
import 'package:game_tracker/data/db/tables/player_table.dart';
|
||||||
|
import 'package:game_tracker/data/db/tables/team_table.dart';
|
||||||
|
|
||||||
class PlayerMatchTable extends Table {
|
class PlayerMatchTable extends Table {
|
||||||
TextColumn get playerId =>
|
TextColumn get playerId =>
|
||||||
text().references(PlayerTable, #id, onDelete: KeyAction.cascade)();
|
text().references(PlayerTable, #id, onDelete: KeyAction.cascade)();
|
||||||
TextColumn get matchId =>
|
TextColumn get matchId =>
|
||||||
text().references(MatchTable, #id, onDelete: KeyAction.cascade)();
|
text().references(MatchTable, #id, onDelete: KeyAction.cascade)();
|
||||||
|
TextColumn get teamId =>
|
||||||
|
text().references(TeamTable, #id).nullable()();
|
||||||
|
IntColumn get score => integer()();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Set<Column<Object>> get primaryKey => {playerId, matchId};
|
Set<Column<Object>> get primaryKey => {playerId, matchId};
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'package:drift/drift.dart';
|
|||||||
class PlayerTable extends Table {
|
class PlayerTable extends Table {
|
||||||
TextColumn get id => text()();
|
TextColumn get id => text()();
|
||||||
TextColumn get name => text()();
|
TextColumn get name => text()();
|
||||||
|
TextColumn get description => text().nullable()();
|
||||||
DateTimeColumn get createdAt => dateTime()();
|
DateTimeColumn get createdAt => dateTime()();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
16
lib/data/db/tables/score_table.dart
Normal file
16
lib/data/db/tables/score_table.dart
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import 'package:drift/drift.dart';
|
||||||
|
import 'package:game_tracker/data/db/tables/match_table.dart';
|
||||||
|
import 'package:game_tracker/data/db/tables/player_table.dart';
|
||||||
|
|
||||||
|
class ScoreTable extends Table {
|
||||||
|
TextColumn get playerId =>
|
||||||
|
text().references(PlayerTable, #id, onDelete: KeyAction.cascade)();
|
||||||
|
TextColumn get matchId =>
|
||||||
|
text().references(MatchTable, #id, onDelete: KeyAction.cascade)();
|
||||||
|
IntColumn get roundNumber => integer()();
|
||||||
|
IntColumn get score => integer()();
|
||||||
|
IntColumn get change => integer()();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Set<Column<Object>> get primaryKey => {playerId, matchId, roundNumber};
|
||||||
|
}
|
||||||
9
lib/data/db/tables/team_table.dart
Normal file
9
lib/data/db/tables/team_table.dart
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import 'package:drift/drift.dart';
|
||||||
|
|
||||||
|
class TeamTable extends Table {
|
||||||
|
TextColumn get id => text()();
|
||||||
|
TextColumn get name => text()();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Set<Column<Object>> get primaryKey => {id};
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@ class Match {
|
|||||||
final String name;
|
final String name;
|
||||||
final List<Player>? players;
|
final List<Player>? players;
|
||||||
final Group? group;
|
final Group? group;
|
||||||
final Player? winner;
|
Player? winner;
|
||||||
|
|
||||||
Match({
|
Match({
|
||||||
String? id,
|
String? id,
|
||||||
|
|||||||
@@ -1,83 +1,83 @@
|
|||||||
{
|
{
|
||||||
"@@locale": "de",
|
"@@locale": "de",
|
||||||
"choose_group": "Gruppe wählen",
|
"all_players": "Alle Spieler:innen",
|
||||||
"create_new_match": "Neues Match erstellen",
|
"all_players_selected": "Alle Spieler:innen ausgewählt",
|
||||||
"choose_ruleset": "Regelwerk wählen",
|
"amount_of_matches": "Anzahl der Spiele",
|
||||||
"choose_game": "Spielvorlage wählen",
|
|
||||||
"select_winner": "Gewinner:in wählen:",
|
|
||||||
"no_recent_matches_available": "Keine letzten Matches verfügbar",
|
|
||||||
"no_second_match_available": "Kein zweites Match verfügbar",
|
|
||||||
"delete_all_data": "Alle Daten löschen?",
|
|
||||||
"cancel": "Abbrechen",
|
"cancel": "Abbrechen",
|
||||||
"delete": "Löschen",
|
"choose_game": "Spielvorlage wählen",
|
||||||
"create_new_group": "Neue Gruppe erstellen",
|
"choose_group": "Gruppe wählen",
|
||||||
"error_creating_group": "Fehler beim Erstellen der Gruppe, bitte erneut versuchen",
|
"choose_ruleset": "Regelwerk wählen",
|
||||||
"selected_players": "Ausgewählte Spieler:in: {count}",
|
|
||||||
"no_players_selected": "Keine Spieler:in ausgewählt",
|
|
||||||
"all_players": "Alle Spieler:innen:",
|
|
||||||
"successfully_added_player": "Spieler:in {playerName} erfolgreich hinzugefügt",
|
|
||||||
"could_not_add_player": "Spieler:in {playerName} konnte nicht hinzugefügt werden",
|
"could_not_add_player": "Spieler:in {playerName} konnte nicht hinzugefügt werden",
|
||||||
"winner": "Gewinner:in: {winnerName}",
|
|
||||||
"players": "Spieler:in",
|
|
||||||
"player_name": "Spieler:innenname",
|
|
||||||
"no_statistics_available": "Keine Statistiken verfügbar",
|
|
||||||
"matches": "Matches",
|
|
||||||
"groups": "Gruppen",
|
|
||||||
"recent_matches": "Letzte Matches",
|
|
||||||
"quick_create": "Schnellzugriff",
|
|
||||||
"match_in_progress": "Match läuft...",
|
|
||||||
"menu": "Menü",
|
|
||||||
"settings": "Einstellungen",
|
|
||||||
"export_data": "Daten exportieren",
|
|
||||||
"import_data": "Daten importieren",
|
|
||||||
"this_cannot_be_undone": "Dies kann nicht rückgängig gemacht werden",
|
|
||||||
"data_successfully_deleted": "Daten erfolgreich gelöscht",
|
|
||||||
"data_successfully_imported": "Daten erfolgreich importiert",
|
|
||||||
"invalid_schema": "Ungültiges Schema",
|
|
||||||
"error_reading_file": "Fehler beim Lesen der Datei",
|
|
||||||
"import_canceled": "Import abgebrochen",
|
|
||||||
"format_exception": "Formatfehler (siehe Konsole)",
|
|
||||||
"unknown_exception": "Unbekannter Fehler (siehe Konsole)",
|
|
||||||
"data_successfully_exported": "Daten erfolgreich exportiert",
|
|
||||||
"export_canceled": "Export abgebrochen",
|
|
||||||
"undo": "Rückgängig",
|
|
||||||
"wins": "Siege",
|
|
||||||
"winrate": "Siegquote",
|
|
||||||
"amount_of_matches": "Anzahl der Matches",
|
|
||||||
"info": "Info",
|
|
||||||
"no_groups_created_yet": "Noch keine Gruppen erstellt",
|
|
||||||
"create_group": "Gruppe erstellen",
|
"create_group": "Gruppe erstellen",
|
||||||
"group_name": "Gruppenname",
|
"create_match": "Spiel erstellen",
|
||||||
"no_matches_created_yet": "Noch keine Matches erstellt",
|
"create_new_group": "Neue Gruppe erstellen",
|
||||||
"match_name": "Matchname",
|
"create_new_match": "Neues Spiel erstellen",
|
||||||
|
"data_successfully_deleted": "Daten erfolgreich gelöscht",
|
||||||
|
"data_successfully_exported": "Daten erfolgreich exportiert",
|
||||||
|
"data_successfully_imported": "Daten erfolgreich importiert",
|
||||||
|
"days_ago": "vor {count} Tagen",
|
||||||
|
"delete": "Löschen",
|
||||||
|
"delete_all_data": "Alle Daten löschen",
|
||||||
|
"error_creating_group": "Fehler beim Erstellen der Gruppe, bitte erneut versuchen",
|
||||||
|
"error_reading_file": "Fehler beim Lesen der Datei",
|
||||||
|
"export_canceled": "Export abgebrochen",
|
||||||
|
"export_data": "Daten exportieren",
|
||||||
|
"format_exception": "Formatfehler (siehe Konsole)",
|
||||||
"game": "Spielvorlage",
|
"game": "Spielvorlage",
|
||||||
"ruleset": "Regelwerk",
|
"game_name": "Spielvorlagenname",
|
||||||
"group": "Gruppe",
|
"group": "Gruppe",
|
||||||
|
"group_name": "Gruppenname",
|
||||||
|
"groups": "Gruppen",
|
||||||
|
"home": "Startseite",
|
||||||
|
"import_canceled": "Import abgebrochen",
|
||||||
|
"import_data": "Daten importieren",
|
||||||
|
"info": "Info",
|
||||||
|
"invalid_schema": "Ungültiges Schema",
|
||||||
|
"least_points": "Niedrigste Punkte",
|
||||||
|
"match_in_progress": "Spiel läuft...",
|
||||||
|
"match_name": "Spieltitel",
|
||||||
|
"matches": "Spiele",
|
||||||
|
"menu": "Menü",
|
||||||
|
"most_points": "Höchste Punkte",
|
||||||
|
"no_data_available": "Keine Daten verfügbar",
|
||||||
|
"no_groups_created_yet": "Noch keine Gruppen erstellt",
|
||||||
|
"no_matches_created_yet": "Noch keine Spiele erstellt",
|
||||||
|
"no_players_created_yet": "Noch keine Spieler:in erstellt",
|
||||||
|
"no_players_found_with_that_name": "Keine Spieler:in mit diesem Namen gefunden",
|
||||||
|
"no_players_selected": "Keine Spieler:innen ausgewählt",
|
||||||
|
"no_recent_matches_available": "Keine letzten Spiele verfügbar",
|
||||||
|
"no_second_match_available": "Kein zweites Spiel verfügbar",
|
||||||
|
"no_statistics_available": "Keine Statistiken verfügbar",
|
||||||
"none": "Kein",
|
"none": "Kein",
|
||||||
"none_group": "Keine",
|
"none_group": "Keine",
|
||||||
"create_match": "Match erstellen",
|
"not_available": "Nicht verfügbar",
|
||||||
"no_players_created_yet": "Noch keine Spieler:in erstellt",
|
"player_name": "Spieler:innenname",
|
||||||
"all_players_selected": "Alle Spieler:innen ausgewählt",
|
"players": "Spieler:innen",
|
||||||
"no_players_found_with_that_name": "Keine Spieler:in mit diesem Namen gefunden",
|
"players_count": "{count} Spieler",
|
||||||
"today_at": "Heute um {time}",
|
"quick_create": "Schnellzugriff",
|
||||||
"yesterday_at": "Gestern um {time}",
|
"recent_matches": "Letzte Spiele",
|
||||||
"days_ago": "vor {count} Tagen",
|
"ruleset": "Regelwerk",
|
||||||
"home": "Startseite",
|
"ruleset_least_points": "Umgekehrte Wertung: Der/die Spieler:in mit den wenigsten Punkten gewinnt.",
|
||||||
|
"ruleset_most_points": "Traditionelles Regelwerk: Der/die Spieler:in mit den meisten Punkten gewinnt.",
|
||||||
|
"ruleset_single_loser": "Genau ein:e Verlierer:in wird bestimmt; der letzte Platz erhält die Strafe oder Konsequenz.",
|
||||||
|
"ruleset_single_winner": "Genau ein:e Gewinner:in wird gewählt; Unentschieden werden durch einen vordefinierten Tie-Breaker aufgelöst.",
|
||||||
|
"search_for_groups": "Nach Gruppen suchen",
|
||||||
|
"search_for_players": "Nach Spieler:innen suchen",
|
||||||
|
"select_winner": "Gewinner:in wählen:",
|
||||||
|
"selected_players": "Ausgewählte Spieler:innen",
|
||||||
|
"settings": "Einstellungen",
|
||||||
|
"single_loser": "Ein:e Verlierer:in",
|
||||||
|
"single_winner": "Ein:e Gewinner:in",
|
||||||
"statistics": "Statistiken",
|
"statistics": "Statistiken",
|
||||||
"stats": "Statistiken",
|
"stats": "Statistiken",
|
||||||
"players_count": "{count} Spieler",
|
"successfully_added_player": "Spieler:in {playerName} erfolgreich hinzugefügt",
|
||||||
"there_is_no_group_matching_your_search": "Es gibt keine Gruppe, die deiner Suche entspricht",
|
"there_is_no_group_matching_your_search": "Es gibt keine Gruppe, die deiner Suche entspricht",
|
||||||
"game_name": "Spielvorlagenname",
|
"this_cannot_be_undone": "Dies kann nicht rückgängig gemacht werden",
|
||||||
"ruleset_single_winner": "Genau ein:e Gewinner:in wird gewählt; Unentschieden werden durch einen vordefinierten Tie-Breaker aufgelöst.",
|
"today_at": "Heute um",
|
||||||
"ruleset_single_loser": "Genau ein:e Verlierer:in wird bestimmt; der letzte Platz erhält die Strafe oder Konsequenz.",
|
"undo": "Rückgängig",
|
||||||
"ruleset_most_points": "Traditionelles Regelwerk: Der/die Spieler:in mit den meisten Punkten gewinnt.",
|
"unknown_exception": "Unbekannter Fehler (siehe Konsole)",
|
||||||
"ruleset_least_points": "Umgekehrte Wertung: Der/die Spieler:in mit den wenigsten Punkten gewinnt.",
|
"winner": "Gewinner:in",
|
||||||
"single_winner": "Ein:e Gewinner:in",
|
"winrate": "Siegquote",
|
||||||
"single_loser": "Ein:e Verlierer:in",
|
"wins": "Siege",
|
||||||
"most_points": "Höchste Punkte",
|
"yesterday_at": "Gestern um"
|
||||||
"least_points": "Niedrigste Punkte",
|
}
|
||||||
"search_for_players": "Nach Spieler:innen suchen",
|
|
||||||
"search_for_groups": "Nach Gruppen suchen",
|
|
||||||
"no_data_available": "Keine Daten verfügbar",
|
|
||||||
"not_available": "Nicht verfügbar"
|
|
||||||
}
|
|
||||||
@@ -1,76 +1,228 @@
|
|||||||
{
|
{
|
||||||
"@@locale": "en",
|
"@@locale": "en",
|
||||||
"choose_group": "Choose Group",
|
|
||||||
"@choose_group": {
|
|
||||||
"description": "Label for choosing a group"
|
|
||||||
},
|
|
||||||
"create_new_match": "Create new match",
|
|
||||||
"@create_new_match": {
|
|
||||||
"description": "Button text to create a new match"
|
|
||||||
},
|
|
||||||
"choose_ruleset": "Choose Ruleset",
|
|
||||||
"@choose_ruleset": {
|
|
||||||
"description": "Label for choosing a ruleset"
|
|
||||||
},
|
|
||||||
"choose_game": "Choose Game",
|
|
||||||
"@choose_game": {
|
|
||||||
"description": "Label for choosing a game"
|
|
||||||
},
|
|
||||||
"select_winner": "Select Winner:",
|
|
||||||
"@select_winner": {
|
|
||||||
"description": "Label to select the winner"
|
|
||||||
},
|
|
||||||
"game_tracker": "Game Tracker",
|
|
||||||
"@game_tracker": {
|
|
||||||
"description": "App Name"
|
|
||||||
},
|
|
||||||
"no_recent_matches_available": "No recent matches available",
|
|
||||||
"@no_recent_matches_available": {
|
|
||||||
"description": "Message when no recent matches exist"
|
|
||||||
},
|
|
||||||
"no_second_match_available": "No second match available",
|
|
||||||
"@no_second_match_available": {
|
|
||||||
"description": "Message when no second match exists"
|
|
||||||
},
|
|
||||||
"delete_all_data": "Delete all data?",
|
|
||||||
"@delete_all_data": {
|
|
||||||
"description": "Confirmation dialog for deleting all data"
|
|
||||||
},
|
|
||||||
"cancel": "Cancel",
|
|
||||||
"@cancel": {
|
|
||||||
"description": "Cancel button text"
|
|
||||||
},
|
|
||||||
"delete": "Delete",
|
|
||||||
"@delete": {
|
|
||||||
"description": "Delete button text"
|
|
||||||
},
|
|
||||||
"create_new_group": "Create new group",
|
|
||||||
"@create_new_group": {
|
|
||||||
"description": "Button text to create a new group"
|
|
||||||
},
|
|
||||||
"error_creating_group": "Error while creating group, please try again",
|
|
||||||
"@error_creating_group": {
|
|
||||||
"description": "Error message when group creation fails"
|
|
||||||
},
|
|
||||||
"selected_players": "Selected players: {count}",
|
|
||||||
"@selected_players": {
|
|
||||||
"description": "Shows the number of selected players",
|
|
||||||
"placeholders": {
|
|
||||||
"count": {
|
|
||||||
"type": "int",
|
|
||||||
"format": "compact"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"no_players_selected": "No players selected",
|
|
||||||
"@no_players_selected": {
|
|
||||||
"description": "Message when no players are selected"
|
|
||||||
},
|
|
||||||
"all_players": "All players:",
|
|
||||||
"@all_players": {
|
"@all_players": {
|
||||||
"description": "Label for all players list"
|
"description": "Label for all players list"
|
||||||
},
|
},
|
||||||
"successfully_added_player": "Successfully added player {playerName}",
|
"@all_players_selected": {
|
||||||
|
"description": "Message when all players are added to selection"
|
||||||
|
},
|
||||||
|
"@amount_of_matches": {
|
||||||
|
"description": "Label for amount of matches statistic"
|
||||||
|
},
|
||||||
|
"@app_name": {
|
||||||
|
"description": "The name of the App"
|
||||||
|
},
|
||||||
|
"@cancel": {
|
||||||
|
"description": "Cancel button text"
|
||||||
|
},
|
||||||
|
"@choose_game": {
|
||||||
|
"description": "Label for choosing a game"
|
||||||
|
},
|
||||||
|
"@choose_group": {
|
||||||
|
"description": "Label for choosing a group"
|
||||||
|
},
|
||||||
|
"@choose_ruleset": {
|
||||||
|
"description": "Label for choosing a ruleset"
|
||||||
|
},
|
||||||
|
"@could_not_add_player": {
|
||||||
|
"description": "Error message when adding a player fails"
|
||||||
|
},
|
||||||
|
"@create_group": {
|
||||||
|
"description": "Button text to create a group"
|
||||||
|
},
|
||||||
|
"@create_match": {
|
||||||
|
"description": "Button text to create a match"
|
||||||
|
},
|
||||||
|
"@create_new_group": {
|
||||||
|
"description": "Button text to create a new group"
|
||||||
|
},
|
||||||
|
"@create_new_match": {
|
||||||
|
"description": "Button text to create a new match"
|
||||||
|
},
|
||||||
|
"@data_successfully_deleted": {
|
||||||
|
"description": "Success message after deleting data"
|
||||||
|
},
|
||||||
|
"@data_successfully_exported": {
|
||||||
|
"description": "Success message after exporting data"
|
||||||
|
},
|
||||||
|
"@data_successfully_imported": {
|
||||||
|
"description": "Success message after importing data"
|
||||||
|
},
|
||||||
|
"@days_ago": {
|
||||||
|
"description": "Date format for days ago",
|
||||||
|
"placeholders": {
|
||||||
|
"count": {
|
||||||
|
"type": "int"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@delete": {
|
||||||
|
"description": "Delete button text"
|
||||||
|
},
|
||||||
|
"@delete_all_data": {
|
||||||
|
"description": "Confirmation dialog for deleting all data"
|
||||||
|
},
|
||||||
|
"@error_creating_group": {
|
||||||
|
"description": "Error message when group creation fails"
|
||||||
|
},
|
||||||
|
"@error_reading_file": {
|
||||||
|
"description": "Error message when file cannot be read"
|
||||||
|
},
|
||||||
|
"@export_canceled": {
|
||||||
|
"description": "Message when export is canceled"
|
||||||
|
},
|
||||||
|
"@export_data": {
|
||||||
|
"description": "Export data menu item"
|
||||||
|
},
|
||||||
|
"@format_exception": {
|
||||||
|
"description": "Error message for format exceptions"
|
||||||
|
},
|
||||||
|
"@game": {
|
||||||
|
"description": "Game label"
|
||||||
|
},
|
||||||
|
"@game_name": {
|
||||||
|
"description": "Placeholder for game name search"
|
||||||
|
},
|
||||||
|
"@group": {
|
||||||
|
"description": "Group label"
|
||||||
|
},
|
||||||
|
"@group_name": {
|
||||||
|
"description": "Placeholder for group name input"
|
||||||
|
},
|
||||||
|
"@groups": {
|
||||||
|
"description": "Label for groups"
|
||||||
|
},
|
||||||
|
"@home": {
|
||||||
|
"description": "Home tab label"
|
||||||
|
},
|
||||||
|
"@import_canceled": {
|
||||||
|
"description": "Message when import is canceled"
|
||||||
|
},
|
||||||
|
"@import_data": {
|
||||||
|
"description": "Import data menu item"
|
||||||
|
},
|
||||||
|
"@info": {
|
||||||
|
"description": "Info label"
|
||||||
|
},
|
||||||
|
"@invalid_schema": {
|
||||||
|
"description": "Error message for invalid schema"
|
||||||
|
},
|
||||||
|
"@least_points": {
|
||||||
|
"description": "Title for least points ruleset"
|
||||||
|
},
|
||||||
|
"@match_in_progress": {
|
||||||
|
"description": "Message when match is in progress"
|
||||||
|
},
|
||||||
|
"@match_name": {
|
||||||
|
"description": "Placeholder for match name input"
|
||||||
|
},
|
||||||
|
"@matches": {
|
||||||
|
"description": "Label for matches"
|
||||||
|
},
|
||||||
|
"@menu": {
|
||||||
|
"description": "Menu label"
|
||||||
|
},
|
||||||
|
"@most_points": {
|
||||||
|
"description": "Title for most points ruleset"
|
||||||
|
},
|
||||||
|
"@no_data_available": {
|
||||||
|
"description": "Message when no data in the statistic tiles is given"
|
||||||
|
},
|
||||||
|
"@no_groups_created_yet": {
|
||||||
|
"description": "Message when no groups exist"
|
||||||
|
},
|
||||||
|
"@no_matches_created_yet": {
|
||||||
|
"description": "Message when no matches exist"
|
||||||
|
},
|
||||||
|
"@no_players_created_yet": {
|
||||||
|
"description": "Message when no players exist"
|
||||||
|
},
|
||||||
|
"@no_players_found_with_that_name": {
|
||||||
|
"description": "Message when search returns no results"
|
||||||
|
},
|
||||||
|
"@no_players_selected": {
|
||||||
|
"description": "Message when no players are selected"
|
||||||
|
},
|
||||||
|
"@no_recent_matches_available": {
|
||||||
|
"description": "Message when no recent matches exist"
|
||||||
|
},
|
||||||
|
"@no_second_match_available": {
|
||||||
|
"description": "Message when no second match exists"
|
||||||
|
},
|
||||||
|
"@no_statistics_available": {
|
||||||
|
"description": "Message when no statistics are available, because no matches were played yet"
|
||||||
|
},
|
||||||
|
"@none": {
|
||||||
|
"description": "None option label"
|
||||||
|
},
|
||||||
|
"@none_group": {
|
||||||
|
"description": "None group option label"
|
||||||
|
},
|
||||||
|
"@not_available": {
|
||||||
|
"description": "Abbreviation for not available"
|
||||||
|
},
|
||||||
|
"@player_name": {
|
||||||
|
"description": "Placeholder for player name input"
|
||||||
|
},
|
||||||
|
"@players": {
|
||||||
|
"description": "Players label"
|
||||||
|
},
|
||||||
|
"@players_count": {
|
||||||
|
"description": "Shows the number of players",
|
||||||
|
"placeholders": {
|
||||||
|
"count": {
|
||||||
|
"type": "int"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@quick_create": {
|
||||||
|
"description": "Title for quick create section"
|
||||||
|
},
|
||||||
|
"@recent_matches": {
|
||||||
|
"description": "Title for recent matches section"
|
||||||
|
},
|
||||||
|
"@ruleset": {
|
||||||
|
"description": "Ruleset label"
|
||||||
|
},
|
||||||
|
"@ruleset_least_points": {
|
||||||
|
"description": "Description for least points ruleset"
|
||||||
|
},
|
||||||
|
"@ruleset_most_points": {
|
||||||
|
"description": "Description for most points ruleset"
|
||||||
|
},
|
||||||
|
"@ruleset_single_loser": {
|
||||||
|
"description": "Description for single loser ruleset"
|
||||||
|
},
|
||||||
|
"@ruleset_single_winner": {
|
||||||
|
"description": "Description for single winner ruleset"
|
||||||
|
},
|
||||||
|
"@search_for_groups": {
|
||||||
|
"description": "Hint text for group search input field"
|
||||||
|
},
|
||||||
|
"@search_for_players": {
|
||||||
|
"description": "Hint text for player search input field"
|
||||||
|
},
|
||||||
|
"@select_winner": {
|
||||||
|
"description": "Label to select the winner"
|
||||||
|
},
|
||||||
|
"@selected_players": {
|
||||||
|
"description": "Shows the number of selected players"
|
||||||
|
},
|
||||||
|
"@settings": {
|
||||||
|
"description": "Settings label"
|
||||||
|
},
|
||||||
|
"@single_loser": {
|
||||||
|
"description": "Title for single loser ruleset"
|
||||||
|
},
|
||||||
|
"@single_winner": {
|
||||||
|
"description": "Title for single winner ruleset"
|
||||||
|
},
|
||||||
|
"@statistics": {
|
||||||
|
"description": "Statistics tab label"
|
||||||
|
},
|
||||||
|
"@stats": {
|
||||||
|
"description": "Stats tab label (short)"
|
||||||
|
},
|
||||||
"@successfully_added_player": {
|
"@successfully_added_player": {
|
||||||
"description": "Success message when adding a player",
|
"description": "Success message when adding a player",
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
@@ -80,294 +232,112 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"could_not_add_player": "Could not add player {playerName}",
|
|
||||||
"@could_not_add_player": {
|
|
||||||
"description": "Error message when adding a player fails",
|
|
||||||
"placeholders": {
|
|
||||||
"playerName": {
|
|
||||||
"type": "String",
|
|
||||||
"example": "John"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"winner": "Winner: {winnerName}",
|
|
||||||
"@winner": {
|
|
||||||
"description": "Shows the winner's name",
|
|
||||||
"placeholders": {
|
|
||||||
"winnerName": {
|
|
||||||
"type": "String",
|
|
||||||
"example": "John"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"players": "Players",
|
|
||||||
"@players": {
|
|
||||||
"description": "Players label"
|
|
||||||
},
|
|
||||||
"no_statistics_available": "No statistics available",
|
|
||||||
"@no_statistics_available": {
|
|
||||||
"description": "Message when no statistics are available, because no matches were played yet"
|
|
||||||
},
|
|
||||||
"no_data_available": "No data available",
|
|
||||||
"@no_data_available": {
|
|
||||||
"description": "Message when no data in the statistic tiles is given"
|
|
||||||
},
|
|
||||||
"matches": "Matches",
|
|
||||||
"@matches": {
|
|
||||||
"description": "Label for matches"
|
|
||||||
},
|
|
||||||
"groups": "Groups",
|
|
||||||
"@groups": {
|
|
||||||
"description": "Label for groups"
|
|
||||||
},
|
|
||||||
"recent_matches": "Recent Matches",
|
|
||||||
"@recent_matches": {
|
|
||||||
"description": "Title for recent matches section"
|
|
||||||
},
|
|
||||||
"quick_create": "Quick Create",
|
|
||||||
"@quick_create": {
|
|
||||||
"description": "Title for quick create section"
|
|
||||||
},
|
|
||||||
"match_in_progress": "Match in progress...",
|
|
||||||
"@match_in_progress": {
|
|
||||||
"description": "Message when match is in progress"
|
|
||||||
},
|
|
||||||
"menu": "Menu",
|
|
||||||
"@menu": {
|
|
||||||
"description": "Menu label"
|
|
||||||
},
|
|
||||||
"settings": "Settings",
|
|
||||||
"@settings": {
|
|
||||||
"description": "Settings label"
|
|
||||||
},
|
|
||||||
"export_data": "Export data",
|
|
||||||
"@export_data": {
|
|
||||||
"description": "Export data menu item"
|
|
||||||
},
|
|
||||||
"import_data": "Import data",
|
|
||||||
"@import_data": {
|
|
||||||
"description": "Import data menu item"
|
|
||||||
},
|
|
||||||
"this_cannot_be_undone": "This can't be undone",
|
|
||||||
"@this_cannot_be_undone": {
|
|
||||||
"description": "Warning message for irreversible actions"
|
|
||||||
},
|
|
||||||
"data_successfully_deleted": "Data successfully deleted",
|
|
||||||
"@data_successfully_deleted": {
|
|
||||||
"description": "Success message after deleting data"
|
|
||||||
},
|
|
||||||
"data_successfully_imported": "Data successfully imported",
|
|
||||||
"@data_successfully_imported": {
|
|
||||||
"description": "Success message after importing data"
|
|
||||||
},
|
|
||||||
"invalid_schema": "Invalid Schema",
|
|
||||||
"@invalid_schema": {
|
|
||||||
"description": "Error message for invalid schema"
|
|
||||||
},
|
|
||||||
"error_reading_file": "Error reading file",
|
|
||||||
"@error_reading_file": {
|
|
||||||
"description": "Error message when file cannot be read"
|
|
||||||
},
|
|
||||||
"import_canceled": "Import canceled",
|
|
||||||
"@import_canceled": {
|
|
||||||
"description": "Message when import is canceled"
|
|
||||||
},
|
|
||||||
"format_exception": "Format Exception (see console)",
|
|
||||||
"@format_exception": {
|
|
||||||
"description": "Error message for format exceptions"
|
|
||||||
},
|
|
||||||
"unknown_exception": "Unknown Exception (see console)",
|
|
||||||
"@unknown_exception": {
|
|
||||||
"description": "Error message for unknown exceptions"
|
|
||||||
},
|
|
||||||
"data_successfully_exported": "Data successfully exported",
|
|
||||||
"@data_successfully_exported": {
|
|
||||||
"description": "Success message after exporting data"
|
|
||||||
},
|
|
||||||
"export_canceled": "Export canceled",
|
|
||||||
"@export_canceled": {
|
|
||||||
"description": "Message when export is canceled"
|
|
||||||
},
|
|
||||||
"undo": "Undo",
|
|
||||||
"@undo": {
|
|
||||||
"description": "Undo button text"
|
|
||||||
},
|
|
||||||
"wins": "Wins",
|
|
||||||
"@wins": {
|
|
||||||
"description": "Label for wins statistic"
|
|
||||||
},
|
|
||||||
"winrate": "Winrate",
|
|
||||||
"@winrate": {
|
|
||||||
"description": "Label for winrate statistic"
|
|
||||||
},
|
|
||||||
"amount_of_matches": "Amount of Matches",
|
|
||||||
"@amount_of_matches": {
|
|
||||||
"description": "Label for amount of matches statistic"
|
|
||||||
},
|
|
||||||
"info": "Info",
|
|
||||||
"@info": {
|
|
||||||
"description": "Info label"
|
|
||||||
},
|
|
||||||
"no_groups_created_yet": "No groups created yet",
|
|
||||||
"@no_groups_created_yet": {
|
|
||||||
"description": "Message when no groups exist"
|
|
||||||
},
|
|
||||||
"no_players_created_yet": "No players created yet",
|
|
||||||
"@no_players_created_yet": {
|
|
||||||
"description": "Message when no players exist"
|
|
||||||
},
|
|
||||||
"create_group": "Create Group",
|
|
||||||
"@create_group": {
|
|
||||||
"description": "Button text to create a group"
|
|
||||||
},
|
|
||||||
"group_name": "Group name",
|
|
||||||
"@group_name": {
|
|
||||||
"description": "Placeholder for group name input"
|
|
||||||
},
|
|
||||||
"player_name": "Player name",
|
|
||||||
"@player_name": {
|
|
||||||
"description": "Placeholder for player name input"
|
|
||||||
},
|
|
||||||
"no_matches_created_yet": "No matches created yet",
|
|
||||||
"@no_matches_created_yet": {
|
|
||||||
"description": "Message when no matches exist"
|
|
||||||
},
|
|
||||||
"match_name": "Match name",
|
|
||||||
"@match_name": {
|
|
||||||
"description": "Placeholder for match name input"
|
|
||||||
},
|
|
||||||
"game": "Game",
|
|
||||||
"@game": {
|
|
||||||
"description": "Game label"
|
|
||||||
},
|
|
||||||
"ruleset": "Ruleset",
|
|
||||||
"@ruleset": {
|
|
||||||
"description": "Ruleset label"
|
|
||||||
},
|
|
||||||
"group": "Group",
|
|
||||||
"@group": {
|
|
||||||
"description": "Group label"
|
|
||||||
},
|
|
||||||
"none": "None",
|
|
||||||
"@none": {
|
|
||||||
"description": "None option label"
|
|
||||||
},
|
|
||||||
"none_group": "None",
|
|
||||||
"@none_group": {
|
|
||||||
"description": "None group option label"
|
|
||||||
},
|
|
||||||
"create_match": "Create match",
|
|
||||||
"@create_match": {
|
|
||||||
"description": "Button text to create a match"
|
|
||||||
},
|
|
||||||
"no_players_found_with_that_name": "No players found with that name",
|
|
||||||
"@no_players_found_with_that_name": {
|
|
||||||
"description": "Message when search returns no results"
|
|
||||||
},
|
|
||||||
"all_players_selected": "All players selected",
|
|
||||||
"@all_players_selected": {
|
|
||||||
"description": "Message when all players are added to selection"
|
|
||||||
},
|
|
||||||
"today_at": "Today at {time}",
|
|
||||||
"@today_at": {
|
|
||||||
"description": "Date format for today",
|
|
||||||
"placeholders": {
|
|
||||||
"time": {
|
|
||||||
"type": "String",
|
|
||||||
"example": "14:30"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"yesterday_at": "Yesterday at {time}",
|
|
||||||
"@yesterday_at": {
|
|
||||||
"description": "Date format for yesterday",
|
|
||||||
"placeholders": {
|
|
||||||
"time": {
|
|
||||||
"type": "String",
|
|
||||||
"example": "14:30"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"days_ago": "{count} days ago",
|
|
||||||
"@days_ago": {
|
|
||||||
"description": "Date format for days ago",
|
|
||||||
"placeholders": {
|
|
||||||
"count": {
|
|
||||||
"type": "int"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"home": "Home",
|
|
||||||
"@home": {
|
|
||||||
"description": "Home tab label"
|
|
||||||
},
|
|
||||||
"statistics": "Statistics",
|
|
||||||
"@statistics": {
|
|
||||||
"description": "Statistics tab label"
|
|
||||||
},
|
|
||||||
"stats": "Stats",
|
|
||||||
"@stats": {
|
|
||||||
"description": "Stats tab label (short)"
|
|
||||||
},
|
|
||||||
"players_count": "{count} Players",
|
|
||||||
"@players_count": {
|
|
||||||
"description": "Shows the number of players",
|
|
||||||
"placeholders": {
|
|
||||||
"count": {
|
|
||||||
"type": "int"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"there_is_no_group_matching_your_search": "There is no group matching your search",
|
|
||||||
"@there_is_no_group_matching_your_search": {
|
"@there_is_no_group_matching_your_search": {
|
||||||
"description": "Message when search returns no groups"
|
"description": "Message when search returns no groups"
|
||||||
},
|
},
|
||||||
|
"@this_cannot_be_undone": {
|
||||||
|
"description": "Warning message for irreversible actions"
|
||||||
|
},
|
||||||
|
"@today_at": {
|
||||||
|
"description": "Date format for today"
|
||||||
|
},
|
||||||
|
"@undo": {
|
||||||
|
"description": "Undo button text"
|
||||||
|
},
|
||||||
|
"@unknown_exception": {
|
||||||
|
"description": "Error message for unknown exceptions"
|
||||||
|
},
|
||||||
|
"@winner": {
|
||||||
|
"description": "Winner label"
|
||||||
|
},
|
||||||
|
"@winrate": {
|
||||||
|
"description": "Label for winrate statistic"
|
||||||
|
},
|
||||||
|
"@wins": {
|
||||||
|
"description": "Label for wins statistic"
|
||||||
|
},
|
||||||
|
"@yesterday_at": {
|
||||||
|
"description": "Date format for yesterday"
|
||||||
|
},
|
||||||
|
"all_players": "All players",
|
||||||
|
"all_players_selected": "All players selected",
|
||||||
|
"amount_of_matches": "Amount of Matches",
|
||||||
|
"app_name": "Game Tracker",
|
||||||
|
"cancel": "Cancel",
|
||||||
|
"choose_game": "Choose Game",
|
||||||
|
"choose_group": "Choose Group",
|
||||||
|
"choose_ruleset": "Choose Ruleset",
|
||||||
|
"could_not_add_player": "Could not add player",
|
||||||
|
"create_group": "Create Group",
|
||||||
|
"create_match": "Create match",
|
||||||
|
"create_new_group": "Create new group",
|
||||||
|
"create_new_match": "Create new match",
|
||||||
|
"data_successfully_deleted": "Data successfully deleted",
|
||||||
|
"data_successfully_exported": "Data successfully exported",
|
||||||
|
"data_successfully_imported": "Data successfully imported",
|
||||||
|
"days_ago": "{count} days ago",
|
||||||
|
"delete": "Delete",
|
||||||
|
"delete_all_data": "Delete all data",
|
||||||
|
"error_creating_group": "Error while creating group, please try again",
|
||||||
|
"error_reading_file": "Error reading file",
|
||||||
|
"export_canceled": "Export canceled",
|
||||||
|
"export_data": "Export data",
|
||||||
|
"format_exception": "Format Exception (see console)",
|
||||||
|
"game": "Game",
|
||||||
"game_name": "Game Name",
|
"game_name": "Game Name",
|
||||||
"@game_name": {
|
"group": "Group",
|
||||||
"description": "Placeholder for game name search"
|
"group_name": "Group name",
|
||||||
},
|
"groups": "Groups",
|
||||||
"ruleset_single_winner": "Exactly one winner is chosen; ties are resolved by a predefined tiebreaker.",
|
"home": "Home",
|
||||||
"@ruleset_single_winner": {
|
"import_canceled": "Import canceled",
|
||||||
"description": "Description for single winner ruleset"
|
"import_data": "Import data",
|
||||||
},
|
"info": "Info",
|
||||||
"ruleset_single_loser": "Exactly one loser is determined; last place receives the penalty or consequence.",
|
"invalid_schema": "Invalid Schema",
|
||||||
"@ruleset_single_loser": {
|
|
||||||
"description": "Description for single loser ruleset"
|
|
||||||
},
|
|
||||||
"ruleset_most_points": "Traditional ruleset: the player with the most points wins.",
|
|
||||||
"@ruleset_most_points": {
|
|
||||||
"description": "Description for most points ruleset"
|
|
||||||
},
|
|
||||||
"ruleset_least_points": "Inverse scoring: the player with the fewest points wins.",
|
|
||||||
"@ruleset_least_points": {
|
|
||||||
"description": "Description for least points ruleset"
|
|
||||||
},
|
|
||||||
"single_winner": "Single Winner",
|
|
||||||
"@single_winner": {
|
|
||||||
"description": "Title for single winner ruleset"
|
|
||||||
},
|
|
||||||
"single_loser": "Single Loser",
|
|
||||||
"@single_loser": {
|
|
||||||
"description": "Title for single loser ruleset"
|
|
||||||
},
|
|
||||||
"most_points": "Most Points",
|
|
||||||
"@most_points": {
|
|
||||||
"description": "Title for most points ruleset"
|
|
||||||
},
|
|
||||||
"least_points": "Least Points",
|
"least_points": "Least Points",
|
||||||
"@least_points": {
|
"match_in_progress": "Match in progress...",
|
||||||
"description": "Title for least points ruleset"
|
"match_name": "Match name",
|
||||||
},
|
"matches": "Matches",
|
||||||
"search_for_players": "Search for players",
|
"menu": "Menu",
|
||||||
"@search_for_players": {
|
"most_points": "Most Points",
|
||||||
"description": "Hint text for player search input field"
|
"no_data_available": "No data available",
|
||||||
},
|
"no_groups_created_yet": "No groups created yet",
|
||||||
"search_for_groups": "Search for groups",
|
"no_matches_created_yet": "No matches created yet",
|
||||||
"@search_for_groups": {
|
"no_players_created_yet": "No players created yet",
|
||||||
"description": "Hint text for group search input field"
|
"no_players_found_with_that_name": "No players found with that name",
|
||||||
},
|
"no_players_selected": "No players selected",
|
||||||
|
"no_recent_matches_available": "No recent matches available",
|
||||||
|
"no_second_match_available": "No second match available",
|
||||||
|
"no_statistics_available": "No statistics available",
|
||||||
|
"none": "None",
|
||||||
|
"none_group": "None",
|
||||||
"not_available": "Not available",
|
"not_available": "Not available",
|
||||||
"@not_available": {
|
"player_name": "Player name",
|
||||||
"description": "Abbreviation for not available"
|
"players": "Players",
|
||||||
}
|
"players_count": "{count} Players",
|
||||||
}
|
"quick_create": "Quick Create",
|
||||||
|
"recent_matches": "Recent Matches",
|
||||||
|
"ruleset": "Ruleset",
|
||||||
|
"ruleset_least_points": "Inverse scoring: the player with the fewest points wins.",
|
||||||
|
"ruleset_most_points": "Traditional ruleset: the player with the most points wins.",
|
||||||
|
"ruleset_single_loser": "Exactly one loser is determined; last place receives the penalty or consequence.",
|
||||||
|
"ruleset_single_winner": "Exactly one winner is chosen; ties are resolved by a predefined tiebreaker.",
|
||||||
|
"search_for_groups": "Search for groups",
|
||||||
|
"search_for_players": "Search for players",
|
||||||
|
"select_winner": "Select Winner:",
|
||||||
|
"selected_players": "Selected players",
|
||||||
|
"settings": "Settings",
|
||||||
|
"single_loser": "Single Loser",
|
||||||
|
"single_winner": "Single Winner",
|
||||||
|
"statistics": "Statistics",
|
||||||
|
"stats": "Stats",
|
||||||
|
"successfully_added_player": "Successfully added player {playerName}",
|
||||||
|
"there_is_no_group_matching_your_search": "There is no group matching your search",
|
||||||
|
"this_cannot_be_undone": "This can't be undone",
|
||||||
|
"today_at": "Today at",
|
||||||
|
"undo": "Undo",
|
||||||
|
"unknown_exception": "Unknown Exception (see console)",
|
||||||
|
"winner": "Winner",
|
||||||
|
"winrate": "Winrate",
|
||||||
|
"wins": "Wins",
|
||||||
|
"yesterday_at": "Yesterday at"
|
||||||
|
}
|
||||||
@@ -98,23 +98,35 @@ abstract class AppLocalizations {
|
|||||||
Locale('en'),
|
Locale('en'),
|
||||||
];
|
];
|
||||||
|
|
||||||
/// Label for choosing a group
|
/// Label for all players list
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'Choose Group'**
|
/// **'All players'**
|
||||||
String get choose_group;
|
String get all_players;
|
||||||
|
|
||||||
/// Button text to create a new match
|
/// Message when all players are added to selection
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'Create new match'**
|
/// **'All players selected'**
|
||||||
String get create_new_match;
|
String get all_players_selected;
|
||||||
|
|
||||||
/// Label for choosing a ruleset
|
/// Label for amount of matches statistic
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'Choose Ruleset'**
|
/// **'Amount of Matches'**
|
||||||
String get choose_ruleset;
|
String get amount_of_matches;
|
||||||
|
|
||||||
|
/// The name of the App
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Game Tracker'**
|
||||||
|
String get app_name;
|
||||||
|
|
||||||
|
/// Cancel button text
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Cancel'**
|
||||||
|
String get cancel;
|
||||||
|
|
||||||
/// Label for choosing a game
|
/// Label for choosing a game
|
||||||
///
|
///
|
||||||
@@ -122,17 +134,245 @@ abstract class AppLocalizations {
|
|||||||
/// **'Choose Game'**
|
/// **'Choose Game'**
|
||||||
String get choose_game;
|
String get choose_game;
|
||||||
|
|
||||||
/// Label to select the winner
|
/// Label for choosing a group
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'Select Winner:'**
|
/// **'Choose Group'**
|
||||||
String get select_winner;
|
String get choose_group;
|
||||||
|
|
||||||
/// App Name
|
/// Label for choosing a ruleset
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'Game Tracker'**
|
/// **'Choose Ruleset'**
|
||||||
String get game_tracker;
|
String get choose_ruleset;
|
||||||
|
|
||||||
|
/// Error message when adding a player fails
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Could not add player'**
|
||||||
|
String could_not_add_player(Object playerName);
|
||||||
|
|
||||||
|
/// Button text to create a group
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Create Group'**
|
||||||
|
String get create_group;
|
||||||
|
|
||||||
|
/// Button text to create a match
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Create match'**
|
||||||
|
String get create_match;
|
||||||
|
|
||||||
|
/// Button text to create a new group
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Create new group'**
|
||||||
|
String get create_new_group;
|
||||||
|
|
||||||
|
/// Button text to create a new match
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Create new match'**
|
||||||
|
String get create_new_match;
|
||||||
|
|
||||||
|
/// Success message after deleting data
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Data successfully deleted'**
|
||||||
|
String get data_successfully_deleted;
|
||||||
|
|
||||||
|
/// Success message after exporting data
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Data successfully exported'**
|
||||||
|
String get data_successfully_exported;
|
||||||
|
|
||||||
|
/// Success message after importing data
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Data successfully imported'**
|
||||||
|
String get data_successfully_imported;
|
||||||
|
|
||||||
|
/// Date format for days ago
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'{count} days ago'**
|
||||||
|
String days_ago(int count);
|
||||||
|
|
||||||
|
/// Delete button text
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Delete'**
|
||||||
|
String get delete;
|
||||||
|
|
||||||
|
/// Confirmation dialog for deleting all data
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Delete all data'**
|
||||||
|
String get delete_all_data;
|
||||||
|
|
||||||
|
/// Error message when group creation fails
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Error while creating group, please try again'**
|
||||||
|
String get error_creating_group;
|
||||||
|
|
||||||
|
/// Error message when file cannot be read
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Error reading file'**
|
||||||
|
String get error_reading_file;
|
||||||
|
|
||||||
|
/// Message when export is canceled
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Export canceled'**
|
||||||
|
String get export_canceled;
|
||||||
|
|
||||||
|
/// Export data menu item
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Export data'**
|
||||||
|
String get export_data;
|
||||||
|
|
||||||
|
/// Error message for format exceptions
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Format Exception (see console)'**
|
||||||
|
String get format_exception;
|
||||||
|
|
||||||
|
/// Game label
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Game'**
|
||||||
|
String get game;
|
||||||
|
|
||||||
|
/// Placeholder for game name search
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Game Name'**
|
||||||
|
String get game_name;
|
||||||
|
|
||||||
|
/// Group label
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Group'**
|
||||||
|
String get group;
|
||||||
|
|
||||||
|
/// Placeholder for group name input
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Group name'**
|
||||||
|
String get group_name;
|
||||||
|
|
||||||
|
/// Label for groups
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Groups'**
|
||||||
|
String get groups;
|
||||||
|
|
||||||
|
/// Home tab label
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Home'**
|
||||||
|
String get home;
|
||||||
|
|
||||||
|
/// Message when import is canceled
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Import canceled'**
|
||||||
|
String get import_canceled;
|
||||||
|
|
||||||
|
/// Import data menu item
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Import data'**
|
||||||
|
String get import_data;
|
||||||
|
|
||||||
|
/// Info label
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Info'**
|
||||||
|
String get info;
|
||||||
|
|
||||||
|
/// Error message for invalid schema
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Invalid Schema'**
|
||||||
|
String get invalid_schema;
|
||||||
|
|
||||||
|
/// Title for least points ruleset
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Least Points'**
|
||||||
|
String get least_points;
|
||||||
|
|
||||||
|
/// Message when match is in progress
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Match in progress...'**
|
||||||
|
String get match_in_progress;
|
||||||
|
|
||||||
|
/// Placeholder for match name input
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Match name'**
|
||||||
|
String get match_name;
|
||||||
|
|
||||||
|
/// Label for matches
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Matches'**
|
||||||
|
String get matches;
|
||||||
|
|
||||||
|
/// Menu label
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Menu'**
|
||||||
|
String get menu;
|
||||||
|
|
||||||
|
/// Title for most points ruleset
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Most Points'**
|
||||||
|
String get most_points;
|
||||||
|
|
||||||
|
/// Message when no data in the statistic tiles is given
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'No data available'**
|
||||||
|
String get no_data_available;
|
||||||
|
|
||||||
|
/// Message when no groups exist
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'No groups created yet'**
|
||||||
|
String get no_groups_created_yet;
|
||||||
|
|
||||||
|
/// Message when no matches exist
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'No matches created yet'**
|
||||||
|
String get no_matches_created_yet;
|
||||||
|
|
||||||
|
/// Message when no players exist
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'No players created yet'**
|
||||||
|
String get no_players_created_yet;
|
||||||
|
|
||||||
|
/// Message when search returns no results
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'No players found with that name'**
|
||||||
|
String get no_players_found_with_that_name;
|
||||||
|
|
||||||
|
/// Message when no players are selected
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'No players selected'**
|
||||||
|
String get no_players_selected;
|
||||||
|
|
||||||
/// Message when no recent matches exist
|
/// Message when no recent matches exist
|
||||||
///
|
///
|
||||||
@@ -146,294 +386,12 @@ abstract class AppLocalizations {
|
|||||||
/// **'No second match available'**
|
/// **'No second match available'**
|
||||||
String get no_second_match_available;
|
String get no_second_match_available;
|
||||||
|
|
||||||
/// Confirmation dialog for deleting all data
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Delete all data?'**
|
|
||||||
String get delete_all_data;
|
|
||||||
|
|
||||||
/// Cancel button text
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Cancel'**
|
|
||||||
String get cancel;
|
|
||||||
|
|
||||||
/// Delete button text
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Delete'**
|
|
||||||
String get delete;
|
|
||||||
|
|
||||||
/// Button text to create a new group
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Create new group'**
|
|
||||||
String get create_new_group;
|
|
||||||
|
|
||||||
/// Error message when group creation fails
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Error while creating group, please try again'**
|
|
||||||
String get error_creating_group;
|
|
||||||
|
|
||||||
/// Shows the number of selected players
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Selected players: {count}'**
|
|
||||||
String selected_players(int count);
|
|
||||||
|
|
||||||
/// Message when no players are selected
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'No players selected'**
|
|
||||||
String get no_players_selected;
|
|
||||||
|
|
||||||
/// Label for all players list
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'All players:'**
|
|
||||||
String get all_players;
|
|
||||||
|
|
||||||
/// Success message when adding a player
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Successfully added player {playerName}'**
|
|
||||||
String successfully_added_player(String playerName);
|
|
||||||
|
|
||||||
/// Error message when adding a player fails
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Could not add player {playerName}'**
|
|
||||||
String could_not_add_player(String playerName);
|
|
||||||
|
|
||||||
/// Shows the winner's name
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Winner: {winnerName}'**
|
|
||||||
String winner(String winnerName);
|
|
||||||
|
|
||||||
/// Players label
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Players'**
|
|
||||||
String get players;
|
|
||||||
|
|
||||||
/// Message when no statistics are available, because no matches were played yet
|
/// Message when no statistics are available, because no matches were played yet
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'No statistics available'**
|
/// **'No statistics available'**
|
||||||
String get no_statistics_available;
|
String get no_statistics_available;
|
||||||
|
|
||||||
/// Message when no data in the statistic tiles is given
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'No data available'**
|
|
||||||
String get no_data_available;
|
|
||||||
|
|
||||||
/// Label for matches
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Matches'**
|
|
||||||
String get matches;
|
|
||||||
|
|
||||||
/// Label for groups
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Groups'**
|
|
||||||
String get groups;
|
|
||||||
|
|
||||||
/// Title for recent matches section
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Recent Matches'**
|
|
||||||
String get recent_matches;
|
|
||||||
|
|
||||||
/// Title for quick create section
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Quick Create'**
|
|
||||||
String get quick_create;
|
|
||||||
|
|
||||||
/// Message when match is in progress
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Match in progress...'**
|
|
||||||
String get match_in_progress;
|
|
||||||
|
|
||||||
/// Menu label
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Menu'**
|
|
||||||
String get menu;
|
|
||||||
|
|
||||||
/// Settings label
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Settings'**
|
|
||||||
String get settings;
|
|
||||||
|
|
||||||
/// Export data menu item
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Export data'**
|
|
||||||
String get export_data;
|
|
||||||
|
|
||||||
/// Import data menu item
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Import data'**
|
|
||||||
String get import_data;
|
|
||||||
|
|
||||||
/// Warning message for irreversible actions
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'This can\'t be undone'**
|
|
||||||
String get this_cannot_be_undone;
|
|
||||||
|
|
||||||
/// Success message after deleting data
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Data successfully deleted'**
|
|
||||||
String get data_successfully_deleted;
|
|
||||||
|
|
||||||
/// Success message after importing data
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Data successfully imported'**
|
|
||||||
String get data_successfully_imported;
|
|
||||||
|
|
||||||
/// Error message for invalid schema
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Invalid Schema'**
|
|
||||||
String get invalid_schema;
|
|
||||||
|
|
||||||
/// Error message when file cannot be read
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Error reading file'**
|
|
||||||
String get error_reading_file;
|
|
||||||
|
|
||||||
/// Message when import is canceled
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Import canceled'**
|
|
||||||
String get import_canceled;
|
|
||||||
|
|
||||||
/// Error message for format exceptions
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Format Exception (see console)'**
|
|
||||||
String get format_exception;
|
|
||||||
|
|
||||||
/// Error message for unknown exceptions
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Unknown Exception (see console)'**
|
|
||||||
String get unknown_exception;
|
|
||||||
|
|
||||||
/// Success message after exporting data
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Data successfully exported'**
|
|
||||||
String get data_successfully_exported;
|
|
||||||
|
|
||||||
/// Message when export is canceled
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Export canceled'**
|
|
||||||
String get export_canceled;
|
|
||||||
|
|
||||||
/// Undo button text
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Undo'**
|
|
||||||
String get undo;
|
|
||||||
|
|
||||||
/// Label for wins statistic
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Wins'**
|
|
||||||
String get wins;
|
|
||||||
|
|
||||||
/// Label for winrate statistic
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Winrate'**
|
|
||||||
String get winrate;
|
|
||||||
|
|
||||||
/// Label for amount of matches statistic
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Amount of Matches'**
|
|
||||||
String get amount_of_matches;
|
|
||||||
|
|
||||||
/// Info label
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Info'**
|
|
||||||
String get info;
|
|
||||||
|
|
||||||
/// Message when no groups exist
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'No groups created yet'**
|
|
||||||
String get no_groups_created_yet;
|
|
||||||
|
|
||||||
/// Message when no players exist
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'No players created yet'**
|
|
||||||
String get no_players_created_yet;
|
|
||||||
|
|
||||||
/// Button text to create a group
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Create Group'**
|
|
||||||
String get create_group;
|
|
||||||
|
|
||||||
/// Placeholder for group name input
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Group name'**
|
|
||||||
String get group_name;
|
|
||||||
|
|
||||||
/// Placeholder for player name input
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Player name'**
|
|
||||||
String get player_name;
|
|
||||||
|
|
||||||
/// Message when no matches exist
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'No matches created yet'**
|
|
||||||
String get no_matches_created_yet;
|
|
||||||
|
|
||||||
/// Placeholder for match name input
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Match name'**
|
|
||||||
String get match_name;
|
|
||||||
|
|
||||||
/// Game label
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Game'**
|
|
||||||
String get game;
|
|
||||||
|
|
||||||
/// Ruleset label
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Ruleset'**
|
|
||||||
String get ruleset;
|
|
||||||
|
|
||||||
/// Group label
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Group'**
|
|
||||||
String get group;
|
|
||||||
|
|
||||||
/// None option label
|
/// None option label
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
@@ -446,47 +404,113 @@ abstract class AppLocalizations {
|
|||||||
/// **'None'**
|
/// **'None'**
|
||||||
String get none_group;
|
String get none_group;
|
||||||
|
|
||||||
/// Button text to create a match
|
/// Abbreviation for not available
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'Create match'**
|
/// **'Not available'**
|
||||||
String get create_match;
|
String get not_available;
|
||||||
|
|
||||||
/// Message when search returns no results
|
/// Placeholder for player name input
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'No players found with that name'**
|
/// **'Player name'**
|
||||||
String get no_players_found_with_that_name;
|
String get player_name;
|
||||||
|
|
||||||
/// Message when all players are added to selection
|
/// Players label
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'All players selected'**
|
/// **'Players'**
|
||||||
String get all_players_selected;
|
String get players;
|
||||||
|
|
||||||
/// Date format for today
|
/// Shows the number of players
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'Today at {time}'**
|
/// **'{count} Players'**
|
||||||
String today_at(String time);
|
String players_count(int count);
|
||||||
|
|
||||||
/// Date format for yesterday
|
/// Title for quick create section
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'Yesterday at {time}'**
|
/// **'Quick Create'**
|
||||||
String yesterday_at(String time);
|
String get quick_create;
|
||||||
|
|
||||||
/// Date format for days ago
|
/// Title for recent matches section
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'{count} days ago'**
|
/// **'Recent Matches'**
|
||||||
String days_ago(int count);
|
String get recent_matches;
|
||||||
|
|
||||||
/// Home tab label
|
/// Ruleset label
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'Home'**
|
/// **'Ruleset'**
|
||||||
String get home;
|
String get ruleset;
|
||||||
|
|
||||||
|
/// Description for least points ruleset
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Inverse scoring: the player with the fewest points wins.'**
|
||||||
|
String get ruleset_least_points;
|
||||||
|
|
||||||
|
/// Description for most points ruleset
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Traditional ruleset: the player with the most points wins.'**
|
||||||
|
String get ruleset_most_points;
|
||||||
|
|
||||||
|
/// Description for single loser ruleset
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Exactly one loser is determined; last place receives the penalty or consequence.'**
|
||||||
|
String get ruleset_single_loser;
|
||||||
|
|
||||||
|
/// Description for single winner ruleset
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Exactly one winner is chosen; ties are resolved by a predefined tiebreaker.'**
|
||||||
|
String get ruleset_single_winner;
|
||||||
|
|
||||||
|
/// Hint text for group search input field
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Search for groups'**
|
||||||
|
String get search_for_groups;
|
||||||
|
|
||||||
|
/// Hint text for player search input field
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Search for players'**
|
||||||
|
String get search_for_players;
|
||||||
|
|
||||||
|
/// Label to select the winner
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Select Winner:'**
|
||||||
|
String get select_winner;
|
||||||
|
|
||||||
|
/// Shows the number of selected players
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Selected players'**
|
||||||
|
String get selected_players;
|
||||||
|
|
||||||
|
/// Settings label
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Settings'**
|
||||||
|
String get settings;
|
||||||
|
|
||||||
|
/// Title for single loser ruleset
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Single Loser'**
|
||||||
|
String get single_loser;
|
||||||
|
|
||||||
|
/// Title for single winner ruleset
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Single Winner'**
|
||||||
|
String get single_winner;
|
||||||
|
|
||||||
/// Statistics tab label
|
/// Statistics tab label
|
||||||
///
|
///
|
||||||
@@ -500,11 +524,11 @@ abstract class AppLocalizations {
|
|||||||
/// **'Stats'**
|
/// **'Stats'**
|
||||||
String get stats;
|
String get stats;
|
||||||
|
|
||||||
/// Shows the number of players
|
/// Success message when adding a player
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'{count} Players'**
|
/// **'Successfully added player {playerName}'**
|
||||||
String players_count(int count);
|
String successfully_added_player(String playerName);
|
||||||
|
|
||||||
/// Message when search returns no groups
|
/// Message when search returns no groups
|
||||||
///
|
///
|
||||||
@@ -512,77 +536,53 @@ abstract class AppLocalizations {
|
|||||||
/// **'There is no group matching your search'**
|
/// **'There is no group matching your search'**
|
||||||
String get there_is_no_group_matching_your_search;
|
String get there_is_no_group_matching_your_search;
|
||||||
|
|
||||||
/// Placeholder for game name search
|
/// Warning message for irreversible actions
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'Game Name'**
|
/// **'This can\'t be undone'**
|
||||||
String get game_name;
|
String get this_cannot_be_undone;
|
||||||
|
|
||||||
/// Description for single winner ruleset
|
/// Date format for today
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'Exactly one winner is chosen; ties are resolved by a predefined tiebreaker.'**
|
/// **'Today at'**
|
||||||
String get ruleset_single_winner;
|
String get today_at;
|
||||||
|
|
||||||
/// Description for single loser ruleset
|
/// Undo button text
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'Exactly one loser is determined; last place receives the penalty or consequence.'**
|
/// **'Undo'**
|
||||||
String get ruleset_single_loser;
|
String get undo;
|
||||||
|
|
||||||
/// Description for most points ruleset
|
/// Error message for unknown exceptions
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'Traditional ruleset: the player with the most points wins.'**
|
/// **'Unknown Exception (see console)'**
|
||||||
String get ruleset_most_points;
|
String get unknown_exception;
|
||||||
|
|
||||||
/// Description for least points ruleset
|
/// Winner label
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'Inverse scoring: the player with the fewest points wins.'**
|
/// **'Winner'**
|
||||||
String get ruleset_least_points;
|
String get winner;
|
||||||
|
|
||||||
/// Title for single winner ruleset
|
/// Label for winrate statistic
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'Single Winner'**
|
/// **'Winrate'**
|
||||||
String get single_winner;
|
String get winrate;
|
||||||
|
|
||||||
/// Title for single loser ruleset
|
/// Label for wins statistic
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'Single Loser'**
|
/// **'Wins'**
|
||||||
String get single_loser;
|
String get wins;
|
||||||
|
|
||||||
/// Title for most points ruleset
|
/// Date format for yesterday
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// In en, this message translates to:
|
||||||
/// **'Most Points'**
|
/// **'Yesterday at'**
|
||||||
String get most_points;
|
String get yesterday_at;
|
||||||
|
|
||||||
/// Title for least points ruleset
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Least Points'**
|
|
||||||
String get least_points;
|
|
||||||
|
|
||||||
/// Hint text for player search input field
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Search for players'**
|
|
||||||
String get search_for_players;
|
|
||||||
|
|
||||||
/// Hint text for group search input field
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Search for groups'**
|
|
||||||
String get search_for_groups;
|
|
||||||
|
|
||||||
/// Abbreviation for not available
|
|
||||||
///
|
|
||||||
/// In en, this message translates to:
|
|
||||||
/// **'Not available'**
|
|
||||||
String get not_available;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AppLocalizationsDelegate
|
class _AppLocalizationsDelegate
|
||||||
|
|||||||
@@ -9,188 +9,158 @@ class AppLocalizationsDe extends AppLocalizations {
|
|||||||
AppLocalizationsDe([String locale = 'de']) : super(locale);
|
AppLocalizationsDe([String locale = 'de']) : super(locale);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get choose_group => 'Gruppe wählen';
|
String get all_players => 'Alle Spieler:innen';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get create_new_match => 'Neues Match erstellen';
|
String get all_players_selected => 'Alle Spieler:innen ausgewählt';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get choose_ruleset => 'Regelwerk wählen';
|
String get amount_of_matches => 'Anzahl der Spiele';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get choose_game => 'Spielvorlage wählen';
|
String get app_name => 'Game Tracker';
|
||||||
|
|
||||||
@override
|
|
||||||
String get select_winner => 'Gewinner:in wählen:';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get game_tracker => 'Game Tracker';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get no_recent_matches_available => 'Keine letzten Matches verfügbar';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get no_second_match_available => 'Kein zweites Match verfügbar';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get delete_all_data => 'Alle Daten löschen?';
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get cancel => 'Abbrechen';
|
String get cancel => 'Abbrechen';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get delete => 'Löschen';
|
String get choose_game => 'Spielvorlage wählen';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get choose_group => 'Gruppe wählen';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get choose_ruleset => 'Regelwerk wählen';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String could_not_add_player(Object playerName) {
|
||||||
|
return 'Spieler:in $playerName konnte nicht hinzugefügt werden';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get create_group => 'Gruppe erstellen';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get create_match => 'Spiel erstellen';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get create_new_group => 'Neue Gruppe erstellen';
|
String get create_new_group => 'Neue Gruppe erstellen';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get create_new_match => 'Neues Spiel erstellen';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get data_successfully_deleted => 'Daten erfolgreich gelöscht';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get data_successfully_exported => 'Daten erfolgreich exportiert';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get data_successfully_imported => 'Daten erfolgreich importiert';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String days_ago(int count) {
|
||||||
|
return 'vor $count Tagen';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get delete => 'Löschen';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get delete_all_data => 'Alle Daten löschen';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get error_creating_group =>
|
String get error_creating_group =>
|
||||||
'Fehler beim Erstellen der Gruppe, bitte erneut versuchen';
|
'Fehler beim Erstellen der Gruppe, bitte erneut versuchen';
|
||||||
|
|
||||||
@override
|
|
||||||
String selected_players(int count) {
|
|
||||||
final intl.NumberFormat countNumberFormat = intl.NumberFormat.compact(
|
|
||||||
locale: localeName,
|
|
||||||
);
|
|
||||||
final String countString = countNumberFormat.format(count);
|
|
||||||
|
|
||||||
return 'Ausgewählte Spieler:in: $countString';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get no_players_selected => 'Keine Spieler:in ausgewählt';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get all_players => 'Alle Spieler:innen:';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String successfully_added_player(String playerName) {
|
|
||||||
return 'Spieler:in $playerName erfolgreich hinzugefügt';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String could_not_add_player(String playerName) {
|
|
||||||
return 'Spieler:in $playerName konnte nicht hinzugefügt werden';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String winner(String winnerName) {
|
|
||||||
return 'Gewinner:in: $winnerName';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get players => 'Spieler:in';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get no_statistics_available => 'Keine Statistiken verfügbar';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get no_data_available => 'Keine Daten verfügbar';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get matches => 'Matches';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get groups => 'Gruppen';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get recent_matches => 'Letzte Matches';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get quick_create => 'Schnellzugriff';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get match_in_progress => 'Match läuft...';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get menu => 'Menü';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get settings => 'Einstellungen';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get export_data => 'Daten exportieren';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get import_data => 'Daten importieren';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get this_cannot_be_undone =>
|
|
||||||
'Dies kann nicht rückgängig gemacht werden';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get data_successfully_deleted => 'Daten erfolgreich gelöscht';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get data_successfully_imported => 'Daten erfolgreich importiert';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get invalid_schema => 'Ungültiges Schema';
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get error_reading_file => 'Fehler beim Lesen der Datei';
|
String get error_reading_file => 'Fehler beim Lesen der Datei';
|
||||||
|
|
||||||
@override
|
|
||||||
String get import_canceled => 'Import abgebrochen';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get format_exception => 'Formatfehler (siehe Konsole)';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get unknown_exception => 'Unbekannter Fehler (siehe Konsole)';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get data_successfully_exported => 'Daten erfolgreich exportiert';
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get export_canceled => 'Export abgebrochen';
|
String get export_canceled => 'Export abgebrochen';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get undo => 'Rückgängig';
|
String get export_data => 'Daten exportieren';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get wins => 'Siege';
|
String get format_exception => 'Formatfehler (siehe Konsole)';
|
||||||
|
|
||||||
@override
|
|
||||||
String get winrate => 'Siegquote';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get amount_of_matches => 'Anzahl der Matches';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get info => 'Info';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get no_groups_created_yet => 'Noch keine Gruppen erstellt';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get no_players_created_yet => 'Noch keine Spieler:in erstellt';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get create_group => 'Gruppe erstellen';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get group_name => 'Gruppenname';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get player_name => 'Spieler:innenname';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get no_matches_created_yet => 'Noch keine Matches erstellt';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get match_name => 'Matchname';
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get game => 'Spielvorlage';
|
String get game => 'Spielvorlage';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get ruleset => 'Regelwerk';
|
String get game_name => 'Spielvorlagenname';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get group => 'Gruppe';
|
String get group => 'Gruppe';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get group_name => 'Gruppenname';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get groups => 'Gruppen';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get home => 'Startseite';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get import_canceled => 'Import abgebrochen';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get import_data => 'Daten importieren';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get info => 'Info';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get invalid_schema => 'Ungültiges Schema';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get least_points => 'Niedrigste Punkte';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get match_in_progress => 'Spiel läuft...';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get match_name => 'Spieltitel';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get matches => 'Spiele';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get menu => 'Menü';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get most_points => 'Höchste Punkte';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get no_data_available => 'Keine Daten verfügbar';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get no_groups_created_yet => 'Noch keine Gruppen erstellt';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get no_matches_created_yet => 'Noch keine Spiele erstellt';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get no_players_created_yet => 'Noch keine Spieler:in erstellt';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get no_players_found_with_that_name =>
|
||||||
|
'Keine Spieler:in mit diesem Namen gefunden';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get no_players_selected => 'Keine Spieler:innen ausgewählt';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get no_recent_matches_available => 'Keine letzten Spiele verfügbar';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get no_second_match_available => 'Kein zweites Spiel verfügbar';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get no_statistics_available => 'Keine Statistiken verfügbar';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get none => 'Kein';
|
String get none => 'Kein';
|
||||||
|
|
||||||
@@ -198,32 +168,64 @@ class AppLocalizationsDe extends AppLocalizations {
|
|||||||
String get none_group => 'Keine';
|
String get none_group => 'Keine';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get create_match => 'Match erstellen';
|
String get not_available => 'Nicht verfügbar';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get no_players_found_with_that_name =>
|
String get player_name => 'Spieler:innenname';
|
||||||
'Keine Spieler:in mit diesem Namen gefunden';
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get all_players_selected => 'Alle Spieler:innen ausgewählt';
|
String get players => 'Spieler:innen';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String today_at(String time) {
|
String players_count(int count) {
|
||||||
return 'Heute um $time';
|
return '$count Spieler';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String yesterday_at(String time) {
|
String get quick_create => 'Schnellzugriff';
|
||||||
return 'Gestern um $time';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String days_ago(int count) {
|
String get recent_matches => 'Letzte Spiele';
|
||||||
return 'vor $count Tagen';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get home => 'Startseite';
|
String get ruleset => 'Regelwerk';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get ruleset_least_points =>
|
||||||
|
'Umgekehrte Wertung: Der/die Spieler:in mit den wenigsten Punkten gewinnt.';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get ruleset_most_points =>
|
||||||
|
'Traditionelles Regelwerk: Der/die Spieler:in mit den meisten Punkten gewinnt.';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get ruleset_single_loser =>
|
||||||
|
'Genau ein:e Verlierer:in wird bestimmt; der letzte Platz erhält die Strafe oder Konsequenz.';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get ruleset_single_winner =>
|
||||||
|
'Genau ein:e Gewinner:in wird gewählt; Unentschieden werden durch einen vordefinierten Tie-Breaker aufgelöst.';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get search_for_groups => 'Nach Gruppen suchen';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get search_for_players => 'Nach Spieler:innen suchen';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get select_winner => 'Gewinner:in wählen:';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get selected_players => 'Ausgewählte Spieler:innen';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settings => 'Einstellungen';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get single_loser => 'Ein:e Verlierer:in';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get single_winner => 'Ein:e Gewinner:in';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get statistics => 'Statistiken';
|
String get statistics => 'Statistiken';
|
||||||
@@ -232,8 +234,8 @@ class AppLocalizationsDe extends AppLocalizations {
|
|||||||
String get stats => 'Statistiken';
|
String get stats => 'Statistiken';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String players_count(int count) {
|
String successfully_added_player(String playerName) {
|
||||||
return '$count Spieler';
|
return 'Spieler:in $playerName erfolgreich hinzugefügt';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -241,42 +243,27 @@ class AppLocalizationsDe extends AppLocalizations {
|
|||||||
'Es gibt keine Gruppe, die deiner Suche entspricht';
|
'Es gibt keine Gruppe, die deiner Suche entspricht';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get game_name => 'Spielvorlagenname';
|
String get this_cannot_be_undone =>
|
||||||
|
'Dies kann nicht rückgängig gemacht werden';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get ruleset_single_winner =>
|
String get today_at => 'Heute um';
|
||||||
'Genau ein:e Gewinner:in wird gewählt; Unentschieden werden durch einen vordefinierten Tie-Breaker aufgelöst.';
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get ruleset_single_loser =>
|
String get undo => 'Rückgängig';
|
||||||
'Genau ein:e Verlierer:in wird bestimmt; der letzte Platz erhält die Strafe oder Konsequenz.';
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get ruleset_most_points =>
|
String get unknown_exception => 'Unbekannter Fehler (siehe Konsole)';
|
||||||
'Traditionelles Regelwerk: Der/die Spieler:in mit den meisten Punkten gewinnt.';
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get ruleset_least_points =>
|
String get winner => 'Gewinner:in';
|
||||||
'Umgekehrte Wertung: Der/die Spieler:in mit den wenigsten Punkten gewinnt.';
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get single_winner => 'Ein:e Gewinner:in';
|
String get winrate => 'Siegquote';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get single_loser => 'Ein:e Verlierer:in';
|
String get wins => 'Siege';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get most_points => 'Höchste Punkte';
|
String get yesterday_at => 'Gestern um';
|
||||||
|
|
||||||
@override
|
|
||||||
String get least_points => 'Niedrigste Punkte';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get search_for_players => 'Nach Spieler:innen suchen';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get search_for_groups => 'Nach Gruppen suchen';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get not_available => 'Nicht verfügbar';
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,22 +9,148 @@ class AppLocalizationsEn extends AppLocalizations {
|
|||||||
AppLocalizationsEn([String locale = 'en']) : super(locale);
|
AppLocalizationsEn([String locale = 'en']) : super(locale);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get choose_group => 'Choose Group';
|
String get all_players => 'All players';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get create_new_match => 'Create new match';
|
String get all_players_selected => 'All players selected';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get choose_ruleset => 'Choose Ruleset';
|
String get amount_of_matches => 'Amount of Matches';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get app_name => 'Game Tracker';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get cancel => 'Cancel';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get choose_game => 'Choose Game';
|
String get choose_game => 'Choose Game';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get select_winner => 'Select Winner:';
|
String get choose_group => 'Choose Group';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get game_tracker => 'Game Tracker';
|
String get choose_ruleset => 'Choose Ruleset';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String could_not_add_player(Object playerName) {
|
||||||
|
return 'Could not add player';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get create_group => 'Create Group';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get create_match => 'Create match';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get create_new_group => 'Create new group';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get create_new_match => 'Create new match';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get data_successfully_deleted => 'Data successfully deleted';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get data_successfully_exported => 'Data successfully exported';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get data_successfully_imported => 'Data successfully imported';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String days_ago(int count) {
|
||||||
|
return '$count days ago';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get delete => 'Delete';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get delete_all_data => 'Delete all data';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get error_creating_group =>
|
||||||
|
'Error while creating group, please try again';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get error_reading_file => 'Error reading file';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get export_canceled => 'Export canceled';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get export_data => 'Export data';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get format_exception => 'Format Exception (see console)';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get game => 'Game';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get game_name => 'Game Name';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get group => 'Group';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get group_name => 'Group name';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get groups => 'Groups';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get home => 'Home';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get import_canceled => 'Import canceled';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get import_data => 'Import data';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get info => 'Info';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get invalid_schema => 'Invalid Schema';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get least_points => 'Least Points';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get match_in_progress => 'Match in progress...';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get match_name => 'Match name';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get matches => 'Matches';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get menu => 'Menu';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get most_points => 'Most Points';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get no_data_available => 'No data available';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get no_groups_created_yet => 'No groups created yet';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get no_matches_created_yet => 'No matches created yet';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get no_players_created_yet => 'No players created yet';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get no_players_found_with_that_name =>
|
||||||
|
'No players found with that name';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get no_players_selected => 'No players selected';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get no_recent_matches_available => 'No recent matches available';
|
String get no_recent_matches_available => 'No recent matches available';
|
||||||
@@ -32,164 +158,9 @@ class AppLocalizationsEn extends AppLocalizations {
|
|||||||
@override
|
@override
|
||||||
String get no_second_match_available => 'No second match available';
|
String get no_second_match_available => 'No second match available';
|
||||||
|
|
||||||
@override
|
|
||||||
String get delete_all_data => 'Delete all data?';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get cancel => 'Cancel';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get delete => 'Delete';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get create_new_group => 'Create new group';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get error_creating_group =>
|
|
||||||
'Error while creating group, please try again';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String selected_players(int count) {
|
|
||||||
final intl.NumberFormat countNumberFormat = intl.NumberFormat.compact(
|
|
||||||
locale: localeName,
|
|
||||||
);
|
|
||||||
final String countString = countNumberFormat.format(count);
|
|
||||||
|
|
||||||
return 'Selected players: $countString';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get no_players_selected => 'No players selected';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get all_players => 'All players:';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String successfully_added_player(String playerName) {
|
|
||||||
return 'Successfully added player $playerName';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String could_not_add_player(String playerName) {
|
|
||||||
return 'Could not add player $playerName';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String winner(String winnerName) {
|
|
||||||
return 'Winner: $winnerName';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get players => 'Players';
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get no_statistics_available => 'No statistics available';
|
String get no_statistics_available => 'No statistics available';
|
||||||
|
|
||||||
@override
|
|
||||||
String get no_data_available => 'No data available';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get matches => 'Matches';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get groups => 'Groups';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get recent_matches => 'Recent Matches';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get quick_create => 'Quick Create';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get match_in_progress => 'Match in progress...';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get menu => 'Menu';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get settings => 'Settings';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get export_data => 'Export data';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get import_data => 'Import data';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get this_cannot_be_undone => 'This can\'t be undone';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get data_successfully_deleted => 'Data successfully deleted';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get data_successfully_imported => 'Data successfully imported';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get invalid_schema => 'Invalid Schema';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get error_reading_file => 'Error reading file';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get import_canceled => 'Import canceled';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get format_exception => 'Format Exception (see console)';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get unknown_exception => 'Unknown Exception (see console)';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get data_successfully_exported => 'Data successfully exported';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get export_canceled => 'Export canceled';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get undo => 'Undo';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get wins => 'Wins';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get winrate => 'Winrate';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get amount_of_matches => 'Amount of Matches';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get info => 'Info';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get no_groups_created_yet => 'No groups created yet';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get no_players_created_yet => 'No players created yet';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get create_group => 'Create Group';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get group_name => 'Group name';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get player_name => 'Player name';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get no_matches_created_yet => 'No matches created yet';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get match_name => 'Match name';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get game => 'Game';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get ruleset => 'Ruleset';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get group => 'Group';
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get none => 'None';
|
String get none => 'None';
|
||||||
|
|
||||||
@@ -197,32 +168,64 @@ class AppLocalizationsEn extends AppLocalizations {
|
|||||||
String get none_group => 'None';
|
String get none_group => 'None';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get create_match => 'Create match';
|
String get not_available => 'Not available';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get no_players_found_with_that_name =>
|
String get player_name => 'Player name';
|
||||||
'No players found with that name';
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get all_players_selected => 'All players selected';
|
String get players => 'Players';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String today_at(String time) {
|
String players_count(int count) {
|
||||||
return 'Today at $time';
|
return '$count Players';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String yesterday_at(String time) {
|
String get quick_create => 'Quick Create';
|
||||||
return 'Yesterday at $time';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String days_ago(int count) {
|
String get recent_matches => 'Recent Matches';
|
||||||
return '$count days ago';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get home => 'Home';
|
String get ruleset => 'Ruleset';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get ruleset_least_points =>
|
||||||
|
'Inverse scoring: the player with the fewest points wins.';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get ruleset_most_points =>
|
||||||
|
'Traditional ruleset: the player with the most points wins.';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get ruleset_single_loser =>
|
||||||
|
'Exactly one loser is determined; last place receives the penalty or consequence.';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get ruleset_single_winner =>
|
||||||
|
'Exactly one winner is chosen; ties are resolved by a predefined tiebreaker.';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get search_for_groups => 'Search for groups';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get search_for_players => 'Search for players';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get select_winner => 'Select Winner:';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get selected_players => 'Selected players';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settings => 'Settings';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get single_loser => 'Single Loser';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get single_winner => 'Single Winner';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get statistics => 'Statistics';
|
String get statistics => 'Statistics';
|
||||||
@@ -231,8 +234,8 @@ class AppLocalizationsEn extends AppLocalizations {
|
|||||||
String get stats => 'Stats';
|
String get stats => 'Stats';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String players_count(int count) {
|
String successfully_added_player(String playerName) {
|
||||||
return '$count Players';
|
return 'Successfully added player $playerName';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -240,42 +243,26 @@ class AppLocalizationsEn extends AppLocalizations {
|
|||||||
'There is no group matching your search';
|
'There is no group matching your search';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get game_name => 'Game Name';
|
String get this_cannot_be_undone => 'This can\'t be undone';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get ruleset_single_winner =>
|
String get today_at => 'Today at';
|
||||||
'Exactly one winner is chosen; ties are resolved by a predefined tiebreaker.';
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get ruleset_single_loser =>
|
String get undo => 'Undo';
|
||||||
'Exactly one loser is determined; last place receives the penalty or consequence.';
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get ruleset_most_points =>
|
String get unknown_exception => 'Unknown Exception (see console)';
|
||||||
'Traditional ruleset: the player with the most points wins.';
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get ruleset_least_points =>
|
String get winner => 'Winner';
|
||||||
'Inverse scoring: the player with the fewest points wins.';
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get single_winner => 'Single Winner';
|
String get winrate => 'Winrate';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get single_loser => 'Single Loser';
|
String get wins => 'Wins';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get most_points => 'Most Points';
|
String get yesterday_at => 'Yesterday at';
|
||||||
|
|
||||||
@override
|
|
||||||
String get least_points => 'Least Points';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get search_for_players => 'Search for players';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get search_for_groups => 'Search for groups';
|
|
||||||
|
|
||||||
@override
|
|
||||||
String get not_available => 'Not available';
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,21 +34,23 @@ class GameTracker extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
onGenerateTitle: (context) => AppLocalizations.of(context).game_tracker,
|
onGenerateTitle: (context) => AppLocalizations.of(context).app_name,
|
||||||
darkTheme: ThemeData.dark(),
|
|
||||||
|
|
||||||
themeMode: ThemeMode.dark, // forces dark mode
|
themeMode: ThemeMode.dark, // forces dark mode
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
primaryColor: CustomTheme.primaryColor,
|
primaryColor: CustomTheme.primaryColor,
|
||||||
scaffoldBackgroundColor: CustomTheme.backgroundColor,
|
scaffoldBackgroundColor: CustomTheme.backgroundColor,
|
||||||
appBarTheme: CustomTheme.appBarTheme,
|
appBarTheme: CustomTheme.appBarTheme,
|
||||||
|
|
||||||
colorScheme: ColorScheme.fromSeed(
|
colorScheme: ColorScheme.fromSeed(
|
||||||
seedColor: CustomTheme.primaryColor,
|
seedColor: CustomTheme.primaryColor,
|
||||||
brightness: Brightness.dark,
|
brightness: Brightness.dark,
|
||||||
).copyWith(surface: CustomTheme.backgroundColor),
|
).copyWith(surface: CustomTheme.backgroundColor),
|
||||||
|
pageTransitionsTheme: const PageTransitionsTheme(
|
||||||
|
builders: {
|
||||||
|
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
|
||||||
|
TargetPlatform.android: PredictiveBackPageTransitionsBuilder(),
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
home: const CustomNavigationBar(),
|
home: const CustomNavigationBar(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:game_tracker/core/adaptive_page_route.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
||||||
import 'package:game_tracker/presentation/views/main_menu/group_view/groups_view.dart';
|
import 'package:game_tracker/presentation/views/main_menu/group_view/groups_view.dart';
|
||||||
@@ -17,7 +18,10 @@ class CustomNavigationBar extends StatefulWidget {
|
|||||||
|
|
||||||
class _CustomNavigationBarState extends State<CustomNavigationBar>
|
class _CustomNavigationBarState extends State<CustomNavigationBar>
|
||||||
with SingleTickerProviderStateMixin {
|
with SingleTickerProviderStateMixin {
|
||||||
|
/// Currently selected tab index
|
||||||
int currentIndex = 0;
|
int currentIndex = 0;
|
||||||
|
|
||||||
|
/// Key count to force rebuild of tab views
|
||||||
int tabKeyCount = 0;
|
int tabKeyCount = 0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -53,7 +57,7 @@ class _CustomNavigationBarState extends State<CustomNavigationBar>
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await Navigator.push(
|
await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (_) => const SettingsView()),
|
adaptivePageRoute(builder: (_) => const SettingsView()),
|
||||||
);
|
);
|
||||||
setState(() {
|
setState(() {
|
||||||
tabKeyCount++;
|
tabKeyCount++;
|
||||||
@@ -119,12 +123,14 @@ class _CustomNavigationBarState extends State<CustomNavigationBar>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Handles tab tap events. Updates the current [index] state.
|
||||||
void onTabTapped(int index) {
|
void onTabTapped(int index) {
|
||||||
setState(() {
|
setState(() {
|
||||||
currentIndex = index;
|
currentIndex = index;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the title of the current tab based on [currentIndex].
|
||||||
String _currentTabTitle(context) {
|
String _currentTabTitle(context) {
|
||||||
final loc = AppLocalizations.of(context);
|
final loc = AppLocalizations.of(context);
|
||||||
switch (currentIndex) {
|
switch (currentIndex) {
|
||||||
|
|||||||
@@ -18,15 +18,17 @@ class CreateGroupView extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _CreateGroupViewState extends State<CreateGroupView> {
|
class _CreateGroupViewState extends State<CreateGroupView> {
|
||||||
final _groupNameController = TextEditingController();
|
|
||||||
late final AppDatabase db;
|
late final AppDatabase db;
|
||||||
|
|
||||||
|
/// Controller for the group name input field
|
||||||
|
final _groupNameController = TextEditingController();
|
||||||
|
|
||||||
|
/// List of currently selected players
|
||||||
List<Player> selectedPlayers = [];
|
List<Player> selectedPlayers = [];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
db = Provider.of<AppDatabase>(context, listen: false);
|
db = Provider.of<AppDatabase>(context, listen: false);
|
||||||
_groupNameController.addListener(() {
|
_groupNameController.addListener(() {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
@@ -42,78 +44,68 @@ class _CreateGroupViewState extends State<CreateGroupView> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final loc = AppLocalizations.of(context);
|
final loc = AppLocalizations.of(context);
|
||||||
return Scaffold(
|
return ScaffoldMessenger(
|
||||||
backgroundColor: CustomTheme.backgroundColor,
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
|
||||||
backgroundColor: CustomTheme.backgroundColor,
|
backgroundColor: CustomTheme.backgroundColor,
|
||||||
scrolledUnderElevation: 0,
|
appBar: AppBar(title: Text(loc.create_new_group)),
|
||||||
title: Text(
|
body: SafeArea(
|
||||||
loc.create_new_group,
|
child: Column(
|
||||||
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
),
|
children: [
|
||||||
centerTitle: true,
|
Container(
|
||||||
),
|
margin: CustomTheme.standardMargin,
|
||||||
body: SafeArea(
|
child: TextInputField(
|
||||||
child: Column(
|
controller: _groupNameController,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
hintText: loc.group_name,
|
||||||
children: [
|
),
|
||||||
Container(
|
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
|
|
||||||
child: TextInputField(
|
|
||||||
controller: _groupNameController,
|
|
||||||
hintText: loc.group_name,
|
|
||||||
onChanged: (value) {
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
Expanded(
|
||||||
Expanded(
|
child: PlayerSelection(
|
||||||
child: PlayerSelection(
|
onChanged: (value) {
|
||||||
onChanged: (value) {
|
setState(() {
|
||||||
setState(() {
|
selectedPlayers = [...value];
|
||||||
selectedPlayers = [...value];
|
});
|
||||||
});
|
},
|
||||||
},
|
),
|
||||||
),
|
),
|
||||||
),
|
CustomWidthButton(
|
||||||
CustomWidthButton(
|
text: loc.create_group,
|
||||||
text: loc.create_group,
|
sizeRelativeToWidth: 0.95,
|
||||||
sizeRelativeToWidth: 0.95,
|
buttonType: ButtonType.primary,
|
||||||
buttonType: ButtonType.primary,
|
onPressed:
|
||||||
onPressed:
|
(_groupNameController.text.isEmpty ||
|
||||||
(_groupNameController.text.isEmpty ||
|
(selectedPlayers.length < 2))
|
||||||
(selectedPlayers.length < 2))
|
? null
|
||||||
? null
|
: () async {
|
||||||
: () async {
|
bool success = await db.groupDao.addGroup(
|
||||||
bool success = await db.groupDao.addGroup(
|
group: Group(
|
||||||
group: Group(
|
name: _groupNameController.text.trim(),
|
||||||
name: _groupNameController.text.trim(),
|
members: selectedPlayers,
|
||||||
members: selectedPlayers,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
if (!context.mounted) return;
|
|
||||||
if (success) {
|
|
||||||
Navigator.pop(context);
|
|
||||||
} else {
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
SnackBar(
|
|
||||||
backgroundColor: CustomTheme.boxColor,
|
|
||||||
content: Center(
|
|
||||||
child: Text(
|
|
||||||
AppLocalizations.of(
|
|
||||||
context,
|
|
||||||
).error_creating_group,
|
|
||||||
style: const TextStyle(color: Colors.white),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
if (!context.mounted) return;
|
||||||
setState(() {});
|
if (success) {
|
||||||
},
|
Navigator.pop(context);
|
||||||
),
|
} else {
|
||||||
const SizedBox(height: 20),
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
],
|
SnackBar(
|
||||||
|
backgroundColor: CustomTheme.boxColor,
|
||||||
|
content: Center(
|
||||||
|
child: Text(
|
||||||
|
AppLocalizations.of(
|
||||||
|
context,
|
||||||
|
).error_creating_group,
|
||||||
|
style: const TextStyle(color: Colors.white),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:game_tracker/core/adaptive_page_route.dart';
|
||||||
import 'package:game_tracker/core/constants.dart';
|
import 'package:game_tracker/core/constants.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
import 'package:game_tracker/data/db/database.dart';
|
import 'package:game_tracker/data/db/database.dart';
|
||||||
@@ -21,7 +22,11 @@ class GroupsView extends StatefulWidget {
|
|||||||
|
|
||||||
class _GroupsViewState extends State<GroupsView> {
|
class _GroupsViewState extends State<GroupsView> {
|
||||||
late final AppDatabase db;
|
late final AppDatabase db;
|
||||||
|
|
||||||
|
/// Loaded groups from the database
|
||||||
late List<Group> loadedGroups;
|
late List<Group> loadedGroups;
|
||||||
|
|
||||||
|
/// Loading state
|
||||||
bool isLoading = true;
|
bool isLoading = true;
|
||||||
|
|
||||||
List<Group> groups = List.filled(
|
List<Group> groups = List.filled(
|
||||||
@@ -81,7 +86,7 @@ class _GroupsViewState extends State<GroupsView> {
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await Navigator.push(
|
await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
adaptivePageRoute(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return const CreateGroupView();
|
return const CreateGroupView();
|
||||||
},
|
},
|
||||||
@@ -101,7 +106,7 @@ class _GroupsViewState extends State<GroupsView> {
|
|||||||
void loadGroups() {
|
void loadGroups() {
|
||||||
Future.wait([
|
Future.wait([
|
||||||
db.groupDao.getAllGroups(),
|
db.groupDao.getAllGroups(),
|
||||||
Future.delayed(minimumSkeletonDuration),
|
Future.delayed(Constants.minimumSkeletonDuration),
|
||||||
]).then((results) {
|
]).then((results) {
|
||||||
loadedGroups = results[0] as List<Group>;
|
loadedGroups = results[0] as List<Group>;
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:game_tracker/core/adaptive_page_route.dart';
|
||||||
import 'package:game_tracker/core/constants.dart';
|
import 'package:game_tracker/core/constants.dart';
|
||||||
import 'package:game_tracker/data/db/database.dart';
|
import 'package:game_tracker/data/db/database.dart';
|
||||||
import 'package:game_tracker/data/dto/group.dart';
|
import 'package:game_tracker/data/dto/group.dart';
|
||||||
import 'package:game_tracker/data/dto/match.dart';
|
import 'package:game_tracker/data/dto/match.dart';
|
||||||
import 'package:game_tracker/data/dto/player.dart';
|
import 'package:game_tracker/data/dto/player.dart';
|
||||||
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
||||||
|
import 'package:game_tracker/presentation/views/main_menu/match_view/match_result_view.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/app_skeleton.dart';
|
import 'package:game_tracker/presentation/widgets/app_skeleton.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/buttons/quick_create_button.dart';
|
import 'package:game_tracker/presentation/widgets/buttons/quick_create_button.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/tiles/info_tile.dart';
|
import 'package:game_tracker/presentation/widgets/tiles/info_tile.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/tiles/match_summary_tile.dart';
|
import 'package:game_tracker/presentation/widgets/tiles/match_tile.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/tiles/quick_info_tile.dart';
|
import 'package:game_tracker/presentation/widgets/tiles/quick_info_tile.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
@@ -21,9 +23,17 @@ class HomeView extends StatefulWidget {
|
|||||||
|
|
||||||
class _HomeViewState extends State<HomeView> {
|
class _HomeViewState extends State<HomeView> {
|
||||||
bool isLoading = true;
|
bool isLoading = true;
|
||||||
|
|
||||||
|
/// Amount of matches in the database
|
||||||
int matchCount = 0;
|
int matchCount = 0;
|
||||||
|
|
||||||
|
/// Amount of groups in the database
|
||||||
int groupCount = 0;
|
int groupCount = 0;
|
||||||
|
|
||||||
|
/// Loaded recent matches from the database
|
||||||
List<Match> loadedRecentMatches = [];
|
List<Match> loadedRecentMatches = [];
|
||||||
|
|
||||||
|
/// Recent matches to display, initially filled with skeleton matches
|
||||||
List<Match> recentMatches = List.filled(
|
List<Match> recentMatches = List.filled(
|
||||||
2,
|
2,
|
||||||
Match(
|
Match(
|
||||||
@@ -35,39 +45,13 @@ class _HomeViewState extends State<HomeView> {
|
|||||||
Player(name: 'Skeleton Player 2'),
|
Player(name: 'Skeleton Player 2'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
winner: Player(name: 'Skeleton Player 1'),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
final db = Provider.of<AppDatabase>(context, listen: false);
|
loadHomeViewData();
|
||||||
Future.wait([
|
|
||||||
db.matchDao.getMatchCount(),
|
|
||||||
db.groupDao.getGroupCount(),
|
|
||||||
db.matchDao.getAllMatches(),
|
|
||||||
Future.delayed(minimumSkeletonDuration),
|
|
||||||
]).then((results) {
|
|
||||||
matchCount = results[0] as int;
|
|
||||||
groupCount = results[1] as int;
|
|
||||||
loadedRecentMatches = results[2] as List<Match>;
|
|
||||||
recentMatches =
|
|
||||||
(loadedRecentMatches
|
|
||||||
..sort((a, b) => b.createdAt.compareTo(a.createdAt)))
|
|
||||||
.take(2)
|
|
||||||
.toList();
|
|
||||||
if (loadedRecentMatches.length < 2) {
|
|
||||||
recentMatches.add(
|
|
||||||
Match(name: 'Dummy Match', winner: null, group: null, players: null),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (mounted) {
|
|
||||||
setState(() {
|
|
||||||
isLoading = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -107,121 +91,92 @@ class _HomeViewState extends State<HomeView> {
|
|||||||
child: InfoTile(
|
child: InfoTile(
|
||||||
width: constraints.maxWidth * 0.95,
|
width: constraints.maxWidth * 0.95,
|
||||||
title: loc.recent_matches,
|
title: loc.recent_matches,
|
||||||
icon: Icons.timer,
|
icon: Icons.history_rounded,
|
||||||
content: Padding(
|
content: Column(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 40.0),
|
children: [
|
||||||
child: Visibility(
|
if (recentMatches.isNotEmpty)
|
||||||
visible: !isLoading && loadedRecentMatches.isNotEmpty,
|
for (Match match in recentMatches)
|
||||||
replacement: Center(
|
Padding(
|
||||||
heightFactor: 12,
|
padding: const EdgeInsets.symmetric(
|
||||||
child: Text(
|
vertical: 6.0,
|
||||||
AppLocalizations.of(
|
),
|
||||||
context,
|
child: MatchTile(
|
||||||
).no_recent_matches_available,
|
compact: true,
|
||||||
|
width: constraints.maxWidth * 0.9,
|
||||||
|
match: match,
|
||||||
|
onTap: () async {
|
||||||
|
await Navigator.of(context).push(
|
||||||
|
adaptivePageRoute(
|
||||||
|
fullscreenDialog: true,
|
||||||
|
builder: (context) =>
|
||||||
|
MatchResultView(match: match),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
await updatedWinnerinRecentMatches(match.id);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
else
|
||||||
|
Center(
|
||||||
|
heightFactor: 5,
|
||||||
|
child: Text(loc.no_recent_matches_available),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
MatchSummaryTile(
|
|
||||||
matchTitle: recentMatches[0].name,
|
|
||||||
game: 'Winner',
|
|
||||||
ruleset: 'Ruleset',
|
|
||||||
players: _getPlayerText(
|
|
||||||
recentMatches[0],
|
|
||||||
context,
|
|
||||||
),
|
|
||||||
winner: recentMatches[0].winner == null
|
|
||||||
? AppLocalizations.of(
|
|
||||||
context,
|
|
||||||
).match_in_progress
|
|
||||||
: recentMatches[0].winner!.name,
|
|
||||||
),
|
|
||||||
const Padding(
|
|
||||||
padding: EdgeInsets.symmetric(vertical: 8.0),
|
|
||||||
child: Divider(),
|
|
||||||
),
|
|
||||||
if (loadedRecentMatches.length > 1) ...[
|
|
||||||
MatchSummaryTile(
|
|
||||||
matchTitle: recentMatches[1].name,
|
|
||||||
game: 'Winner',
|
|
||||||
ruleset: 'Ruleset',
|
|
||||||
players: _getPlayerText(
|
|
||||||
recentMatches[1],
|
|
||||||
context,
|
|
||||||
),
|
|
||||||
winner: recentMatches[1].winner == null
|
|
||||||
? AppLocalizations.of(
|
|
||||||
context,
|
|
||||||
).match_in_progress
|
|
||||||
: recentMatches[1].winner!.name,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
] else ...[
|
|
||||||
Center(
|
|
||||||
heightFactor: 5.35,
|
|
||||||
child: Text(
|
|
||||||
AppLocalizations.of(
|
|
||||||
context,
|
|
||||||
).no_second_match_available,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
InfoTile(
|
Padding(
|
||||||
width: constraints.maxWidth * 0.95,
|
padding: EdgeInsets.zero,
|
||||||
title: loc.quick_create,
|
child: InfoTile(
|
||||||
icon: Icons.add_box_rounded,
|
width: constraints.maxWidth * 0.95,
|
||||||
content: Column(
|
title: loc.quick_create,
|
||||||
children: [
|
icon: Icons.add_box_rounded,
|
||||||
Row(
|
content: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
children: [
|
||||||
children: [
|
Row(
|
||||||
QuickCreateButton(
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
text: 'Category 1',
|
children: [
|
||||||
onPressed: () {},
|
QuickCreateButton(
|
||||||
),
|
text: 'Category 1',
|
||||||
QuickCreateButton(
|
onPressed: () {},
|
||||||
text: 'Category 2',
|
),
|
||||||
onPressed: () {},
|
QuickCreateButton(
|
||||||
),
|
text: 'Category 2',
|
||||||
],
|
onPressed: () {},
|
||||||
),
|
),
|
||||||
Row(
|
],
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
),
|
||||||
children: [
|
Row(
|
||||||
QuickCreateButton(
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
text: 'Category 3',
|
children: [
|
||||||
onPressed: () {},
|
QuickCreateButton(
|
||||||
),
|
text: 'Category 3',
|
||||||
QuickCreateButton(
|
onPressed: () {},
|
||||||
text: 'Category 4',
|
),
|
||||||
onPressed: () {},
|
QuickCreateButton(
|
||||||
),
|
text: 'Category 4',
|
||||||
],
|
onPressed: () {},
|
||||||
),
|
),
|
||||||
Row(
|
],
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
),
|
||||||
children: [
|
Row(
|
||||||
QuickCreateButton(
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
text: 'Category 5',
|
children: [
|
||||||
onPressed: () {},
|
QuickCreateButton(
|
||||||
),
|
text: 'Category 5',
|
||||||
QuickCreateButton(
|
onPressed: () {},
|
||||||
text: 'Category 6',
|
),
|
||||||
onPressed: () {},
|
QuickCreateButton(
|
||||||
),
|
text: 'Category 6',
|
||||||
],
|
onPressed: () {},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
SizedBox(height: MediaQuery.paddingOf(context).bottom),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -230,15 +185,41 @@ class _HomeViewState extends State<HomeView> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String _getPlayerText(Match game, context) {
|
/// Loads the data for the HomeView from the database.
|
||||||
final loc = AppLocalizations.of(context);
|
/// This includes the match count, group count, and recent matches.
|
||||||
if (game.group == null) {
|
Future<void> loadHomeViewData() async {
|
||||||
final playerCount = game.players?.length ?? 0;
|
final db = Provider.of<AppDatabase>(context, listen: false);
|
||||||
return loc.players_count(playerCount);
|
Future.wait([
|
||||||
|
db.matchDao.getMatchCount(),
|
||||||
|
db.groupDao.getGroupCount(),
|
||||||
|
db.matchDao.getAllMatches(),
|
||||||
|
Future.delayed(Constants.minimumSkeletonDuration),
|
||||||
|
]).then((results) {
|
||||||
|
matchCount = results[0] as int;
|
||||||
|
groupCount = results[1] as int;
|
||||||
|
loadedRecentMatches = results[2] as List<Match>;
|
||||||
|
recentMatches =
|
||||||
|
(loadedRecentMatches
|
||||||
|
..sort((a, b) => b.createdAt.compareTo(a.createdAt)))
|
||||||
|
.take(2)
|
||||||
|
.toList();
|
||||||
|
if (mounted) {
|
||||||
|
setState(() {
|
||||||
|
isLoading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Updates the winner information for a specific match in the recent matches list.
|
||||||
|
Future<void> updatedWinnerinRecentMatches(String matchId) async {
|
||||||
|
final db = Provider.of<AppDatabase>(context, listen: false);
|
||||||
|
final winner = await db.matchDao.getWinner(matchId: matchId);
|
||||||
|
final matchIndex = recentMatches.indexWhere((match) => match.id == matchId);
|
||||||
|
if (matchIndex != -1) {
|
||||||
|
setState(() {
|
||||||
|
recentMatches[matchIndex].winner = winner;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (game.players == null || game.players!.isEmpty) {
|
|
||||||
return game.group!.name;
|
|
||||||
}
|
|
||||||
return '${game.group!.name} + ${game.players!.length}';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,10 +20,12 @@ class ChooseGameView extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _ChooseGameViewState extends State<ChooseGameView> {
|
class _ChooseGameViewState extends State<ChooseGameView> {
|
||||||
late int selectedGameIndex;
|
/// Controller for the search bar
|
||||||
|
|
||||||
final TextEditingController searchBarController = TextEditingController();
|
final TextEditingController searchBarController = TextEditingController();
|
||||||
|
|
||||||
|
/// Currently selected game index
|
||||||
|
late int selectedGameIndex;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
selectedGameIndex = widget.initialGameIndex;
|
selectedGameIndex = widget.initialGameIndex;
|
||||||
@@ -36,19 +38,13 @@ class _ChooseGameViewState extends State<ChooseGameView> {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: CustomTheme.backgroundColor,
|
backgroundColor: CustomTheme.backgroundColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
backgroundColor: CustomTheme.backgroundColor,
|
|
||||||
scrolledUnderElevation: 0,
|
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: const Icon(Icons.arrow_back_ios),
|
icon: const Icon(Icons.arrow_back_ios),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop(selectedGameIndex);
|
Navigator.of(context).pop(selectedGameIndex);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
title: Text(
|
title: Text(loc.choose_game),
|
||||||
loc.choose_game,
|
|
||||||
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
centerTitle: true,
|
|
||||||
),
|
),
|
||||||
body: PopScope(
|
body: PopScope(
|
||||||
// This fixes that the Android Back Gesture didn't return the
|
// This fixes that the Android Back Gesture didn't return the
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ class _ChooseGroupViewState extends State<ChooseGroupView> {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: CustomTheme.backgroundColor,
|
backgroundColor: CustomTheme.backgroundColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
backgroundColor: CustomTheme.backgroundColor,
|
|
||||||
scrolledUnderElevation: 0,
|
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: const Icon(Icons.arrow_back_ios),
|
icon: const Icon(Icons.arrow_back_ios),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
@@ -52,11 +50,7 @@ class _ChooseGroupViewState extends State<ChooseGroupView> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
title: Text(
|
title: Text(loc.choose_group),
|
||||||
loc.choose_group,
|
|
||||||
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
centerTitle: true,
|
|
||||||
),
|
),
|
||||||
body: PopScope(
|
body: PopScope(
|
||||||
// This fixes that the Android Back Gesture didn't return the
|
// This fixes that the Android Back Gesture didn't return the
|
||||||
@@ -136,8 +130,7 @@ class _ChooseGroupViewState extends State<ChooseGroupView> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Filters the groups based on the search query.
|
/// Filters the groups based on the search [query].
|
||||||
/// TODO: Maybe implement also targetting player names?
|
|
||||||
void filterGroups(String query) {
|
void filterGroups(String query) {
|
||||||
setState(() {
|
setState(() {
|
||||||
if (query.isEmpty) {
|
if (query.isEmpty) {
|
||||||
@@ -147,7 +140,11 @@ class _ChooseGroupViewState extends State<ChooseGroupView> {
|
|||||||
filteredGroups.clear();
|
filteredGroups.clear();
|
||||||
filteredGroups.addAll(
|
filteredGroups.addAll(
|
||||||
widget.groups.where(
|
widget.groups.where(
|
||||||
(group) => group.name.toLowerCase().contains(query.toLowerCase()),
|
(group) =>
|
||||||
|
group.name.toLowerCase().contains(query.toLowerCase()) ||
|
||||||
|
group.members.any(
|
||||||
|
(player) => player.name.toLowerCase().contains(query.toLowerCase()),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ class ChooseRulesetView extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _ChooseRulesetViewState extends State<ChooseRulesetView> {
|
class _ChooseRulesetViewState extends State<ChooseRulesetView> {
|
||||||
|
/// Currently selected ruleset index
|
||||||
late int selectedRulesetIndex;
|
late int selectedRulesetIndex;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -36,8 +37,6 @@ class _ChooseRulesetViewState extends State<ChooseRulesetView> {
|
|||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
backgroundColor: CustomTheme.backgroundColor,
|
backgroundColor: CustomTheme.backgroundColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
backgroundColor: CustomTheme.backgroundColor,
|
|
||||||
scrolledUnderElevation: 0,
|
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: const Icon(Icons.arrow_back_ios),
|
icon: const Icon(Icons.arrow_back_ios),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
@@ -48,11 +47,7 @@ class _ChooseRulesetViewState extends State<ChooseRulesetView> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
title: Text(
|
title: Text(loc.choose_ruleset),
|
||||||
loc.choose_ruleset,
|
|
||||||
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
centerTitle: true,
|
|
||||||
),
|
),
|
||||||
body: PopScope(
|
body: PopScope(
|
||||||
// This fixes that the Android Back Gesture didn't return the
|
// This fixes that the Android Back Gesture didn't return the
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:game_tracker/core/adaptive_page_route.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
import 'package:game_tracker/core/enums.dart';
|
import 'package:game_tracker/core/enums.dart';
|
||||||
import 'package:game_tracker/data/db/database.dart';
|
import 'package:game_tracker/data/db/database.dart';
|
||||||
@@ -26,14 +26,13 @@ class CreateMatchView extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _CreateMatchViewState extends State<CreateMatchView> {
|
class _CreateMatchViewState extends State<CreateMatchView> {
|
||||||
/// Reference to the app database
|
|
||||||
late final AppDatabase db;
|
late final AppDatabase db;
|
||||||
|
|
||||||
/// Controller for the match name input field
|
/// Controller for the match name input field
|
||||||
final TextEditingController _matchNameController = TextEditingController();
|
final TextEditingController _matchNameController = TextEditingController();
|
||||||
|
|
||||||
/// Hint text for the match name input field
|
/// Hint text for the match name input field
|
||||||
String hintText = 'Match Name';
|
String? hintText;
|
||||||
|
|
||||||
/// List of all groups from the database
|
/// List of all groups from the database
|
||||||
List<Group> groupsList = [];
|
List<Group> groupsList = [];
|
||||||
@@ -68,6 +67,9 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
/// The currently selected players
|
/// The currently selected players
|
||||||
List<Player>? selectedPlayers;
|
List<Player>? selectedPlayers;
|
||||||
|
|
||||||
|
/// List of available rulesets with their localized string representations
|
||||||
|
late final List<(Ruleset, String)> _rulesets;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@@ -89,9 +91,18 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
List<(Ruleset, String)> _getRulesets(BuildContext context) {
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_matchNameController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
super.didChangeDependencies();
|
||||||
final loc = AppLocalizations.of(context);
|
final loc = AppLocalizations.of(context);
|
||||||
return [
|
hintText ??= loc.match_name;
|
||||||
|
_rulesets = [
|
||||||
(Ruleset.singleWinner, loc.ruleset_single_winner),
|
(Ruleset.singleWinner, loc.ruleset_single_winner),
|
||||||
(Ruleset.singleLoser, loc.ruleset_single_loser),
|
(Ruleset.singleLoser, loc.ruleset_single_loser),
|
||||||
(Ruleset.mostPoints, loc.ruleset_most_points),
|
(Ruleset.mostPoints, loc.ruleset_most_points),
|
||||||
@@ -108,159 +119,155 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final loc = AppLocalizations.of(context);
|
final loc = AppLocalizations.of(context);
|
||||||
return Scaffold(
|
return ScaffoldMessenger(
|
||||||
backgroundColor: CustomTheme.backgroundColor,
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
|
||||||
backgroundColor: CustomTheme.backgroundColor,
|
backgroundColor: CustomTheme.backgroundColor,
|
||||||
scrolledUnderElevation: 0,
|
appBar: AppBar(title: Text(loc.create_new_match)),
|
||||||
title: Text(
|
body: SafeArea(
|
||||||
loc.create_new_match,
|
child: Column(
|
||||||
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
),
|
children: [
|
||||||
centerTitle: true,
|
Container(
|
||||||
),
|
margin: CustomTheme.tileMargin,
|
||||||
body: SafeArea(
|
child: TextInputField(
|
||||||
child: Column(
|
controller: _matchNameController,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
hintText: hintText ?? '',
|
||||||
children: [
|
),
|
||||||
Container(
|
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 5),
|
|
||||||
child: TextInputField(
|
|
||||||
controller: _matchNameController,
|
|
||||||
hintText: hintText,
|
|
||||||
),
|
),
|
||||||
),
|
ChooseTile(
|
||||||
ChooseTile(
|
title: loc.game,
|
||||||
title: loc.game,
|
trailingText: selectedGameIndex == -1
|
||||||
trailingText: selectedGameIndex == -1
|
? loc.none
|
||||||
? loc.none
|
: games[selectedGameIndex].$1,
|
||||||
: games[selectedGameIndex].$1,
|
onPressed: () async {
|
||||||
onPressed: () async {
|
selectedGameIndex = await Navigator.of(context).push(
|
||||||
selectedGameIndex = await Navigator.of(context).push(
|
adaptivePageRoute(
|
||||||
MaterialPageRoute(
|
builder: (context) => ChooseGameView(
|
||||||
builder: (context) => ChooseGameView(
|
games: games,
|
||||||
games: games,
|
initialGameIndex: selectedGameIndex,
|
||||||
initialGameIndex: selectedGameIndex,
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
|
||||||
setState(() {
|
|
||||||
if (selectedGameIndex != -1) {
|
|
||||||
hintText = games[selectedGameIndex].$1;
|
|
||||||
selectedRuleset = games[selectedGameIndex].$3;
|
|
||||||
selectedRulesetIndex = _getRulesets(
|
|
||||||
context,
|
|
||||||
).indexWhere((r) => r.$1 == selectedRuleset);
|
|
||||||
} else {
|
|
||||||
hintText = 'Match Name';
|
|
||||||
selectedRuleset = null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
ChooseTile(
|
|
||||||
title: loc.ruleset,
|
|
||||||
trailingText: selectedRuleset == null
|
|
||||||
? loc.none
|
|
||||||
: translateRulesetToString(selectedRuleset!, context),
|
|
||||||
onPressed: () async {
|
|
||||||
final rulesets = _getRulesets(context);
|
|
||||||
selectedRuleset = await Navigator.of(context).push(
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => ChooseRulesetView(
|
|
||||||
rulesets: rulesets,
|
|
||||||
initialRulesetIndex: selectedRulesetIndex,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
if (!mounted) return;
|
|
||||||
selectedRulesetIndex = rulesets.indexWhere(
|
|
||||||
(r) => r.$1 == selectedRuleset,
|
|
||||||
);
|
|
||||||
selectedGameIndex = -1;
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
ChooseTile(
|
|
||||||
title: loc.group,
|
|
||||||
trailingText: selectedGroup == null
|
|
||||||
? loc.none_group
|
|
||||||
: selectedGroup!.name,
|
|
||||||
onPressed: () async {
|
|
||||||
selectedGroup = await Navigator.of(context).push(
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => ChooseGroupView(
|
|
||||||
groups: groupsList,
|
|
||||||
initialGroupId: selectedGroupId,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
selectedGroupId = selectedGroup?.id ?? '';
|
|
||||||
if (selectedGroup != null) {
|
|
||||||
filteredPlayerList = playerList
|
|
||||||
.where(
|
|
||||||
(p) => !selectedGroup!.members.any((m) => m.id == p.id),
|
|
||||||
)
|
|
||||||
.toList();
|
|
||||||
} else {
|
|
||||||
filteredPlayerList = List.from(playerList);
|
|
||||||
}
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: PlayerSelection(
|
|
||||||
key: ValueKey(selectedGroup?.id ?? 'no_group'),
|
|
||||||
initialSelectedPlayers: selectedPlayers ?? [],
|
|
||||||
availablePlayers: filteredPlayerList,
|
|
||||||
onChanged: (value) {
|
|
||||||
setState(() {
|
setState(() {
|
||||||
selectedPlayers = value;
|
if (selectedGameIndex != -1) {
|
||||||
|
hintText = games[selectedGameIndex].$1;
|
||||||
|
selectedRuleset = games[selectedGameIndex].$3;
|
||||||
|
selectedRulesetIndex = _rulesets.indexWhere(
|
||||||
|
(r) => r.$1 == selectedRuleset,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
hintText = loc.match_name;
|
||||||
|
selectedRuleset = null;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
ChooseTile(
|
||||||
CustomWidthButton(
|
title: loc.ruleset,
|
||||||
text: loc.create_match,
|
trailingText: selectedRuleset == null
|
||||||
sizeRelativeToWidth: 0.95,
|
? loc.none
|
||||||
buttonType: ButtonType.primary,
|
: translateRulesetToString(selectedRuleset!, context),
|
||||||
onPressed: _enableCreateGameButton()
|
onPressed: () async {
|
||||||
? () async {
|
selectedRuleset = await Navigator.of(context).push(
|
||||||
Match match = Match(
|
adaptivePageRoute(
|
||||||
name: _matchNameController.text.isEmpty
|
builder: (context) => ChooseRulesetView(
|
||||||
? hintText
|
rulesets: _rulesets,
|
||||||
: _matchNameController.text.trim(),
|
initialRulesetIndex: selectedRulesetIndex,
|
||||||
createdAt: DateTime.now(),
|
),
|
||||||
group: selectedGroup,
|
),
|
||||||
players: selectedPlayers,
|
);
|
||||||
);
|
if (!mounted) return;
|
||||||
await db.matchDao.addMatch(match: match);
|
selectedRulesetIndex = _rulesets.indexWhere(
|
||||||
if (context.mounted) {
|
(r) => r.$1 == selectedRuleset,
|
||||||
Navigator.pushReplacement(
|
);
|
||||||
context,
|
selectedGameIndex = -1;
|
||||||
CupertinoPageRoute(
|
setState(() {});
|
||||||
fullscreenDialog: true,
|
},
|
||||||
builder: (context) => MatchResultView(
|
),
|
||||||
match: match,
|
ChooseTile(
|
||||||
onWinnerChanged: widget.onWinnerChanged,
|
title: loc.group,
|
||||||
),
|
trailingText: selectedGroup == null
|
||||||
),
|
? loc.none_group
|
||||||
|
: selectedGroup!.name,
|
||||||
|
onPressed: () async {
|
||||||
|
selectedGroup = await Navigator.of(context).push(
|
||||||
|
adaptivePageRoute(
|
||||||
|
builder: (context) => ChooseGroupView(
|
||||||
|
groups: groupsList,
|
||||||
|
initialGroupId: selectedGroupId,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
selectedGroupId = selectedGroup?.id ?? '';
|
||||||
|
if (selectedGroup != null) {
|
||||||
|
filteredPlayerList = playerList
|
||||||
|
.where(
|
||||||
|
(p) => !selectedGroup!.members.any((m) => m.id == p.id),
|
||||||
|
)
|
||||||
|
.toList();
|
||||||
|
} else {
|
||||||
|
filteredPlayerList = List.from(playerList);
|
||||||
|
}
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: PlayerSelection(
|
||||||
|
key: ValueKey(selectedGroup?.id ?? 'no_group'),
|
||||||
|
initialSelectedPlayers: selectedPlayers ?? [],
|
||||||
|
availablePlayers: filteredPlayerList,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
selectedPlayers = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
CustomWidthButton(
|
||||||
|
text: loc.create_match,
|
||||||
|
sizeRelativeToWidth: 0.95,
|
||||||
|
buttonType: ButtonType.primary,
|
||||||
|
onPressed: _enableCreateGameButton()
|
||||||
|
? () async {
|
||||||
|
Match match = Match(
|
||||||
|
name: _matchNameController.text.isEmpty
|
||||||
|
? (hintText ?? '')
|
||||||
|
: _matchNameController.text.trim(),
|
||||||
|
createdAt: DateTime.now(),
|
||||||
|
group: selectedGroup,
|
||||||
|
players: selectedPlayers,
|
||||||
);
|
);
|
||||||
|
await db.matchDao.addMatch(match: match);
|
||||||
|
if (context.mounted) {
|
||||||
|
Navigator.pushReplacement(
|
||||||
|
context,
|
||||||
|
adaptivePageRoute(
|
||||||
|
fullscreenDialog: true,
|
||||||
|
builder: (context) => MatchResultView(
|
||||||
|
match: match,
|
||||||
|
onWinnerChanged: widget.onWinnerChanged,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
: null,
|
||||||
: null,
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Determines whether the "Create Game" button should be enabled based on
|
/// Determines whether the "Create Match" button should be enabled.
|
||||||
/// the current state of the input fields.
|
///
|
||||||
|
/// Returns `true` if:
|
||||||
|
/// - A ruleset is selected AND
|
||||||
|
/// - Either a group is selected OR at least 2 players are selected
|
||||||
bool _enableCreateGameButton() {
|
bool _enableCreateGameButton() {
|
||||||
return selectedGroup != null ||
|
return (selectedGroup != null ||
|
||||||
(selectedPlayers != null && selectedPlayers!.length > 1) &&
|
(selectedPlayers != null && selectedPlayers!.length > 1)) &&
|
||||||
selectedRuleset != null;
|
selectedRuleset != null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,12 @@ class MatchResultView extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MatchResultViewState extends State<MatchResultView> {
|
class _MatchResultViewState extends State<MatchResultView> {
|
||||||
late final List<Player> allPlayers;
|
|
||||||
late final AppDatabase db;
|
late final AppDatabase db;
|
||||||
|
|
||||||
|
/// List of all players who participated in the match
|
||||||
|
late final List<Player> allPlayers;
|
||||||
|
|
||||||
|
/// Currently selected winner player
|
||||||
Player? _selectedPlayer;
|
Player? _selectedPlayer;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -47,17 +51,7 @@ class _MatchResultViewState extends State<MatchResultView> {
|
|||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
backgroundColor: CustomTheme.backgroundColor,
|
title: Text(widget.match.name),
|
||||||
scrolledUnderElevation: 0,
|
|
||||||
title: Text(
|
|
||||||
widget.match.name,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
centerTitle: true,
|
|
||||||
),
|
),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -132,6 +126,8 @@ class _MatchResultViewState extends State<MatchResultView> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Handles saving or removing the winner in the database
|
||||||
|
/// based on the current selection.
|
||||||
Future<void> _handleWinnerSaving() async {
|
Future<void> _handleWinnerSaving() async {
|
||||||
if (_selectedPlayer == null) {
|
if (_selectedPlayer == null) {
|
||||||
await db.matchDao.removeWinner(matchId: widget.match.id);
|
await db.matchDao.removeWinner(matchId: widget.match.id);
|
||||||
@@ -144,6 +140,10 @@ class _MatchResultViewState extends State<MatchResultView> {
|
|||||||
widget.onWinnerChanged?.call();
|
widget.onWinnerChanged?.call();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Retrieves all players associated with the given [match].
|
||||||
|
/// This includes players directly assigned to the match
|
||||||
|
/// as well as members of the group (if any).
|
||||||
|
/// The returned list is sorted alphabetically by player name.
|
||||||
List<Player> getAllPlayers(Match match) {
|
List<Player> getAllPlayers(Match match) {
|
||||||
List<Player> players = [];
|
List<Player> players = [];
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import 'dart:core' hide Match;
|
import 'dart:core' hide Match;
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:game_tracker/core/adaptive_page_route.dart';
|
||||||
import 'package:game_tracker/core/constants.dart';
|
import 'package:game_tracker/core/constants.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
import 'package:game_tracker/data/db/database.dart';
|
import 'package:game_tracker/data/db/database.dart';
|
||||||
@@ -28,6 +28,8 @@ class _MatchViewState extends State<MatchView> {
|
|||||||
late final AppDatabase db;
|
late final AppDatabase db;
|
||||||
bool isLoading = true;
|
bool isLoading = true;
|
||||||
|
|
||||||
|
/// Loaded matches from the database,
|
||||||
|
/// initially filled with skeleton matches
|
||||||
List<Match> matches = List.filled(
|
List<Match> matches = List.filled(
|
||||||
4,
|
4,
|
||||||
Match(
|
Match(
|
||||||
@@ -44,7 +46,6 @@ class _MatchViewState extends State<MatchView> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
db = Provider.of<AppDatabase>(context, listen: false);
|
db = Provider.of<AppDatabase>(context, listen: false);
|
||||||
loadGames();
|
loadGames();
|
||||||
}
|
}
|
||||||
@@ -77,20 +78,26 @@ class _MatchViewState extends State<MatchView> {
|
|||||||
height: MediaQuery.paddingOf(context).bottom - 20,
|
height: MediaQuery.paddingOf(context).bottom - 20,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return MatchTile(
|
return Center(
|
||||||
onTap: () async {
|
child: Padding(
|
||||||
Navigator.push(
|
padding: const EdgeInsets.only(bottom: 12.0),
|
||||||
context,
|
child: MatchTile(
|
||||||
CupertinoPageRoute(
|
width: MediaQuery.sizeOf(context).width * 0.95,
|
||||||
fullscreenDialog: true,
|
onTap: () async {
|
||||||
builder: (context) => MatchResultView(
|
Navigator.push(
|
||||||
match: matches[index],
|
context,
|
||||||
onWinnerChanged: loadGames,
|
adaptivePageRoute(
|
||||||
),
|
fullscreenDialog: true,
|
||||||
),
|
builder: (context) => MatchResultView(
|
||||||
);
|
match: matches[index],
|
||||||
},
|
onWinnerChanged: loadGames,
|
||||||
match: matches[index],
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
match: matches[index],
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -104,7 +111,7 @@ class _MatchViewState extends State<MatchView> {
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
adaptivePageRoute(
|
||||||
builder: (context) =>
|
builder: (context) =>
|
||||||
CreateMatchView(onWinnerChanged: loadGames),
|
CreateMatchView(onWinnerChanged: loadGames),
|
||||||
),
|
),
|
||||||
@@ -117,10 +124,11 @@ class _MatchViewState extends State<MatchView> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Loads the games from the database and sorts them by creation date.
|
||||||
void loadGames() {
|
void loadGames() {
|
||||||
Future.wait([
|
Future.wait([
|
||||||
db.matchDao.getAllMatches(),
|
db.matchDao.getAllMatches(),
|
||||||
Future.delayed(minimumSkeletonDuration),
|
Future.delayed(Constants.minimumSkeletonDuration),
|
||||||
]).then((results) {
|
]).then((results) {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'package:game_tracker/core/enums.dart';
|
|||||||
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/tiles/settings_list_tile.dart';
|
import 'package:game_tracker/presentation/widgets/tiles/settings_list_tile.dart';
|
||||||
import 'package:game_tracker/services/data_transfer_service.dart';
|
import 'package:game_tracker/services/data_transfer_service.dart';
|
||||||
|
import 'package:package_info_plus/package_info_plus.dart';
|
||||||
|
|
||||||
class SettingsView extends StatefulWidget {
|
class SettingsView extends StatefulWidget {
|
||||||
const SettingsView({super.key});
|
const SettingsView({super.key});
|
||||||
@@ -13,113 +14,127 @@ class SettingsView extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _SettingsViewState extends State<SettingsView> {
|
class _SettingsViewState extends State<SettingsView> {
|
||||||
|
PackageInfo _packageInfo = PackageInfo(
|
||||||
|
appName: 'n.A.',
|
||||||
|
packageName: 'n.A.',
|
||||||
|
version: 'n.A.',
|
||||||
|
buildNumber: 'n.A.',
|
||||||
|
);
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
_initPackageInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final loc = AppLocalizations.of(context);
|
final loc = AppLocalizations.of(context);
|
||||||
return Scaffold(
|
return ScaffoldMessenger(
|
||||||
appBar: AppBar(backgroundColor: CustomTheme.backgroundColor),
|
child: Scaffold(
|
||||||
backgroundColor: CustomTheme.backgroundColor,
|
appBar: AppBar(backgroundColor: CustomTheme.backgroundColor),
|
||||||
body: LayoutBuilder(
|
backgroundColor: CustomTheme.backgroundColor,
|
||||||
builder: (BuildContext context, BoxConstraints constraints) =>
|
body: Column(
|
||||||
SingleChildScrollView(
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
child: Column(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
children: [
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
Padding(
|
||||||
children: [
|
padding: const EdgeInsets.fromLTRB(24, 0, 24, 10),
|
||||||
Padding(
|
child: Text(
|
||||||
padding: const EdgeInsets.fromLTRB(24, 0, 24, 10),
|
textAlign: TextAlign.start,
|
||||||
child: Text(
|
loc.menu,
|
||||||
textAlign: TextAlign.start,
|
style: const TextStyle(
|
||||||
loc.menu,
|
fontSize: 28,
|
||||||
style: const TextStyle(
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 28,
|
),
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 24,
|
|
||||||
vertical: 10,
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
loc.settings,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 22,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SettingsListTile(
|
|
||||||
title: loc.export_data,
|
|
||||||
icon: Icons.upload_outlined,
|
|
||||||
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
|
||||||
onPressed: () async {
|
|
||||||
final String json =
|
|
||||||
await DataTransferService.getAppDataAsJson(context);
|
|
||||||
final result = await DataTransferService.exportData(
|
|
||||||
json,
|
|
||||||
'game_tracker-data',
|
|
||||||
);
|
|
||||||
if (!context.mounted) return;
|
|
||||||
showExportSnackBar(context: context, result: result);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
SettingsListTile(
|
|
||||||
title: loc.import_data,
|
|
||||||
icon: Icons.download_outlined,
|
|
||||||
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
|
||||||
onPressed: () async {
|
|
||||||
final result = await DataTransferService.importData(
|
|
||||||
context,
|
|
||||||
);
|
|
||||||
if (!context.mounted) return;
|
|
||||||
showImportSnackBar(context: context, result: result);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
SettingsListTile(
|
|
||||||
title: loc.delete_all_data,
|
|
||||||
icon: Icons.download_outlined,
|
|
||||||
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
|
||||||
onPressed: () {
|
|
||||||
showDialog<bool>(
|
|
||||||
context: context,
|
|
||||||
builder: (context) => AlertDialog(
|
|
||||||
title: Text(loc.delete_all_data),
|
|
||||||
content: Text(loc.this_cannot_be_undone),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => Navigator.of(context).pop(false),
|
|
||||||
child: Text(loc.cancel),
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => Navigator.of(context).pop(true),
|
|
||||||
child: Text(loc.delete),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
).then((confirmed) {
|
|
||||||
if (confirmed == true && context.mounted) {
|
|
||||||
DataTransferService.deleteAllData(context);
|
|
||||||
showSnackbar(
|
|
||||||
context: context,
|
|
||||||
message: AppLocalizations.of(
|
|
||||||
context,
|
|
||||||
).data_successfully_deleted,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 10),
|
||||||
|
child: Text(
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
loc.settings,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 22,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SettingsListTile(
|
||||||
|
title: loc.export_data,
|
||||||
|
icon: Icons.upload_rounded,
|
||||||
|
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
||||||
|
onPressed: () async {
|
||||||
|
final String json = await DataTransferService.getAppDataAsJson(
|
||||||
|
context,
|
||||||
|
);
|
||||||
|
final result = await DataTransferService.exportData(
|
||||||
|
json,
|
||||||
|
'game_tracker-data',
|
||||||
|
);
|
||||||
|
if (!context.mounted) return;
|
||||||
|
showExportSnackBar(context: context, result: result);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SettingsListTile(
|
||||||
|
title: loc.import_data,
|
||||||
|
icon: Icons.download_rounded,
|
||||||
|
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
||||||
|
onPressed: () async {
|
||||||
|
final result = await DataTransferService.importData(context);
|
||||||
|
if (!context.mounted) return;
|
||||||
|
showImportSnackBar(context: context, result: result);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SettingsListTile(
|
||||||
|
title: loc.delete_all_data,
|
||||||
|
icon: Icons.delete_rounded,
|
||||||
|
suffixWidget: const Icon(Icons.arrow_forward_ios, size: 16),
|
||||||
|
onPressed: () {
|
||||||
|
showDialog<bool>(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => AlertDialog(
|
||||||
|
title: Text('${loc.delete_all_data}?'),
|
||||||
|
content: Text(loc.this_cannot_be_undone),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(false),
|
||||||
|
child: Text(loc.cancel),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(true),
|
||||||
|
child: Text(loc.delete),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
).then((confirmed) {
|
||||||
|
if (confirmed == true && context.mounted) {
|
||||||
|
DataTransferService.deleteAllData(context);
|
||||||
|
showSnackbar(
|
||||||
|
context: context,
|
||||||
|
message: AppLocalizations.of(
|
||||||
|
context,
|
||||||
|
).data_successfully_deleted,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(20),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
'Version ${_packageInfo.version} (${_packageInfo.buildNumber})',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.grey.shade600,
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -194,4 +209,11 @@ class _SettingsViewState extends State<SettingsView> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _initPackageInfo() async {
|
||||||
|
final info = await PackageInfo.fromPlatform();
|
||||||
|
setState(() {
|
||||||
|
_packageInfo = info;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,28 +25,7 @@ class _StatisticsViewState extends State<StatisticsView> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
loadStatisticData();
|
||||||
final db = Provider.of<AppDatabase>(context, listen: false);
|
|
||||||
|
|
||||||
Future.wait([
|
|
||||||
db.matchDao.getAllMatches(),
|
|
||||||
db.playerDao.getAllPlayers(),
|
|
||||||
Future.delayed(minimumSkeletonDuration),
|
|
||||||
]).then((results) async {
|
|
||||||
if (!mounted) return;
|
|
||||||
final matches = results[0] as List<Match>;
|
|
||||||
final players = results[1] as List<Player>;
|
|
||||||
winCounts = _calculateWinsForAllPlayers(matches, players, context);
|
|
||||||
matchCounts = _calculateMatchAmountsForAllPlayers(
|
|
||||||
matches,
|
|
||||||
players,
|
|
||||||
context,
|
|
||||||
);
|
|
||||||
winRates = computeWinRatePercent(wins: winCounts, matches: matchCounts);
|
|
||||||
setState(() {
|
|
||||||
isLoading = false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -78,7 +57,7 @@ class _StatisticsViewState extends State<StatisticsView> {
|
|||||||
width: constraints.maxWidth * 0.95,
|
width: constraints.maxWidth * 0.95,
|
||||||
values: winCounts,
|
values: winCounts,
|
||||||
itemCount: 3,
|
itemCount: 3,
|
||||||
barColor: Colors.blue,
|
barColor: Colors.green,
|
||||||
),
|
),
|
||||||
SizedBox(height: constraints.maxHeight * 0.02),
|
SizedBox(height: constraints.maxHeight * 0.02),
|
||||||
StatisticsTile(
|
StatisticsTile(
|
||||||
@@ -96,7 +75,7 @@ class _StatisticsViewState extends State<StatisticsView> {
|
|||||||
width: constraints.maxWidth * 0.95,
|
width: constraints.maxWidth * 0.95,
|
||||||
values: matchCounts,
|
values: matchCounts,
|
||||||
itemCount: 10,
|
itemCount: 10,
|
||||||
barColor: Colors.green,
|
barColor: Colors.blue,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -118,13 +97,43 @@ class _StatisticsViewState extends State<StatisticsView> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Loads matches and players from the database
|
||||||
|
/// and calculates statistics for each player
|
||||||
|
void loadStatisticData() {
|
||||||
|
final db = Provider.of<AppDatabase>(context, listen: false);
|
||||||
|
|
||||||
|
Future.wait([
|
||||||
|
db.matchDao.getAllMatches(),
|
||||||
|
db.playerDao.getAllPlayers(),
|
||||||
|
Future.delayed(Constants.minimumSkeletonDuration),
|
||||||
|
]).then((results) async {
|
||||||
|
if (!mounted) return;
|
||||||
|
final matches = results[0] as List<Match>;
|
||||||
|
final players = results[1] as List<Player>;
|
||||||
|
winCounts = _calculateWinsForAllPlayers(
|
||||||
|
matches: matches,
|
||||||
|
players: players,
|
||||||
|
context: context,
|
||||||
|
);
|
||||||
|
matchCounts = _calculateMatchAmountsForAllPlayers(
|
||||||
|
matches: matches,
|
||||||
|
players: players,
|
||||||
|
context: context,
|
||||||
|
);
|
||||||
|
winRates = computeWinRatePercent(wins: winCounts, matches: matchCounts);
|
||||||
|
setState(() {
|
||||||
|
isLoading = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/// Calculates the number of wins for each player
|
/// Calculates the number of wins for each player
|
||||||
/// and returns a sorted list of tuples (playerName, winCount)
|
/// and returns a sorted list of tuples (playerName, winCount)
|
||||||
List<(String, int)> _calculateWinsForAllPlayers(
|
List<(String, int)> _calculateWinsForAllPlayers({
|
||||||
List<Match> matches,
|
required List<Match> matches,
|
||||||
List<Player> players,
|
required List<Player> players,
|
||||||
BuildContext context,
|
required BuildContext context,
|
||||||
) {
|
}) {
|
||||||
List<(String, int)> winCounts = [];
|
List<(String, int)> winCounts = [];
|
||||||
final loc = AppLocalizations.of(context);
|
final loc = AppLocalizations.of(context);
|
||||||
|
|
||||||
@@ -169,11 +178,11 @@ class _StatisticsViewState extends State<StatisticsView> {
|
|||||||
|
|
||||||
/// Calculates the number of matches played for each player
|
/// Calculates the number of matches played for each player
|
||||||
/// and returns a sorted list of tuples (playerName, matchCount)
|
/// and returns a sorted list of tuples (playerName, matchCount)
|
||||||
List<(String, int)> _calculateMatchAmountsForAllPlayers(
|
List<(String, int)> _calculateMatchAmountsForAllPlayers({
|
||||||
List<Match> matches,
|
required List<Match> matches,
|
||||||
List<Player> players,
|
required List<Player> players,
|
||||||
BuildContext context,
|
required BuildContext context,
|
||||||
) {
|
}) {
|
||||||
List<(String, int)> matchCounts = [];
|
List<(String, int)> matchCounts = [];
|
||||||
final loc = AppLocalizations.of(context);
|
final loc = AppLocalizations.of(context);
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:skeletonizer/skeletonizer.dart';
|
import 'package:skeletonizer/skeletonizer.dart';
|
||||||
|
|
||||||
|
/// A widget that provides a skeleton loading effect to its child widget tree.
|
||||||
|
/// - [child]: The widget tree to apply the skeleton effect to.
|
||||||
|
/// - [enabled]: A boolean to enable or disable the skeleton effect.
|
||||||
|
/// - [fixLayoutBuilder]: A boolean to fix the layout builder for AnimatedSwitcher.
|
||||||
class AppSkeleton extends StatefulWidget {
|
class AppSkeleton extends StatefulWidget {
|
||||||
final Widget child;
|
|
||||||
final bool enabled;
|
|
||||||
final bool fixLayoutBuilder;
|
|
||||||
|
|
||||||
const AppSkeleton({
|
const AppSkeleton({
|
||||||
super.key,
|
super.key,
|
||||||
required this.child,
|
required this.child,
|
||||||
@@ -13,6 +13,15 @@ class AppSkeleton extends StatefulWidget {
|
|||||||
this.fixLayoutBuilder = false,
|
this.fixLayoutBuilder = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// The widget tree to apply the skeleton effect to.
|
||||||
|
final Widget child;
|
||||||
|
|
||||||
|
/// A boolean to enable or disable the skeleton effect.
|
||||||
|
final bool enabled;
|
||||||
|
|
||||||
|
/// A boolean to fix the layout builder for AnimatedSwitcher.
|
||||||
|
final bool fixLayoutBuilder;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<AppSkeleton> createState() => _AppSkeletonState();
|
State<AppSkeleton> createState() => _AppSkeletonState();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,12 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
import 'package:game_tracker/core/enums.dart';
|
import 'package:game_tracker/core/enums.dart';
|
||||||
|
|
||||||
|
/// A custom button widget that is designed to have a width relative to the screen size.
|
||||||
|
/// It supports three types of buttons: primary, secondary, and text buttons.
|
||||||
|
/// - [text]: The text to display on the button.
|
||||||
|
/// - [buttonType]: The type of button to display. Defaults to [ButtonType.primary].
|
||||||
|
/// - [sizeRelativeToWidth]: The size of the button relative to the width of the screen.
|
||||||
|
/// - [onPressed]: The callback to be invoked when the button is pressed.
|
||||||
class CustomWidthButton extends StatelessWidget {
|
class CustomWidthButton extends StatelessWidget {
|
||||||
const CustomWidthButton({
|
const CustomWidthButton({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -11,9 +17,16 @@ class CustomWidthButton extends StatelessWidget {
|
|||||||
this.onPressed,
|
this.onPressed,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// The text to display on the button.
|
||||||
final String text;
|
final String text;
|
||||||
|
|
||||||
|
/// The size of the button relative to the width of the screen.
|
||||||
final double sizeRelativeToWidth;
|
final double sizeRelativeToWidth;
|
||||||
|
|
||||||
|
/// The callback to be invoked when the button is pressed.
|
||||||
final VoidCallback? onPressed;
|
final VoidCallback? onPressed;
|
||||||
|
|
||||||
|
/// The type of button to display. Depends on the enum [ButtonType].
|
||||||
final ButtonType buttonType;
|
final ButtonType buttonType;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -47,7 +60,7 @@ class CustomWidthButton extends StatelessWidget {
|
|||||||
60,
|
60,
|
||||||
),
|
),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: CustomTheme.standardBorderRadiusAll,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
@@ -78,7 +91,7 @@ class CustomWidthButton extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
side: BorderSide(color: borderSideColor, width: 2),
|
side: BorderSide(color: borderSideColor, width: 2),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: CustomTheme.standardBorderRadiusAll,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
|
|||||||
@@ -1,15 +1,22 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
|
|
||||||
|
/// A button widget designed for quick creating matches in the [HomeView]
|
||||||
|
/// - [text]: The text to display on the button.
|
||||||
|
/// - [onPressed]: The callback to be invoked when the button is pressed.
|
||||||
class QuickCreateButton extends StatefulWidget {
|
class QuickCreateButton extends StatefulWidget {
|
||||||
final String text;
|
|
||||||
final VoidCallback? onPressed;
|
|
||||||
const QuickCreateButton({
|
const QuickCreateButton({
|
||||||
super.key,
|
super.key,
|
||||||
required this.text,
|
required this.text,
|
||||||
required this.onPressed,
|
required this.onPressed,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// The text to display on the button.
|
||||||
|
final String text;
|
||||||
|
|
||||||
|
/// The callback to be invoked when the button is pressed.
|
||||||
|
final VoidCallback? onPressed;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<QuickCreateButton> createState() => _QuickCreateButtonState();
|
State<QuickCreateButton> createState() => _QuickCreateButtonState();
|
||||||
}
|
}
|
||||||
@@ -22,7 +29,9 @@ class _QuickCreateButtonState extends State<QuickCreateButton> {
|
|||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
minimumSize: const Size(140, 45),
|
minimumSize: const Size(140, 45),
|
||||||
backgroundColor: CustomTheme.primaryColor,
|
backgroundColor: CustomTheme.primaryColor,
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: CustomTheme.standardBorderRadiusAll,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
widget.text,
|
widget.text,
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
/// A navigation bar item widget that represents a single tab in a navigation bar.
|
||||||
|
/// - [index]: The index of the tab.
|
||||||
|
/// - [isSelected]: A boolean indicating whether the tab is currently selected.
|
||||||
|
/// - [icon]: The icon to display for the tab.
|
||||||
|
/// - [label]: The label to display for the tab.
|
||||||
|
/// - [onTabTapped]: The callback to be invoked when the tab is tapped.
|
||||||
class NavbarItem extends StatefulWidget {
|
class NavbarItem extends StatefulWidget {
|
||||||
final int index;
|
|
||||||
final bool isSelected;
|
|
||||||
final IconData icon;
|
|
||||||
final String label;
|
|
||||||
final Function(int) onTabTapped;
|
|
||||||
|
|
||||||
const NavbarItem({
|
const NavbarItem({
|
||||||
super.key,
|
super.key,
|
||||||
required this.index,
|
required this.index,
|
||||||
@@ -16,6 +16,21 @@ class NavbarItem extends StatefulWidget {
|
|||||||
required this.onTabTapped,
|
required this.onTabTapped,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// The index of the tab.
|
||||||
|
final int index;
|
||||||
|
|
||||||
|
/// A boolean indicating whether the tab is currently selected.
|
||||||
|
final bool isSelected;
|
||||||
|
|
||||||
|
/// The icon to display for the tab.
|
||||||
|
final IconData icon;
|
||||||
|
|
||||||
|
/// The label to display for the tab.
|
||||||
|
final String label;
|
||||||
|
|
||||||
|
/// The callback to be invoked when the tab is tapped.
|
||||||
|
final Function(int) onTabTapped;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<NavbarItem> createState() => _NavbarItemState();
|
State<NavbarItem> createState() => _NavbarItemState();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,31 +11,55 @@ import 'package:game_tracker/presentation/widgets/tiles/text_icon_tile.dart';
|
|||||||
import 'package:game_tracker/presentation/widgets/top_centered_message.dart';
|
import 'package:game_tracker/presentation/widgets/top_centered_message.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
/// A widget that allows users to select players from a list,
|
||||||
|
/// with search functionality and the ability to add new players.
|
||||||
|
/// - [availablePlayers]: An optional list of players to choose from. If null, all
|
||||||
|
/// players from the database are used.
|
||||||
|
/// - [initialSelectedPlayers]: An optional list of players that should be pre-selected.
|
||||||
|
/// - [onChanged]: A callback function that is invoked whenever the selection changes,
|
||||||
|
/// providing the updated list of selected players.
|
||||||
class PlayerSelection extends StatefulWidget {
|
class PlayerSelection extends StatefulWidget {
|
||||||
final Function(List<Player> value) onChanged;
|
|
||||||
final List<Player>? availablePlayers;
|
|
||||||
final List<Player>? initialSelectedPlayers;
|
|
||||||
|
|
||||||
const PlayerSelection({
|
const PlayerSelection({
|
||||||
super.key,
|
super.key,
|
||||||
required this.onChanged,
|
|
||||||
this.availablePlayers,
|
this.availablePlayers,
|
||||||
this.initialSelectedPlayers,
|
this.initialSelectedPlayers,
|
||||||
|
required this.onChanged,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// An optional list of players to choose from. If null, all players from the database are used.
|
||||||
|
final List<Player>? availablePlayers;
|
||||||
|
|
||||||
|
/// An optional list of players that should be pre-selected.
|
||||||
|
final List<Player>? initialSelectedPlayers;
|
||||||
|
|
||||||
|
/// A callback function that is invoked whenever the selection changes,
|
||||||
|
final Function(List<Player> value) onChanged;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<PlayerSelection> createState() => _PlayerSelectionState();
|
State<PlayerSelection> createState() => _PlayerSelectionState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _PlayerSelectionState extends State<PlayerSelection> {
|
class _PlayerSelectionState extends State<PlayerSelection> {
|
||||||
List<Player> selectedPlayers = [];
|
late final AppDatabase db;
|
||||||
List<Player> suggestedPlayers = [];
|
|
||||||
List<Player> allPlayers = [];
|
|
||||||
bool isLoading = true;
|
bool isLoading = true;
|
||||||
|
|
||||||
|
/// Future that loads all players from the database.
|
||||||
|
late Future<List<Player>> _allPlayersFuture;
|
||||||
|
|
||||||
|
/// The complete list of all available players.
|
||||||
|
List<Player> allPlayers = [];
|
||||||
|
|
||||||
|
/// The list of players suggested based on the search input.
|
||||||
|
List<Player> suggestedPlayers = [];
|
||||||
|
|
||||||
|
/// The list of currently selected players.
|
||||||
|
List<Player> selectedPlayers = [];
|
||||||
|
|
||||||
|
/// Controller for the search bar input.
|
||||||
late final TextEditingController _searchBarController =
|
late final TextEditingController _searchBarController =
|
||||||
TextEditingController();
|
TextEditingController();
|
||||||
late final AppDatabase db;
|
|
||||||
late Future<List<Player>> _allPlayersFuture;
|
/// Skeleton data used while loading players.
|
||||||
late final List<Player> skeletonData = List.filled(
|
late final List<Player> skeletonData = List.filled(
|
||||||
7,
|
7,
|
||||||
Player(name: 'Player 0'),
|
Player(name: 'Player 0'),
|
||||||
@@ -49,47 +73,11 @@ class _PlayerSelectionState extends State<PlayerSelection> {
|
|||||||
loadPlayerList();
|
loadPlayerList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadPlayerList() {
|
|
||||||
_allPlayersFuture = Future.wait([
|
|
||||||
db.playerDao.getAllPlayers(),
|
|
||||||
Future.delayed(minimumSkeletonDuration),
|
|
||||||
]).then((results) => results[0] as List<Player>);
|
|
||||||
if (mounted) {
|
|
||||||
_allPlayersFuture.then((loadedPlayers) {
|
|
||||||
setState(() {
|
|
||||||
// If a list of available players is provided (even if empty), use that list.
|
|
||||||
if (widget.availablePlayers != null) {
|
|
||||||
widget.availablePlayers!.sort((a, b) => a.name.compareTo(b.name));
|
|
||||||
allPlayers = [...widget.availablePlayers!];
|
|
||||||
suggestedPlayers = [...allPlayers];
|
|
||||||
|
|
||||||
if (widget.initialSelectedPlayers != null) {
|
|
||||||
// Ensures that only players available for selection are pre-selected.
|
|
||||||
selectedPlayers = widget.initialSelectedPlayers!
|
|
||||||
.where(
|
|
||||||
(p) => widget.availablePlayers!.any(
|
|
||||||
(available) => available.id == p.id,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.toList();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Otherwise, use the loaded players from the database.
|
|
||||||
loadedPlayers.sort((a, b) => a.name.compareTo(b.name));
|
|
||||||
allPlayers = [...loadedPlayers];
|
|
||||||
suggestedPlayers = [...loadedPlayers];
|
|
||||||
}
|
|
||||||
isLoading = false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final loc = AppLocalizations.of(context);
|
final loc = AppLocalizations.of(context);
|
||||||
return Container(
|
return Container(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
|
margin: CustomTheme.standardMargin,
|
||||||
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
|
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
|
||||||
decoration: CustomTheme.standardBoxDecoration,
|
decoration: CustomTheme.standardBoxDecoration,
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -131,9 +119,7 @@ class _PlayerSelectionState extends State<PlayerSelection> {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
Text(
|
Text(
|
||||||
AppLocalizations.of(
|
loc.selected_players,
|
||||||
context,
|
|
||||||
).selected_players(selectedPlayers.length),
|
|
||||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
@@ -227,53 +213,97 @@ class _PlayerSelectionState extends State<PlayerSelection> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Loads the list of players from the database or uses the provided available players.
|
||||||
|
/// Sets the loading state and updates the player lists accordingly.
|
||||||
|
void loadPlayerList() {
|
||||||
|
_allPlayersFuture = Future.wait([
|
||||||
|
db.playerDao.getAllPlayers(),
|
||||||
|
Future.delayed(Constants.minimumSkeletonDuration),
|
||||||
|
]).then((results) => results[0] as List<Player>);
|
||||||
|
if (mounted) {
|
||||||
|
_allPlayersFuture.then((loadedPlayers) {
|
||||||
|
setState(() {
|
||||||
|
// If a list of available players is provided (even if empty), use that list.
|
||||||
|
if (widget.availablePlayers != null) {
|
||||||
|
widget.availablePlayers!.sort((a, b) => a.name.compareTo(b.name));
|
||||||
|
allPlayers = [...widget.availablePlayers!];
|
||||||
|
suggestedPlayers = [...allPlayers];
|
||||||
|
|
||||||
|
if (widget.initialSelectedPlayers != null) {
|
||||||
|
// Ensures that only players available for selection are pre-selected.
|
||||||
|
selectedPlayers = widget.initialSelectedPlayers!
|
||||||
|
.where(
|
||||||
|
(p) => widget.availablePlayers!.any(
|
||||||
|
(available) => available.id == p.id,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Otherwise, use the loaded players from the database.
|
||||||
|
loadedPlayers.sort((a, b) => a.name.compareTo(b.name));
|
||||||
|
allPlayers = [...loadedPlayers];
|
||||||
|
suggestedPlayers = [...loadedPlayers];
|
||||||
|
}
|
||||||
|
isLoading = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Adds a new player to the database from the search bar input.
|
/// Adds a new player to the database from the search bar input.
|
||||||
/// Shows a snackbar indicating success or failure.
|
/// Shows a snackbar indicating success or failure.
|
||||||
/// [context] - BuildContext to show the snackbar.
|
/// [context] - BuildContext to show the snackbar.
|
||||||
void addNewPlayerFromSearch({required BuildContext context}) async {
|
Future<void> addNewPlayerFromSearch({required BuildContext context}) async {
|
||||||
final loc = AppLocalizations.of(context);
|
final loc = AppLocalizations.of(context);
|
||||||
String playerName = _searchBarController.text.trim();
|
final playerName = _searchBarController.text.trim();
|
||||||
Player createdPlayer = Player(name: playerName);
|
|
||||||
bool success = await db.playerDao.addPlayer(player: createdPlayer);
|
final createdPlayer = Player(name: playerName);
|
||||||
|
final success = await db.playerDao.addPlayer(player: createdPlayer);
|
||||||
|
|
||||||
if (!context.mounted) return;
|
if (!context.mounted) return;
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
selectedPlayers.insert(0, createdPlayer);
|
_handleSuccessfulPlayerCreation(createdPlayer);
|
||||||
widget.onChanged([...selectedPlayers]);
|
showSnackBarMessage(loc.successfully_added_player(playerName));
|
||||||
allPlayers.add(createdPlayer);
|
|
||||||
setState(() {
|
|
||||||
_searchBarController.clear();
|
|
||||||
suggestedPlayers = allPlayers.where((player) {
|
|
||||||
return !selectedPlayers.contains(player);
|
|
||||||
}).toList();
|
|
||||||
});
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
SnackBar(
|
|
||||||
backgroundColor: CustomTheme.boxColor,
|
|
||||||
content: Center(
|
|
||||||
child: Text(
|
|
||||||
AppLocalizations.of(
|
|
||||||
context,
|
|
||||||
).successfully_added_player(playerName),
|
|
||||||
style: const TextStyle(color: Colors.white),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
showSnackBarMessage(loc.could_not_add_player(playerName));
|
||||||
SnackBar(
|
|
||||||
backgroundColor: CustomTheme.boxColor,
|
|
||||||
content: Center(
|
|
||||||
child: Text(
|
|
||||||
loc.could_not_add_player(playerName),
|
|
||||||
style: const TextStyle(color: Colors.white),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Updates the state after successfully adding a new player.
|
||||||
|
void _handleSuccessfulPlayerCreation(Player player) {
|
||||||
|
selectedPlayers.insert(0, player);
|
||||||
|
widget.onChanged([...selectedPlayers]);
|
||||||
|
allPlayers.add(player);
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
_searchBarController.clear();
|
||||||
|
_updateSuggestedPlayers();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Updates the suggested players list based on current selection.
|
||||||
|
void _updateSuggestedPlayers() {
|
||||||
|
suggestedPlayers = allPlayers
|
||||||
|
.where((player) => !selectedPlayers.contains(player))
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Displays a snackbar message at the bottom of the screen.
|
||||||
|
/// [message] - The message to display in the snackbar.
|
||||||
|
void showSnackBarMessage(String message) {
|
||||||
|
if (!context.mounted) return;
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(
|
||||||
|
backgroundColor: CustomTheme.boxColor,
|
||||||
|
content: Center(
|
||||||
|
child: Text(message, style: const TextStyle(color: Colors.white)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/// Determines the appropriate info text to display when no players
|
/// Determines the appropriate info text to display when no players
|
||||||
/// are available in the suggested players list.
|
/// are available in the suggested players list.
|
||||||
String _getInfoText(BuildContext context) {
|
String _getInfoText(BuildContext context) {
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
|
|
||||||
|
/// A custom search bar widget that encapsulates a [SearchBar] with additional customization options.
|
||||||
|
/// - [controller]: The controller for the search bar's text input.
|
||||||
|
/// - [hintText]: The hint text displayed in the search bar when it is empty.
|
||||||
|
/// - [trailingButtonShown]: Whether to show the trailing button.
|
||||||
|
/// - [trailingButtonicon]: The icon for the trailing button.
|
||||||
|
/// - [trailingButtonEnabled]: Whether the trailing button is in enabled state.
|
||||||
|
/// - [onTrailingButtonPressed]: The callback invoked when the trailing button is pressed.
|
||||||
|
/// - [onChanged]: The callback invoked when the text in the search bar changes.
|
||||||
|
/// - [constraints]: The constraints for the search bar.
|
||||||
class CustomSearchBar extends StatelessWidget {
|
class CustomSearchBar extends StatelessWidget {
|
||||||
final TextEditingController controller;
|
|
||||||
final String hintText;
|
|
||||||
final ValueChanged<String>? onChanged;
|
|
||||||
final BoxConstraints? constraints;
|
|
||||||
final bool trailingButtonShown;
|
|
||||||
final bool trailingButtonEnabled;
|
|
||||||
final VoidCallback? onTrailingButtonPressed;
|
|
||||||
final IconData trailingButtonicon;
|
|
||||||
|
|
||||||
const CustomSearchBar({
|
const CustomSearchBar({
|
||||||
super.key,
|
super.key,
|
||||||
required this.controller,
|
required this.controller,
|
||||||
@@ -23,6 +23,30 @@ class CustomSearchBar extends StatelessWidget {
|
|||||||
this.constraints,
|
this.constraints,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// The controller for the search bar's text input.
|
||||||
|
final TextEditingController controller;
|
||||||
|
|
||||||
|
/// The hint text displayed in the search bar when it is empty.
|
||||||
|
final String hintText;
|
||||||
|
|
||||||
|
/// Whether to show the trailing button.
|
||||||
|
final bool trailingButtonShown;
|
||||||
|
|
||||||
|
/// The icon for the trailing button.
|
||||||
|
final IconData trailingButtonicon;
|
||||||
|
|
||||||
|
/// Whether the trailing button is in enabled state.
|
||||||
|
final bool trailingButtonEnabled;
|
||||||
|
|
||||||
|
/// The callback invoked when the trailing button is pressed.
|
||||||
|
final VoidCallback? onTrailingButtonPressed;
|
||||||
|
|
||||||
|
/// The callback invoked when the text in the search bar changes.
|
||||||
|
final ValueChanged<String>? onChanged;
|
||||||
|
|
||||||
|
/// The constraints for the search bar.
|
||||||
|
final BoxConstraints? constraints;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SearchBar(
|
return SearchBar(
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
|
|
||||||
|
/// A custom text input field widget that encapsulates a [TextField] with specific styling.
|
||||||
|
/// - [controller]: The controller for the text input field.
|
||||||
|
/// - [onChanged]: The callback invoked when the text in the field changes.
|
||||||
|
/// - [hintText]: The hint text displayed in the text input field when it is empty
|
||||||
class TextInputField extends StatelessWidget {
|
class TextInputField extends StatelessWidget {
|
||||||
final TextEditingController controller;
|
|
||||||
final ValueChanged<String>? onChanged;
|
|
||||||
final String hintText;
|
|
||||||
|
|
||||||
const TextInputField({
|
const TextInputField({
|
||||||
super.key,
|
super.key,
|
||||||
required this.controller,
|
required this.controller,
|
||||||
@@ -13,6 +13,15 @@ class TextInputField extends StatelessWidget {
|
|||||||
this.onChanged,
|
this.onChanged,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// The controller for the text input field.
|
||||||
|
final TextEditingController controller;
|
||||||
|
|
||||||
|
/// The callback invoked when the text in the field changes.
|
||||||
|
final ValueChanged<String>? onChanged;
|
||||||
|
|
||||||
|
/// The hint text displayed in the text input field when it is empty.
|
||||||
|
final String hintText;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return TextField(
|
return TextField(
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
|
|
||||||
|
/// A tile widget that allows users to choose an option by tapping on it.
|
||||||
|
/// - [title]: The title text displayed on the tile.
|
||||||
|
/// - [trailingText]: Optional trailing text displayed on the tile.
|
||||||
|
/// - [onPressed]: The callback invoked when the tile is tapped.
|
||||||
class ChooseTile extends StatefulWidget {
|
class ChooseTile extends StatefulWidget {
|
||||||
final String title;
|
|
||||||
final VoidCallback? onPressed;
|
|
||||||
final String? trailingText;
|
|
||||||
const ChooseTile({
|
const ChooseTile({
|
||||||
super.key,
|
super.key,
|
||||||
required this.title,
|
required this.title,
|
||||||
@@ -12,6 +13,15 @@ class ChooseTile extends StatefulWidget {
|
|||||||
this.onPressed,
|
this.onPressed,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// The title text displayed on the tile.
|
||||||
|
final String title;
|
||||||
|
|
||||||
|
/// The callback invoked when the tile is tapped.
|
||||||
|
final VoidCallback? onPressed;
|
||||||
|
|
||||||
|
/// Optional trailing text displayed on the tile.
|
||||||
|
final String? trailingText;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ChooseTile> createState() => _ChooseTileState();
|
State<ChooseTile> createState() => _ChooseTileState();
|
||||||
}
|
}
|
||||||
@@ -22,8 +32,8 @@ class _ChooseTileState extends State<ChooseTile> {
|
|||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: widget.onPressed,
|
onTap: widget.onPressed,
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 5),
|
margin: CustomTheme.tileMargin,
|
||||||
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 15),
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||||
decoration: CustomTheme.standardBoxDecoration,
|
decoration: CustomTheme.standardBoxDecoration,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
|
|
||||||
|
/// A custom radio list tile widget that encapsulates a [Radio] button with additional styling and functionality.
|
||||||
|
/// - [text]: The text to display next to the radio button.
|
||||||
|
/// - [value]: The value associated with the radio button.
|
||||||
|
/// - [onContainerTap]: The callback invoked when the container is tapped.
|
||||||
class CustomRadioListTile<T> extends StatelessWidget {
|
class CustomRadioListTile<T> extends StatelessWidget {
|
||||||
final String text;
|
|
||||||
final T value;
|
|
||||||
final ValueChanged<T> onContainerTap;
|
|
||||||
|
|
||||||
const CustomRadioListTile({
|
const CustomRadioListTile({
|
||||||
super.key,
|
super.key,
|
||||||
required this.text,
|
required this.text,
|
||||||
@@ -13,6 +13,15 @@ class CustomRadioListTile<T> extends StatelessWidget {
|
|||||||
required this.onContainerTap,
|
required this.onContainerTap,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// The text to display next to the radio button.
|
||||||
|
final String text;
|
||||||
|
|
||||||
|
/// The value associated with the radio button.
|
||||||
|
final T value;
|
||||||
|
|
||||||
|
/// The callback invoked when the container is tapped.
|
||||||
|
final ValueChanged<T> onContainerTap;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
@@ -23,7 +32,7 @@ class CustomRadioListTile<T> extends StatelessWidget {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: CustomTheme.boxColor,
|
color: CustomTheme.boxColor,
|
||||||
border: Border.all(color: CustomTheme.boxBorder),
|
border: Border.all(color: CustomTheme.boxBorder),
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: CustomTheme.standardBorderRadiusAll,
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@@ -3,16 +3,22 @@ import 'package:game_tracker/core/custom_theme.dart';
|
|||||||
import 'package:game_tracker/data/dto/group.dart';
|
import 'package:game_tracker/data/dto/group.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/tiles/text_icon_tile.dart';
|
import 'package:game_tracker/presentation/widgets/tiles/text_icon_tile.dart';
|
||||||
|
|
||||||
|
/// A tile widget that displays information about a group, including its name and members.
|
||||||
|
/// - [group]: The group data to be displayed.
|
||||||
|
/// - [isHighlighted]: Whether the tile should be highlighted.
|
||||||
class GroupTile extends StatelessWidget {
|
class GroupTile extends StatelessWidget {
|
||||||
const GroupTile({super.key, required this.group, this.isHighlighted = false});
|
const GroupTile({super.key, required this.group, this.isHighlighted = false});
|
||||||
|
|
||||||
|
/// The group data to be displayed.
|
||||||
final Group group;
|
final Group group;
|
||||||
|
|
||||||
|
/// Whether the tile should be highlighted.
|
||||||
final bool isHighlighted;
|
final bool isHighlighted;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return AnimatedContainer(
|
return AnimatedContainer(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
|
margin: CustomTheme.standardMargin,
|
||||||
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 10),
|
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 10),
|
||||||
decoration: isHighlighted
|
decoration: isHighlighted
|
||||||
? CustomTheme.highlightedBoxDecoration
|
? CustomTheme.highlightedBoxDecoration
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
|
|
||||||
|
/// A tile widget that displays a title with an icon and some content below it.
|
||||||
|
/// - [title]: The title text displayed on the tile.
|
||||||
|
/// - [icon]: The icon displayed next to the title.
|
||||||
|
/// - [content]: The content widget displayed below the title.
|
||||||
|
/// - [padding]: Optional padding for the tile content.
|
||||||
|
/// - [height]: Optional height for the tile.
|
||||||
|
/// - [width]: Optional width for the tile.
|
||||||
class InfoTile extends StatefulWidget {
|
class InfoTile extends StatefulWidget {
|
||||||
final String title;
|
|
||||||
final IconData icon;
|
|
||||||
final Widget content;
|
|
||||||
final EdgeInsets? padding;
|
|
||||||
final double? height;
|
|
||||||
final double? width;
|
|
||||||
const InfoTile({
|
const InfoTile({
|
||||||
super.key,
|
super.key,
|
||||||
required this.title,
|
required this.title,
|
||||||
@@ -18,6 +19,24 @@ class InfoTile extends StatefulWidget {
|
|||||||
this.width,
|
this.width,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// The title text displayed on the tile.
|
||||||
|
final String title;
|
||||||
|
|
||||||
|
/// The icon displayed next to the title.
|
||||||
|
final IconData icon;
|
||||||
|
|
||||||
|
/// The content widget displayed below the title.
|
||||||
|
final Widget content;
|
||||||
|
|
||||||
|
/// Optional padding for the tile content.
|
||||||
|
final EdgeInsets? padding;
|
||||||
|
|
||||||
|
/// Optional height for the tile.
|
||||||
|
final double? height;
|
||||||
|
|
||||||
|
/// Optional width for the tile.
|
||||||
|
final double? width;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<InfoTile> createState() => _InfoTileState();
|
State<InfoTile> createState() => _InfoTileState();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,38 +1,64 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
import 'package:game_tracker/data/dto/match.dart';
|
import 'package:game_tracker/data/dto/match.dart';
|
||||||
|
import 'package:game_tracker/data/dto/player.dart';
|
||||||
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/tiles/text_icon_tile.dart';
|
import 'package:game_tracker/presentation/widgets/tiles/text_icon_tile.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
|
/// A tile widget that displays information about a match, including its name,
|
||||||
|
/// creation date, associated group, winner, and players.
|
||||||
|
/// - [match]: The match data to be displayed.
|
||||||
|
/// - [onTap]: The callback invoked when the tile is tapped.
|
||||||
|
/// - [width]: Optional width for the tile.
|
||||||
|
/// - [compact]: Whether to display the tile in a compact mode
|
||||||
class MatchTile extends StatefulWidget {
|
class MatchTile extends StatefulWidget {
|
||||||
|
const MatchTile({
|
||||||
|
super.key,
|
||||||
|
required this.match,
|
||||||
|
required this.onTap,
|
||||||
|
this.width,
|
||||||
|
this.compact = false,
|
||||||
|
});
|
||||||
|
|
||||||
|
/// The match data to be displayed.
|
||||||
final Match match;
|
final Match match;
|
||||||
|
|
||||||
|
/// The callback invoked when the tile is tapped.
|
||||||
final VoidCallback onTap;
|
final VoidCallback onTap;
|
||||||
|
|
||||||
const MatchTile({super.key, required this.match, required this.onTap});
|
/// Optional width for the tile.
|
||||||
|
final double? width;
|
||||||
|
|
||||||
|
/// Whether to display the tile in a compact mode
|
||||||
|
final bool compact;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<MatchTile> createState() => _MatchTileState();
|
State<MatchTile> createState() => _MatchTileState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _MatchTileState extends State<MatchTile> {
|
class _MatchTileState extends State<MatchTile> {
|
||||||
|
late final List<Player> _allPlayers;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_allPlayers = _getCombinedPlayers();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final group = widget.match.group;
|
final group = widget.match.group;
|
||||||
final winner = widget.match.winner;
|
final winner = widget.match.winner;
|
||||||
final allPlayers = _getAllPlayers();
|
|
||||||
final loc = AppLocalizations.of(context);
|
final loc = AppLocalizations.of(context);
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: widget.onTap,
|
onTap: widget.onTap,
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
margin: EdgeInsets.zero,
|
||||||
padding: const EdgeInsets.all(16),
|
width: widget.width,
|
||||||
decoration: BoxDecoration(
|
padding: const EdgeInsets.all(12),
|
||||||
color: CustomTheme.boxColor,
|
decoration: CustomTheme.standardBoxDecoration,
|
||||||
border: Border.all(color: CustomTheme.boxBorder),
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@@ -65,7 +91,22 @@ class _MatchTileState extends State<MatchTile> {
|
|||||||
const SizedBox(width: 6),
|
const SizedBox(width: 6),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
group.name,
|
'${group.name}${widget.match.players != null ? ' + ${widget.match.players?.length}' : ''}',
|
||||||
|
style: const TextStyle(fontSize: 14, color: Colors.grey),
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
] else if (widget.compact) ...[
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const Icon(Icons.person, size: 16, color: Colors.grey),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
'${widget.match.players!.length} ${loc.players}',
|
||||||
style: const TextStyle(fontSize: 14, color: Colors.grey),
|
style: const TextStyle(fontSize: 14, color: Colors.grey),
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
@@ -99,11 +140,48 @@ class _MatchTileState extends State<MatchTile> {
|
|||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
loc.winner(winner.name),
|
'${loc.winner}: ${winner.name}',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: Colors.white,
|
color: CustomTheme.textColor,
|
||||||
|
),
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
] else ...[
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 8,
|
||||||
|
horizontal: 12,
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.amber.withValues(alpha: 0.1),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
border: Border.all(
|
||||||
|
color: Colors.amber.withValues(alpha: 0.3),
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
const Icon(
|
||||||
|
Icons.watch_later,
|
||||||
|
size: 20,
|
||||||
|
color: Colors.amber,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
loc.match_in_progress,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: CustomTheme.textColor,
|
||||||
),
|
),
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
@@ -114,7 +192,7 @@ class _MatchTileState extends State<MatchTile> {
|
|||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
],
|
],
|
||||||
|
|
||||||
if (allPlayers.isNotEmpty) ...[
|
if (_allPlayers.isNotEmpty && widget.compact == false) ...[
|
||||||
Text(
|
Text(
|
||||||
loc.players,
|
loc.players,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
@@ -127,7 +205,7 @@ class _MatchTileState extends State<MatchTile> {
|
|||||||
Wrap(
|
Wrap(
|
||||||
spacing: 6,
|
spacing: 6,
|
||||||
runSpacing: 6,
|
runSpacing: 6,
|
||||||
children: allPlayers.map((player) {
|
children: _allPlayers.map((player) {
|
||||||
return TextIconTile(text: player.name, iconEnabled: false);
|
return TextIconTile(text: player.name, iconEnabled: false);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
),
|
),
|
||||||
@@ -138,19 +216,17 @@ class _MatchTileState extends State<MatchTile> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Formats the given [dateTime] into a human-readable string based on its
|
||||||
|
/// difference from the current date.
|
||||||
String _formatDate(DateTime dateTime, BuildContext context) {
|
String _formatDate(DateTime dateTime, BuildContext context) {
|
||||||
final now = DateTime.now();
|
final now = DateTime.now();
|
||||||
final difference = now.difference(dateTime);
|
final difference = now.difference(dateTime);
|
||||||
final loc = AppLocalizations.of(context);
|
final loc = AppLocalizations.of(context);
|
||||||
|
|
||||||
if (difference.inDays == 0) {
|
if (difference.inDays == 0) {
|
||||||
return AppLocalizations.of(
|
return "${loc.today_at} ${DateFormat('HH:mm').format(dateTime)}";
|
||||||
context,
|
|
||||||
).today_at(DateFormat('HH:mm').format(dateTime));
|
|
||||||
} else if (difference.inDays == 1) {
|
} else if (difference.inDays == 1) {
|
||||||
return AppLocalizations.of(
|
return "${loc.yesterday_at} ${DateFormat('HH:mm').format(dateTime)}";
|
||||||
context,
|
|
||||||
).yesterday_at(DateFormat('HH:mm').format(dateTime));
|
|
||||||
} else if (difference.inDays < 7) {
|
} else if (difference.inDays < 7) {
|
||||||
return loc.days_ago(difference.inDays);
|
return loc.days_ago(difference.inDays);
|
||||||
} else {
|
} else {
|
||||||
@@ -158,8 +234,10 @@ class _MatchTileState extends State<MatchTile> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<dynamic> _getAllPlayers() {
|
/// Retrieves all unique players associated with the match,
|
||||||
final allPlayers = <dynamic>[];
|
/// combining players from both the match and its group.
|
||||||
|
List<Player> _getCombinedPlayers() {
|
||||||
|
final allPlayers = <Player>[];
|
||||||
final playerIds = <String>{};
|
final playerIds = <String>{};
|
||||||
|
|
||||||
// Add players from game.players
|
// Add players from game.players
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
|
|
||||||
|
/// A tile widget that displays a title with an icon and a numeric value below it.
|
||||||
|
/// - [title]: The title text displayed on the tile.
|
||||||
|
/// - [icon]: The icon displayed next to the title.
|
||||||
|
/// - [value]: The numeric value displayed below the title.
|
||||||
|
/// - [height]: Optional height for the tile.
|
||||||
|
/// - [width]: Optional width for the tile.
|
||||||
|
/// - [padding]: Optional padding for the tile content.
|
||||||
class QuickInfoTile extends StatefulWidget {
|
class QuickInfoTile extends StatefulWidget {
|
||||||
final String title;
|
|
||||||
final IconData icon;
|
|
||||||
final int value;
|
|
||||||
final double? height;
|
|
||||||
final double? width;
|
|
||||||
final EdgeInsets? padding;
|
|
||||||
const QuickInfoTile({
|
const QuickInfoTile({
|
||||||
super.key,
|
super.key,
|
||||||
required this.title,
|
required this.title,
|
||||||
@@ -18,6 +19,24 @@ class QuickInfoTile extends StatefulWidget {
|
|||||||
this.padding,
|
this.padding,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// The title text displayed on the tile.
|
||||||
|
final String title;
|
||||||
|
|
||||||
|
/// The icon displayed next to the title.
|
||||||
|
final IconData icon;
|
||||||
|
|
||||||
|
/// The numeric value displayed below the title.
|
||||||
|
final int value;
|
||||||
|
|
||||||
|
/// Optional height for the tile.
|
||||||
|
final double? height;
|
||||||
|
|
||||||
|
/// Optional width for the tile.
|
||||||
|
final double? width;
|
||||||
|
|
||||||
|
/// Optional padding for the tile content.
|
||||||
|
final EdgeInsets? padding;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<QuickInfoTile> createState() => _QuickInfoTileState();
|
State<QuickInfoTile> createState() => _QuickInfoTileState();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,32 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
|
|
||||||
|
/// A customizable settings list tile widget that displays an icon, title, and an optional suffix widget.
|
||||||
|
/// - [icon]: The icon displayed on the left side of the tile.
|
||||||
|
/// - [title]: The title text displayed next to the icon.
|
||||||
|
/// - [suffixWidget]: An optional widget displayed on the right side of the tile.
|
||||||
|
/// - [onPressed]: The callback invoked when the tile is tapped.
|
||||||
class SettingsListTile extends StatelessWidget {
|
class SettingsListTile extends StatelessWidget {
|
||||||
final VoidCallback? onPressed;
|
|
||||||
final IconData icon;
|
|
||||||
final String title;
|
|
||||||
final Widget? suffixWidget;
|
|
||||||
const SettingsListTile({
|
const SettingsListTile({
|
||||||
super.key,
|
super.key,
|
||||||
required this.title,
|
|
||||||
required this.icon,
|
required this.icon,
|
||||||
|
required this.title,
|
||||||
this.suffixWidget,
|
this.suffixWidget,
|
||||||
this.onPressed,
|
this.onPressed,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// The icon displayed on the left side of the tile.
|
||||||
|
final IconData icon;
|
||||||
|
|
||||||
|
/// The title text displayed next to the icon.
|
||||||
|
final String title;
|
||||||
|
|
||||||
|
/// An optional widget displayed on the right side of the tile.
|
||||||
|
final Widget? suffixWidget;
|
||||||
|
|
||||||
|
/// The callback invoked when the tile is tapped.
|
||||||
|
final VoidCallback? onPressed;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Padding(
|
return Padding(
|
||||||
|
|||||||
@@ -4,6 +4,13 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/tiles/info_tile.dart';
|
import 'package:game_tracker/presentation/widgets/tiles/info_tile.dart';
|
||||||
|
|
||||||
|
/// A tile widget that displays statistical data using horizontal bars.
|
||||||
|
/// - [icon]: The icon displayed next to the title.
|
||||||
|
/// - [title]: The title text displayed on the tile.
|
||||||
|
/// - [width]: The width of the tile.
|
||||||
|
/// - [values]: A list of tuples containing labels and their corresponding numeric values.
|
||||||
|
/// - [itemCount]: The maximum number of items to display.
|
||||||
|
/// - [barColor]: The color of the bars representing the values.
|
||||||
class StatisticsTile extends StatelessWidget {
|
class StatisticsTile extends StatelessWidget {
|
||||||
const StatisticsTile({
|
const StatisticsTile({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -15,16 +22,26 @@ class StatisticsTile extends StatelessWidget {
|
|||||||
required this.barColor,
|
required this.barColor,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// The icon displayed next to the title.
|
||||||
final IconData icon;
|
final IconData icon;
|
||||||
|
|
||||||
|
/// The title text displayed on the tile.
|
||||||
final String title;
|
final String title;
|
||||||
|
|
||||||
|
/// The width of the tile.
|
||||||
final double width;
|
final double width;
|
||||||
|
|
||||||
|
/// A list of tuples containing labels and their corresponding numeric values.
|
||||||
final List<(String, num)> values;
|
final List<(String, num)> values;
|
||||||
|
|
||||||
|
/// The maximum number of items to display.
|
||||||
final int itemCount;
|
final int itemCount;
|
||||||
|
|
||||||
|
/// The color of the bars representing the values.
|
||||||
final Color barColor;
|
final Color barColor;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final maxBarWidth = MediaQuery.of(context).size.width * 0.65;
|
|
||||||
final loc = AppLocalizations.of(context);
|
final loc = AppLocalizations.of(context);
|
||||||
|
|
||||||
return InfoTile(
|
return InfoTile(
|
||||||
@@ -39,38 +56,56 @@ class StatisticsTile extends StatelessWidget {
|
|||||||
heightFactor: 4,
|
heightFactor: 4,
|
||||||
child: Text(loc.no_data_available),
|
child: Text(loc.no_data_available),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: LayoutBuilder(
|
||||||
children: List.generate(min(values.length, itemCount), (index) {
|
builder: (context, constraints) {
|
||||||
/// The maximum wins among all players
|
final maxBarWidth = constraints.maxWidth * 0.65;
|
||||||
final maxMatches = values.isNotEmpty ? values[0].$2 : 0;
|
return Column(
|
||||||
|
children: List.generate(min(values.length, itemCount), (index) {
|
||||||
|
/// The maximum wins among all players
|
||||||
|
final maxMatches = values.isNotEmpty ? values[0].$2 : 0;
|
||||||
|
|
||||||
/// Fraction of wins
|
/// Fraction of wins
|
||||||
final double fraction = (maxMatches > 0)
|
final double fraction = (maxMatches > 0)
|
||||||
? (values[index].$2 / maxMatches)
|
? (values[index].$2 / maxMatches)
|
||||||
: 0.0;
|
: 0.0;
|
||||||
|
|
||||||
/// Calculated width for current the bar
|
/// Calculated width for current the bar
|
||||||
final double barWidth = maxBarWidth * fraction;
|
final double barWidth = maxBarWidth * fraction;
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 2.0),
|
padding: const EdgeInsets.symmetric(vertical: 2.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
|
||||||
Stack(
|
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Stack(
|
||||||
height: 24,
|
children: [
|
||||||
width: barWidth,
|
Container(
|
||||||
decoration: BoxDecoration(
|
height: 24,
|
||||||
borderRadius: BorderRadius.circular(4),
|
width: barWidth,
|
||||||
color: barColor,
|
decoration: BoxDecoration(
|
||||||
),
|
borderRadius: BorderRadius.circular(4),
|
||||||
|
color: barColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 4.0),
|
||||||
|
child: Text(
|
||||||
|
values[index].$1,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
Padding(
|
const Spacer(),
|
||||||
padding: const EdgeInsets.only(left: 4.0),
|
Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
values[index].$1,
|
values[index].$2 <= 1 && values[index].$2 is double
|
||||||
|
? values[index].$2.toStringAsFixed(2)
|
||||||
|
: values[index].$2.toString(),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
@@ -79,23 +114,10 @@ class StatisticsTile extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const Spacer(),
|
);
|
||||||
Center(
|
}),
|
||||||
child: Text(
|
|
||||||
values[index].$2 <= 1 && values[index].$2 is double
|
|
||||||
? values[index].$2.toStringAsFixed(2)
|
|
||||||
: values[index].$2.toString(),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,18 +1,27 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
|
|
||||||
|
/// A list tile widget that displays text with an optional icon button.
|
||||||
|
/// - [text]: The text to display in the tile.
|
||||||
|
/// - [onPressed]: The callback to be invoked when the icon is pressed.
|
||||||
|
/// - [iconEnabled]: A boolean to determine if the icon should be displayed.
|
||||||
class TextIconListTile extends StatelessWidget {
|
class TextIconListTile extends StatelessWidget {
|
||||||
final String text;
|
|
||||||
final VoidCallback? onPressed;
|
|
||||||
final bool iconEnabled;
|
|
||||||
|
|
||||||
const TextIconListTile({
|
const TextIconListTile({
|
||||||
super.key,
|
super.key,
|
||||||
required this.text,
|
required this.text,
|
||||||
this.onPressed,
|
|
||||||
this.iconEnabled = true,
|
this.iconEnabled = true,
|
||||||
|
this.onPressed,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// The text to display in the tile.
|
||||||
|
final String text;
|
||||||
|
|
||||||
|
/// A boolean to determine if the icon should be displayed.
|
||||||
|
final bool iconEnabled;
|
||||||
|
|
||||||
|
/// The callback to be invoked when the icon is pressed.
|
||||||
|
final VoidCallback? onPressed;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
|
|||||||
@@ -1,18 +1,27 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
|
|
||||||
|
/// A tile widget that displays text with an optional icon that can be tapped.
|
||||||
|
/// - [text]: The text to display in the tile.
|
||||||
|
/// - [iconEnabled]: A boolean to determine if the icon should be displayed.
|
||||||
|
/// - [onIconTap]: The callback to be invoked when the icon is tapped.
|
||||||
class TextIconTile extends StatelessWidget {
|
class TextIconTile extends StatelessWidget {
|
||||||
final String text;
|
|
||||||
final bool iconEnabled;
|
|
||||||
final VoidCallback? onIconTap;
|
|
||||||
|
|
||||||
const TextIconTile({
|
const TextIconTile({
|
||||||
super.key,
|
super.key,
|
||||||
required this.text,
|
required this.text,
|
||||||
this.onIconTap,
|
|
||||||
this.iconEnabled = true,
|
this.iconEnabled = true,
|
||||||
|
this.onIconTap,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// The text to display in the tile.
|
||||||
|
final String text;
|
||||||
|
|
||||||
|
/// A boolean to determine if the icon should be displayed.
|
||||||
|
final bool iconEnabled;
|
||||||
|
|
||||||
|
/// The callback to be invoked when the icon is tapped.
|
||||||
|
final VoidCallback? onIconTap;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
|
|
||||||
|
/// A list tile widget that displays a title and description, with optional highlighting and badge.
|
||||||
|
/// - [title]: The title text displayed on the tile.
|
||||||
|
/// - [description]: The description text displayed below the title.
|
||||||
|
/// - [onPressed]: The callback invoked when the tile is tapped.
|
||||||
|
/// - [isHighlighted]: A boolean to determine if the tile should be highlighted.
|
||||||
|
/// - [badgeText]: Optional text to display in a badge on the right side of the title.
|
||||||
|
/// - [badgeColor]: Optional color for the badge background.
|
||||||
class TitleDescriptionListTile extends StatelessWidget {
|
class TitleDescriptionListTile extends StatelessWidget {
|
||||||
final String title;
|
|
||||||
final String description;
|
|
||||||
final VoidCallback? onPressed;
|
|
||||||
final bool isHighlighted;
|
|
||||||
final String? badgeText;
|
|
||||||
final Color? badgeColor;
|
|
||||||
|
|
||||||
const TitleDescriptionListTile({
|
const TitleDescriptionListTile({
|
||||||
super.key,
|
super.key,
|
||||||
required this.title,
|
required this.title,
|
||||||
@@ -19,6 +19,24 @@ class TitleDescriptionListTile extends StatelessWidget {
|
|||||||
this.badgeColor,
|
this.badgeColor,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// The title text displayed on the tile.
|
||||||
|
final String title;
|
||||||
|
|
||||||
|
/// The description text displayed below the title.
|
||||||
|
final String description;
|
||||||
|
|
||||||
|
/// The callback invoked when the tile is tapped.
|
||||||
|
final VoidCallback? onPressed;
|
||||||
|
|
||||||
|
/// A boolean to determine if the tile should be highlighted.
|
||||||
|
final bool isHighlighted;
|
||||||
|
|
||||||
|
/// Optional text to display in a badge on the right side of the title.
|
||||||
|
final String? badgeText;
|
||||||
|
|
||||||
|
/// Optional color for the badge background.
|
||||||
|
final Color? badgeColor;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
/// A widget that displays a message centered at the top of the screen with an icon, title, and message.
|
||||||
|
/// - [icon]: The icon to display above the title.
|
||||||
|
/// - [title]: The title text to display.
|
||||||
|
/// - [message]: The message text to display below the title.
|
||||||
class TopCenteredMessage extends StatelessWidget {
|
class TopCenteredMessage extends StatelessWidget {
|
||||||
const TopCenteredMessage({
|
const TopCenteredMessage({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -8,10 +12,15 @@ class TopCenteredMessage extends StatelessWidget {
|
|||||||
required this.message,
|
required this.message,
|
||||||
});
|
});
|
||||||
|
|
||||||
final String title;
|
/// The icon to display above the title.
|
||||||
final String message;
|
|
||||||
final IconData icon;
|
final IconData icon;
|
||||||
|
|
||||||
|
/// The title text to display.
|
||||||
|
final String title;
|
||||||
|
|
||||||
|
/// The message text to display below the title.
|
||||||
|
final String message;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
|
|||||||
@@ -31,9 +31,25 @@ class DataTransferService {
|
|||||||
|
|
||||||
// Construct a JSON representation of the data
|
// Construct a JSON representation of the data
|
||||||
final Map<String, dynamic> jsonMap = {
|
final Map<String, dynamic> jsonMap = {
|
||||||
'matches': matches.map((match) => match.toJson()).toList(),
|
'players': players.map((p) => p.toJson()).toList(),
|
||||||
'groups': groups.map((group) => group.toJson()).toList(),
|
|
||||||
'players': players.map((player) => player.toJson()).toList(),
|
'groups': groups
|
||||||
|
.map((g) => {
|
||||||
|
'id': g.id,
|
||||||
|
'name': g.name,
|
||||||
|
'createdAt': g.createdAt.toIso8601String(),
|
||||||
|
'memberIds': (g.members).map((m) => m.id).toList(),
|
||||||
|
}).toList(),
|
||||||
|
|
||||||
|
'matches': matches
|
||||||
|
.map((m) => {
|
||||||
|
'id': m.id,
|
||||||
|
'name': m.name,
|
||||||
|
'createdAt': m.createdAt.toIso8601String(),
|
||||||
|
'groupId': m.group?.id,
|
||||||
|
'playerIds': (m.players ?? []).map((p) => p.id).toList(),
|
||||||
|
'winnerId': m.winner?.id,
|
||||||
|
}).toList(),
|
||||||
};
|
};
|
||||||
|
|
||||||
return json.encode(jsonMap);
|
return json.encode(jsonMap);
|
||||||
@@ -46,7 +62,7 @@ class DataTransferService {
|
|||||||
/// [fileName] The desired name for the exported file (without extension).
|
/// [fileName] The desired name for the exported file (without extension).
|
||||||
static Future<ExportResult> exportData(
|
static Future<ExportResult> exportData(
|
||||||
String jsonString,
|
String jsonString,
|
||||||
String fileName,
|
String fileName
|
||||||
) async {
|
) async {
|
||||||
try {
|
try {
|
||||||
final bytes = Uint8List.fromList(utf8.encode(jsonString));
|
final bytes = Uint8List.fromList(utf8.encode(jsonString));
|
||||||
@@ -54,11 +70,13 @@ class DataTransferService {
|
|||||||
fileName: '$fileName.json',
|
fileName: '$fileName.json',
|
||||||
bytes: bytes,
|
bytes: bytes,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (path == null) {
|
if (path == null) {
|
||||||
return ExportResult.canceled;
|
return ExportResult.canceled;
|
||||||
} else {
|
} else {
|
||||||
return ExportResult.success;
|
return ExportResult.success;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (e, stack) {
|
} catch (e, stack) {
|
||||||
print('[exportData] $e');
|
print('[exportData] $e');
|
||||||
print(stack);
|
print(stack);
|
||||||
@@ -81,42 +99,77 @@ class DataTransferService {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
final jsonString = await _readFileContent(path.files.single);
|
final jsonString = await _readFileContent(path.files.single);
|
||||||
if (jsonString == null) {
|
if (jsonString == null) return ImportResult.fileReadError;
|
||||||
return ImportResult.fileReadError;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (await _validateJsonSchema(jsonString)) {
|
final isValid = await _validateJsonSchema(jsonString);
|
||||||
final Map<String, dynamic> jsonData =
|
if (!isValid) return ImportResult.invalidSchema;
|
||||||
json.decode(jsonString) as Map<String, dynamic>;
|
|
||||||
|
|
||||||
final List<dynamic>? matchesJson =
|
final Map<String, dynamic> decoded = json.decode(jsonString) as Map<String, dynamic>;
|
||||||
jsonData['matches'] as List<dynamic>?;
|
|
||||||
final List<dynamic>? groupsJson = jsonData['groups'] as List<dynamic>?;
|
|
||||||
final List<dynamic>? playersJson =
|
|
||||||
jsonData['players'] as List<dynamic>?;
|
|
||||||
|
|
||||||
final List<Match> importedMatches =
|
final List<dynamic> playersJson = (decoded['players'] as List<dynamic>?) ?? [];
|
||||||
matchesJson
|
final List<dynamic> groupsJson = (decoded['groups'] as List<dynamic>?) ?? [];
|
||||||
?.map((g) => Match.fromJson(g as Map<String, dynamic>))
|
final List<dynamic> matchesJson = (decoded['matches'] as List<dynamic>?) ?? [];
|
||||||
.toList() ??
|
|
||||||
[];
|
// Players
|
||||||
final List<Group> importedGroups =
|
final List<Player> importedPlayers = playersJson
|
||||||
groupsJson
|
.map((p) => Player.fromJson(p as Map<String, dynamic>))
|
||||||
?.map((g) => Group.fromJson(g as Map<String, dynamic>))
|
.toList();
|
||||||
.toList() ??
|
|
||||||
[];
|
final Map<String, Player> playerById = {
|
||||||
final List<Player> importedPlayers =
|
for (final p in importedPlayers) p.id: p,
|
||||||
playersJson
|
};
|
||||||
?.map((p) => Player.fromJson(p as Map<String, dynamic>))
|
|
||||||
.toList() ??
|
// Groups
|
||||||
[];
|
final List<Group> importedGroups = groupsJson.map((g) {
|
||||||
|
final map = g as Map<String, dynamic>;
|
||||||
|
final memberIds = (map['memberIds'] as List<dynamic>? ?? []).cast<String>();
|
||||||
|
|
||||||
|
final members = memberIds
|
||||||
|
.map((id) => playerById[id])
|
||||||
|
.whereType<Player>()
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
return Group(
|
||||||
|
id: map['id'] as String,
|
||||||
|
name: map['name'] as String,
|
||||||
|
members: members,
|
||||||
|
createdAt: DateTime.parse(map['createdAt'] as String),
|
||||||
|
);
|
||||||
|
}).toList();
|
||||||
|
|
||||||
|
final Map<String, Group> groupById = {
|
||||||
|
for (final g in importedGroups) g.id: g,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Matches
|
||||||
|
final List<Match> importedMatches = matchesJson.map((m) {
|
||||||
|
final map = m as Map<String, dynamic>;
|
||||||
|
|
||||||
|
final String? groupId = map['groupId'] as String?;
|
||||||
|
final List<String> playerIds = (map['playerIds'] as List<dynamic>? ?? []).cast<String>();
|
||||||
|
final String? winnerId = map['winnerId'] as String?;
|
||||||
|
|
||||||
|
final group = (groupId == null) ? null : groupById[groupId];
|
||||||
|
final players = playerIds
|
||||||
|
.map((id) => playerById[id])
|
||||||
|
.whereType<Player>()
|
||||||
|
.toList();
|
||||||
|
final winner = (winnerId == null) ? null : playerById[winnerId];
|
||||||
|
|
||||||
|
return Match(
|
||||||
|
id: map['id'] as String,
|
||||||
|
name: map['name'] as String,
|
||||||
|
group: group,
|
||||||
|
players: players,
|
||||||
|
createdAt: DateTime.parse(map['createdAt'] as String),
|
||||||
|
winner: winner,
|
||||||
|
);
|
||||||
|
}).toList();
|
||||||
|
|
||||||
|
await db.playerDao.addPlayersAsList(players: importedPlayers);
|
||||||
|
await db.groupDao.addGroupsAsList(groups: importedGroups);
|
||||||
|
await db.matchDao.addMatchAsList(matches: importedMatches);
|
||||||
|
|
||||||
await db.playerDao.addPlayersAsList(players: importedPlayers);
|
|
||||||
await db.groupDao.addGroupsAsList(groups: importedGroups);
|
|
||||||
await db.matchDao.addMatchAsList(matches: importedMatches);
|
|
||||||
} else {
|
|
||||||
return ImportResult.invalidSchema;
|
|
||||||
}
|
|
||||||
return ImportResult.success;
|
return ImportResult.success;
|
||||||
} on FormatException catch (e, stack) {
|
} on FormatException catch (e, stack) {
|
||||||
print('[importData] FormatException');
|
print('[importData] FormatException');
|
||||||
@@ -159,4 +212,4 @@ class DataTransferService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
name: game_tracker
|
name: game_tracker
|
||||||
description: "Game Tracking App for Card Games"
|
description: "Game Tracking App for Card Games"
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
version: 0.0.1+21
|
version: 0.0.4+101
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.8.1
|
sdk: ^3.8.1
|
||||||
@@ -9,11 +9,6 @@ environment:
|
|||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
material_symbols_icons: ^4.2815.1
|
|
||||||
|
|
||||||
# The following adds the Cupertino Icons font to your application.
|
|
||||||
# Use with the CupertinoIcons class for iOS style icons.
|
|
||||||
cupertino_icons: ^1.0.8
|
|
||||||
drift: ^2.27.0
|
drift: ^2.27.0
|
||||||
drift_flutter: ^0.2.4
|
drift_flutter: ^0.2.4
|
||||||
path_provider: ^2.1.5
|
path_provider: ^2.1.5
|
||||||
@@ -27,6 +22,7 @@ dependencies:
|
|||||||
intl: any
|
intl: any
|
||||||
flutter_localizations:
|
flutter_localizations:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
package_info_plus: ^9.0.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Reference in New Issue
Block a user