Compare commits
443 Commits
0e027f258a
...
enhancemen
| Author | SHA1 | Date | |
|---|---|---|---|
| 0f79495775 | |||
| dcd8b460c1 | |||
| dbbe04d4cc | |||
| 1ed6290628 | |||
| 91a7273964 | |||
| b1bb8b919f | |||
| 697767f0de | |||
| 306a783d67 | |||
| 03035138ac | |||
| 7323f52153 | |||
| f5842f9c4a | |||
| e3ac91bf48 | |||
| dba448b9c1 | |||
| d8551b3a27 | |||
| 8f2c7493d0 | |||
| f7f97fcdcb | |||
| 9ac6b6e04c | |||
| e77896c1d4 | |||
| dd2024e96e | |||
| cd9780871f | |||
| 3169eebd14 | |||
| ec902c6196 | |||
| b719a6662b | |||
| 09b407eba8 | |||
| 877c2921d9 | |||
|
|
5ce4964c32 | ||
|
|
fb28de5772 | ||
|
|
f713bd6fb7 | ||
| 71b2f30d29 | |||
| d2d6852f31 | |||
| 126dc7ed97 | |||
| 40a3c1b82e | |||
|
|
da722c5277 | ||
|
|
516c2afd1e | ||
|
|
9ee9da2ac8 | ||
|
|
aa208bb2ef | ||
|
|
a29123c964 | ||
|
|
8c005d6e5e | ||
|
|
cc50e497c9 | ||
|
|
ae348499d4 | ||
|
|
b443230285 | ||
|
|
099e587d45 | ||
| dc0e536221 | |||
| 2a34243e69 | |||
| 499415e0c5 | |||
| 397c5c1550 | |||
| 738f242eee | |||
| 745aaef978 | |||
| b5234c765c | |||
| 919c9f57ac | |||
| 27424694ce | |||
| 84338f8f66 | |||
| 733df2dcb5 | |||
| 9ba3dd7909 | |||
| 2838376434 | |||
| 86ec4de5c0 | |||
| 479e9a2575 | |||
| d97871d15b | |||
| 00fd6880e9 | |||
| 649330f358 | |||
| 07d81d687b | |||
| b291673899 | |||
| 5fbf2ccb45 | |||
| e489d16c51 | |||
| 7cfffadb86 | |||
| ae529effd2 | |||
| 4c3b2152eb | |||
| 51e3c04e72 | |||
| 2b9f038b0d | |||
| 0653700f9c | |||
| 7be80e6f91 | |||
| a4b934388d | |||
| f8c0dbba5a | |||
| ebb531d825 | |||
| fc9779153d | |||
| a2522cef13 | |||
| 442e1d64a3 | |||
| 54b54796e8 | |||
| 686463720a | |||
| 6a77028171 | |||
| f1bd9c18e0 | |||
| 6c9b742bdf | |||
| 744a402602 | |||
| 2d9148788e | |||
| 18f635e6ef | |||
| 9efbc12909 | |||
| 7c7676abee | |||
| 1faa74f026 | |||
| 3afae89234 | |||
| 093c527591 | |||
| 2ba710ca2d | |||
| 9054b163ce | |||
| e182c815a1 | |||
| c284d10943 | |||
| 72e48ada94 | |||
|
|
4591a6857d | ||
|
|
44279bc148 | ||
|
|
32c7d45809 | ||
|
|
4341c2509e | ||
| a3fa499662 | |||
| f25737cdc5 | |||
| 0b500b5248 | |||
| e71cb11295 | |||
| b102ec4c1c | |||
| 974d6e9b56 | |||
|
|
290948e50d | ||
|
|
bbd200e245 | ||
| 694cac7f26 | |||
| bd616c510a | |||
| 424a258df1 | |||
| 6dc74ca82e | |||
|
|
ac6af803fd | ||
|
|
f21d0ba4e8 | ||
| 8307488f28 | |||
| 937f1e3ac8 | |||
| 46d1c25bb5 | |||
| cdba6e264a | |||
| 88fa886ea2 | |||
| cc2f87396f | |||
| 692a3ef3a4 | |||
| 22d95b0015 | |||
| 1a84d2572a | |||
| ca55b99d03 | |||
| 651f210ea8 | |||
| 0153df6195 | |||
| e4abf53f66 | |||
| 2616f7c113 | |||
| 7881e61a2e | |||
| 73c5586874 | |||
| 963edaf1d1 | |||
| 604a541392 | |||
| 26fadf5093 | |||
| 9e8bab1a60 | |||
| fc51b30491 | |||
| def37aa640 | |||
| 8ae85c925d | |||
| b744b04648 | |||
| 17e882986d | |||
| 7cda25a380 | |||
| e9b041e43a | |||
| c38c731b41 | |||
| d411f58134 | |||
| fee5c57207 | |||
| de60c942ea | |||
| acc5b0a3e9 | |||
| 24babe06d2 | |||
| 50dd05ecc5 | |||
| 4ff131770e | |||
| 82b344a145 | |||
| 338f4294dc | |||
| cfed05595c | |||
| fa841e328e | |||
| f658a88849 | |||
| feb5fa0615 | |||
| fba35521cb | |||
| e60961730f | |||
| 59c041699d | |||
| c170aa1775 | |||
| 692b412fe2 | |||
| cc04e05557 | |||
| 546a3e3717 | |||
| b2036e4e68 | |||
| 310b9aa43b | |||
| e464ddb466 | |||
| c3deaa3974 | |||
| fd13fe6e90 | |||
| 5062196463 | |||
| 6af1df5fbc | |||
| df3215ef76 | |||
| 28ed22ce73 | |||
| 0593297fc3 | |||
| b668f6b9ae | |||
| 78b511b207 | |||
| 63d9ed400d | |||
| d809d80506 | |||
| 30645f06f8 | |||
| 9346f61d14 | |||
| bef812502c | |||
| 24f18f5c65 | |||
| 62eea08614 | |||
| 893eb91143 | |||
| 2ebd4274f0 | |||
| 70307016b3 | |||
| 1b3334f3e0 | |||
|
|
6a985b0b1e | ||
|
|
95f0861a79 | ||
| 7cd53aa695 | |||
| ab250e2df4 | |||
| dbb52cfc48 | |||
| c56663d15e | |||
| 51722eb7fd | |||
| 78d530ddd5 | |||
| 8c05385203 | |||
| d948f2f13d | |||
| e15f5d163d | |||
| 32f3f68da9 | |||
| 229750ffcf | |||
| fe9239ee02 | |||
| 961c6bb679 | |||
| b21ca54672 | |||
| 6055eb63a8 | |||
| 31589855f2 | |||
| 8e63a01705 | |||
| e512cbbf95 | |||
| 89b3f1ff69 | |||
| 72067863c2 | |||
| 29a3e77fc4 | |||
| a61818dd77 | |||
| e364e15d0a | |||
| 195ebf569a | |||
| eb7b247cae | |||
| 01fede2951 | |||
| b67f321276 | |||
| d16beed490 | |||
| 0111774308 | |||
| 8ff3c01435 | |||
| bce4cdcb2d | |||
| fa0e9a5dfd | |||
| ec9e34305a | |||
| 45650133a7 | |||
| f40a9ad09b | |||
| 822bc03c83 | |||
| a8d4e640cf | |||
| cf71b40718 | |||
| f7c1d6e975 | |||
| 17dabb773d | |||
| e14984d4a9 | |||
| 682c1d269d | |||
| d264b3fa1b | |||
| b684ebd4f6 | |||
| 2cae66a8ae | |||
| 0967abe10f | |||
| 061a927324 | |||
| 412cfff9f5 | |||
| f7073a83a4 | |||
| 9434282ed1 | |||
| d145b18891 | |||
| 3e3def0bde | |||
| 3408930524 | |||
| 87b1a7d57f | |||
| cf834e636e | |||
| 8e2befaf3d | |||
| 186d8cf5c9 | |||
| 6f42b36587 | |||
| 248d652e06 | |||
| e71e65b197 | |||
| 3f79a7b898 | |||
| 1232cb8f0d | |||
| 018332d8e6 | |||
| 201fd70685 | |||
| 9365313c92 | |||
| 54e1756e79 | |||
| 3b6a914022 | |||
| 98b02adc85 | |||
| b82261317c | |||
| c76e193b4d | |||
| 0ac8c21052 | |||
| 74fffa95e2 | |||
| ca4bf03bab | |||
| aade42c0a6 | |||
| 0659d202b3 | |||
| 81cdeb7ed6 | |||
| 89d7bb54a1 | |||
| 5d8047b3ba | |||
| dd8af42a47 | |||
| 346dddcf62 | |||
| 9f4fc3a3b0 | |||
| 594ea947c2 | |||
| e5268ebc12 | |||
| 1732878c7f | |||
| f136400c7e | |||
| c89243f886 | |||
| a3b45053e7 | |||
| 91b68eac3e | |||
| 6ae1ce9bc7 | |||
| 7ac5986588 | |||
| 601b7d0a4f | |||
| e852a4d539 | |||
| e108bb41f6 | |||
| 17c14dd230 | |||
| 7123d36cd8 | |||
| 7cc72015d3 | |||
| 10e56a7241 | |||
| 6638c2deee | |||
| 974f06b6b8 | |||
| 63d2117a6a | |||
| 6ae39717fd | |||
| 003835472d | |||
| 8d91eb3780 | |||
| ddc8d93592 | |||
| eeec92181a | |||
| a8962e68b6 | |||
| 322c51a764 | |||
|
|
69e13e877e | ||
|
|
f388c442d2 | ||
| 82e28b7509 | |||
| 8150b42dba | |||
| 75c6f4e01c | |||
| 19c99eef9c | |||
| f2a749cb0f | |||
| 5dcd0826bd | |||
| f6ebda7984 | |||
| 69c95ca672 | |||
| 42ce69f4d3 | |||
| 08fcaa35ee | |||
| 2ee8edcf9b | |||
| fd86f5193f | |||
| 8cc898cad6 | |||
| 67c8a7e181 | |||
| 2da2e28cb6 | |||
| d86de09042 | |||
| 07d623d963 | |||
| a8a81c2151 | |||
| d341634885 | |||
| d3a63bd299 | |||
| e0c8398873 | |||
| d65dd3d983 | |||
| 51a8c4ea58 | |||
| c67f688a77 | |||
| 1d9945c525 | |||
| 0202d09812 | |||
| 73d8e7522c | |||
| 80290efa0b | |||
| f4ed122220 | |||
| 2f260d7cbc | |||
| 7781284289 | |||
| c0ff2bf677 | |||
| 8f9289617f | |||
| 1882d0007b | |||
| 282841ecf1 | |||
| 05c41707ca | |||
| a5e508dbda | |||
| 412d1fd334 | |||
| c31d757615 | |||
| 178aaa9643 | |||
| 2076e45fd5 | |||
| 62acc87e0e | |||
| 3ca081419b | |||
| 3e89bfd641 | |||
| c3a2ac77b0 | |||
| 6b2fb18ec0 | |||
| 7a85b5c1ac | |||
| f8b6c00d5d | |||
| a7f6a53b9c | |||
| 35f2f8754a | |||
| 47bb090e72 | |||
| b2a3d7ce7f | |||
| fde5344244 | |||
| 2fc7eab1ac | |||
| e4de8fdb25 | |||
| a54495f915 | |||
| b5e7fe23ab | |||
| c195c5e2bb | |||
| 729cd5eff1 | |||
| 630836d40c | |||
| f06f333a8e | |||
| 06933a67ac | |||
| a9dd3216cc | |||
| 10a45ac1f0 | |||
| a1d57fc424 | |||
| 9ffb7d6ca3 | |||
| 4befc85c9f | |||
| accc189949 | |||
| c1e032208c | |||
| 258f610e28 | |||
| deab074885 | |||
| 38466c6056 | |||
| 8d8d4319d2 | |||
| d3de0fda49 | |||
| e709edbf7a | |||
| 74402f2e04 | |||
| 5c09dfb47d | |||
| 02735b5b1d | |||
| a6f40456d8 | |||
| d931e85e9f | |||
| a707990356 | |||
| 3bd522df6e | |||
| 2dd4f52336 | |||
| 2dad822d79 | |||
| 640830d8ab | |||
| 168d7748a9 | |||
| b475237b9e | |||
| 2a7d409df0 | |||
| 7c34e51779 | |||
| ac6f3d0f92 | |||
| 511124e323 | |||
| d07bc6e8bb | |||
| 352fdc13f1 | |||
| d36348c59c | |||
| d08c79fc26 | |||
| 36aa4722a3 | |||
| 67bbb15845 | |||
| 1081fb8be7 | |||
| 34bf6740ad | |||
| 7be86b3d9e | |||
| cbd5e1d0ba | |||
| 2ee4d8e6fa | |||
|
|
1536e2b2af | ||
|
|
0f13de30c4 | ||
|
|
3f0adb4c05 | ||
| 2179331455 | |||
| 9229f1f0a5 | |||
| 39b2068121 | |||
| 93a4ccaee0 | |||
| 3f5a840675 | |||
| 67d5f7e891 | |||
| ac99217b72 | |||
| ca40ae668d | |||
| d07943add9 | |||
| b6700bafd9 | |||
| a922f24150 | |||
| 25c7b37df3 | |||
| b83fe03f35 | |||
| cb8ff4314b | |||
| d11b8a806f | |||
| 1abfb1bd19 | |||
| 40f9ff6413 | |||
| 39c72c38cf | |||
| dd754eb569 | |||
| 4f8ba002d3 | |||
| 6cbc64c042 | |||
| 55e5e3cbeb | |||
| 2c0e996795 | |||
| e61f9e5e64 | |||
| 4c1d91ae99 | |||
| e88211245c | |||
| f1974cf71a | |||
| a811e0933e | |||
|
|
1b090a43a0 | ||
| 3916cca2ca | |||
| 5b75a325ea | |||
|
|
92817bc4db | ||
|
|
34df9f007b | ||
|
|
1698f61c2b | ||
|
|
17d304eb5d | ||
| e1426810f2 | |||
| b03979b0c6 | |||
|
|
5bbb5c1888 | ||
|
|
d5315a8f00 | ||
|
|
5baeda8b32 | ||
|
|
0895f6df0a | ||
| 4503574443 | |||
|
|
9db8c80d63 |
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report for something does not work as it should
|
||||
about: Erstelle eine Meldung für etwas, das nicht Funktioniert, wie es soll.
|
||||
title: ''
|
||||
labels: 'Task/Bug'
|
||||
assignees: ''
|
||||
@@ -9,28 +9,27 @@ assignees: ''
|
||||
|
||||
# Bug Report
|
||||
|
||||
## Description
|
||||
[A clear and concise description of the bug]
|
||||
## Beschreibung
|
||||
[Eine klare und prägnante Beschreibung des Bugs]
|
||||
|
||||
## Steps to Reproduce
|
||||
1. Step 1
|
||||
2. Step 2
|
||||
## Schritte zur Reproduktion
|
||||
1. Schritt 1
|
||||
2. Schritt 2
|
||||
3. ...
|
||||
|
||||
## Expected Behavior
|
||||
[What should have happened]
|
||||
## Erwartetes Verhalten
|
||||
[Was hätte passieren sollen]
|
||||
|
||||
## Actual Behavior
|
||||
[What actually happened]
|
||||
## Tatsächliches Verhalten
|
||||
[Was tatsächlich passiert ist]
|
||||
|
||||
## Screenshots/Logs
|
||||
[If applicable, add screenshots, error logs, or stack traces]
|
||||
## Screenshots/Protokolle
|
||||
[Falls zutreffend, füge Screenshots, Error Logs oder Stack Traces hinzu]
|
||||
|
||||
## Environment
|
||||
- OS: [e.g., iOS 18.5, Android 14]
|
||||
## Umgebung
|
||||
- Plattform: Android, iOS, Web
|
||||
- OS: [z. B. iOS 18.5, Android 14]
|
||||
- Flutter Version: [z.B. 3.35.6]
|
||||
|
||||
## Possible Fix (Optional)
|
||||
[Any suggestions on how to resolve the issue]
|
||||
|
||||
## Related Issues (Optional)
|
||||
[Reference similar issues or PRs]
|
||||
## Verwandte Issues
|
||||
[Verweisen Sie auf ähnliche Issues oder PRs]
|
||||
@@ -9,14 +9,14 @@ assignees: ''
|
||||
|
||||
# Enhancement
|
||||
|
||||
## Current Behavior
|
||||
[Describe the existing functionality]
|
||||
## Aktuelles Verhalten
|
||||
[Beschreibe die bestehende Funktionalität]
|
||||
|
||||
## Limitations/Problems
|
||||
[What are the current shortcomings?]
|
||||
## Einschränkungen/Probleme
|
||||
[Was sind die aktuellen Mängel?]
|
||||
|
||||
## Suggested Improvement
|
||||
[How can this be enhanced? Be specific.]
|
||||
## Vorgeschlagene Verbesserung
|
||||
[Wie kann das Problem bzw. die Einschränkung verbessert werden?]
|
||||
|
||||
## Benefits
|
||||
[How will this improve the product?]
|
||||
## Zugehörige Issues
|
||||
[Links zu verwandten oder blockierenden Issues]
|
||||
@@ -1,22 +1,19 @@
|
||||
---
|
||||
name: Feature
|
||||
about: New feature for the app
|
||||
about: Neues Feature für die App
|
||||
title: ''
|
||||
labels: 'Task\Feature'
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
# 🚀 Feature
|
||||
# Feature
|
||||
|
||||
## Description
|
||||
[Detailed explanation of the proposed feature]
|
||||
## Beschreibung
|
||||
[Ausführliche Erläuterung der vorgeschlagenen Funktion]
|
||||
|
||||
## Why is this feature needed?
|
||||
[Explain the problem or use case this feature would solve]
|
||||
## Vorgeschlagene Lösung
|
||||
[Beschreibe, wie die Feature funktionieren soll]
|
||||
|
||||
## Proposed Solution
|
||||
[Describe how the feature should work]
|
||||
|
||||
## Related Issues (Optional)
|
||||
[Links to related discussions or requests]
|
||||
## Zugehörige Issues
|
||||
[Links zu verwandten oder blockierenden Issues]
|
||||
@@ -1,16 +1,16 @@
|
||||
# [PR Title]
|
||||
# [PR Titel]
|
||||
|
||||
**Related Issue(s):**
|
||||
**Zugehörige Issue(s):**
|
||||
Closes `<issue-no>`
|
||||
|
||||
## Description
|
||||
*A clear and concise overview of the changes made. Explain the "why" behind the PR, not just the "what".*
|
||||
## Beschreibung
|
||||
*Eine klare und prägnante Übersicht über die vorgenommenen Änderungen. Erläutere nicht nur das was gemacht wurde, sondern auch warum.*
|
||||
|
||||
## Changes Made
|
||||
- [ ] Added new feature X
|
||||
- [ ] Fixed bug in component Y
|
||||
- [ ] Refactored module Z for better performance
|
||||
- [ ] Updated dependencies
|
||||
## Änderungen
|
||||
- [ ] Neue Funktion X hinzugefügt
|
||||
- [ ] Bug in Komponente Y behoben
|
||||
- [ ] Modul Z für bessere Leistung refactored
|
||||
- [ ] Dependencies aktualisiert
|
||||
|
||||
## Additional Notes
|
||||
*Any extra context, limitations, or decisions that reviewers should know about?*
|
||||
## Zusätzliche Anmerkungen
|
||||
*Gibt es zusätzlichen Kontext, Einschränkungen oder Informationen, die Reviewer wissen sollten?*
|
||||
|
||||
57
.gitea/workflows/pull_request.yaml
Normal file
@@ -0,0 +1,57 @@
|
||||
name: Pull Request Pipeline
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install jq
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y jq
|
||||
|
||||
- name: Install Flutter (wget)
|
||||
run: |
|
||||
wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.38.2-stable.tar.xz
|
||||
tar xf flutter_linux_3.38.2-stable.tar.xz
|
||||
# Set Git safe directory for Flutter path
|
||||
git config --global --add safe.directory "$(pwd)/flutter"
|
||||
# Set Flutter path
|
||||
echo "$(pwd)/flutter/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Get dependencies
|
||||
run: flutter pub get
|
||||
|
||||
- name: Analyze Formatting
|
||||
run: flutter analyze lib test
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y jq
|
||||
|
||||
- name: Install Flutter (wget)
|
||||
run: |
|
||||
wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.38.2-stable.tar.xz
|
||||
tar xf flutter_linux_3.38.2-stable.tar.xz
|
||||
# Set Git safe directory for Flutter path
|
||||
git config --global --add safe.directory "$(pwd)/flutter"
|
||||
# Set Flutter path
|
||||
echo "$(pwd)/flutter/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Get dependencies
|
||||
run: flutter pub get
|
||||
|
||||
- name: Run tests
|
||||
run: flutter test
|
||||
50
.gitea/workflows/push.yaml
Normal file
@@ -0,0 +1,50 @@
|
||||
name: Push Pipeline
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "development"
|
||||
- "main"
|
||||
|
||||
jobs:
|
||||
format:
|
||||
runs-on: ubuntu-latest
|
||||
if: false # Needs bot user
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y jq
|
||||
|
||||
- name: Install Flutter (wget)
|
||||
run: |
|
||||
wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.38.2-stable.tar.xz
|
||||
tar xf flutter_linux_3.38.2-stable.tar.xz
|
||||
# Set Git safe directory for Flutter path
|
||||
git config --global --add safe.directory "$(pwd)/flutter"
|
||||
# Set Flutter path
|
||||
echo "$(pwd)/flutter/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Get & upgrade dependencies
|
||||
run: |
|
||||
flutter pub get
|
||||
flutter pub upgrade --major-versions
|
||||
|
||||
- name: Auto-format
|
||||
run: |
|
||||
dart format lib
|
||||
dart fix --apply lib
|
||||
|
||||
# Needs credentials, push access and the right files need to be staged
|
||||
- name: Commit Changes
|
||||
run: |
|
||||
git config --global user.name "Gitea Actions"
|
||||
git config --global user.email "actions@gitea.com"
|
||||
git status
|
||||
git add lib/
|
||||
git status
|
||||
git commit -m "Actions: Auto-formatting [skip ci]"
|
||||
git push
|
||||
14
README.md
@@ -1,7 +1,15 @@
|
||||
# Game Tracker
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
### Versions Supported
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
A all-in-one app to track card- and board games, manage players and groups and get statistics about your played games.
|
||||
|
||||
BIN
android/app/src/main/ic_launcher-playstore.png
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Modify this file to customize your launch splash screen -->
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@android:color/white" />
|
||||
<item android:drawable="@color/launch_background" />
|
||||
|
||||
<!-- You can insert your own image assets here -->
|
||||
<!-- <item>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
|
Before Width: | Height: | Size: 544 B |
BIN
android/app/src/main/res/mipmap-hdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 828 B |
BIN
android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 448 B |
BIN
android/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 442 B |
BIN
android/app/src/main/res/mipmap-mdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 656 B |
BIN
android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 348 B |
BIN
android/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 721 B |
BIN
android/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 508 B |
BIN
android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
BIN
android/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 704 B |
BIN
android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
BIN
android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 824 B |
BIN
android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 6.9 KiB |
5
android/app/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="app_icon_background">#E6F1E4</color>
|
||||
<color name="launch_background">#0B0B0B</color>
|
||||
</resources>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Referenz unbedingt als @color/launch_background (nicht @colors/...) -->
|
||||
<color name="ic_launcher_background">@color/app_icon_background</color>
|
||||
</resources>
|
||||
@@ -4,7 +4,7 @@
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<!-- Show a splash screen on the activity. Automatically removed when
|
||||
the Flutter engine draws its first frame -->
|
||||
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||
<item name="android:windowBackground">@color/launch_background</item>
|
||||
</style>
|
||||
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||
This theme determines the color of the Android Window while your
|
||||
|
||||
179
assets/schema.json
Normal file
@@ -0,0 +1,179 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"games": {
|
||||
"type": "array",
|
||||
"items": [
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"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": {
|
||||
"type": [
|
||||
"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": {
|
||||
"type": ["object","null"]
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"createdAt",
|
||||
"name"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"groups": {
|
||||
"type": "array",
|
||||
"items": [
|
||||
{
|
||||
"type": "object",
|
||||
"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"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"players": {
|
||||
"type": "array",
|
||||
"items": [
|
||||
{
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"createdAt",
|
||||
"name"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>12.0</string>
|
||||
<string>13.0</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Uncomment this line to define a global platform for your project
|
||||
# platform :ios, '12.0'
|
||||
# platform :ios, '13.0'
|
||||
|
||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||
|
||||
@@ -11,9 +11,11 @@
|
||||
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
|
||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
|
||||
8AD879B4BA24BC1EB84E1092 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8543AAE6520EA0C0B3AF8FEE /* Pods_RunnerTests.framework */; };
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
|
||||
DDD6907F99188C9B97C6B11F /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D622CF241440C10C19C0D397 /* Pods_Runner.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@@ -40,14 +42,18 @@
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
13301BC306FBFE16F253F2B9 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
||||
32DDFE3349B038E1CA758D7B /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
|
||||
331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
|
||||
331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
|
||||
8543AAE6520EA0C0B3AF8FEE /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
96CDE41BAA7259C918DB326B /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
|
||||
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
|
||||
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
@@ -55,13 +61,26 @@
|
||||
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
B194217AD06D15D90AAF9056 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
B68CF4A64F0B5E45B43D6900 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; };
|
||||
D622CF241440C10C19C0D397 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E754D1191B3E54E52B6DCC49 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
6F6FEDCE9772FEF7A6255134 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8AD879B4BA24BC1EB84E1092 /* Pods_RunnerTests.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
97C146EB1CF9000F007C117D /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
DDD6907F99188C9B97C6B11F /* Pods_Runner.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -94,6 +113,8 @@
|
||||
97C146F01CF9000F007C117D /* Runner */,
|
||||
97C146EF1CF9000F007C117D /* Products */,
|
||||
331C8082294A63A400263BE5 /* RunnerTests */,
|
||||
ABF0E17C36D6999806C09130 /* Pods */,
|
||||
F14326E3F17437DD2E32AB7B /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@@ -121,6 +142,29 @@
|
||||
path = Runner;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
ABF0E17C36D6999806C09130 /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B194217AD06D15D90AAF9056 /* Pods-Runner.debug.xcconfig */,
|
||||
32DDFE3349B038E1CA758D7B /* Pods-Runner.release.xcconfig */,
|
||||
13301BC306FBFE16F253F2B9 /* Pods-Runner.profile.xcconfig */,
|
||||
96CDE41BAA7259C918DB326B /* Pods-RunnerTests.debug.xcconfig */,
|
||||
B68CF4A64F0B5E45B43D6900 /* Pods-RunnerTests.release.xcconfig */,
|
||||
E754D1191B3E54E52B6DCC49 /* Pods-RunnerTests.profile.xcconfig */,
|
||||
);
|
||||
name = Pods;
|
||||
path = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F14326E3F17437DD2E32AB7B /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D622CF241440C10C19C0D397 /* Pods_Runner.framework */,
|
||||
8543AAE6520EA0C0B3AF8FEE /* Pods_RunnerTests.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@@ -128,8 +172,10 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */;
|
||||
buildPhases = (
|
||||
F7D5E29C2C77E2E8925BBB8A /* [CP] Check Pods Manifest.lock */,
|
||||
331C807D294A63A400263BE5 /* Sources */,
|
||||
331C807F294A63A400263BE5 /* Resources */,
|
||||
6F6FEDCE9772FEF7A6255134 /* Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -145,12 +191,14 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
||||
buildPhases = (
|
||||
8947D8DE27F8CB7D5A5F265C /* [CP] Check Pods Manifest.lock */,
|
||||
9740EEB61CF901F6004384FC /* Run Script */,
|
||||
97C146EA1CF9000F007C117D /* Sources */,
|
||||
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||
97C146EC1CF9000F007C117D /* Resources */,
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||
0CC58B149CD3F41CF94E1C52 /* [CP] Embed Pods Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -222,6 +270,23 @@
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
0CC58B149CD3F41CF94E1C52 /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
@@ -238,6 +303,28 @@
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
|
||||
};
|
||||
8947D8DE27F8CB7D5A5F265C /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
9740EEB61CF901F6004384FC /* Run Script */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
@@ -253,6 +340,28 @@
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
||||
};
|
||||
F7D5E29C2C77E2E8925BBB8A /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
@@ -346,7 +455,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SUPPORTED_PLATFORMS = iphoneos;
|
||||
@@ -379,6 +488,7 @@
|
||||
};
|
||||
331C8088294A63A400263BE5 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 96CDE41BAA7259C918DB326B /* Pods-RunnerTests.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
@@ -396,6 +506,7 @@
|
||||
};
|
||||
331C8089294A63A400263BE5 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = B68CF4A64F0B5E45B43D6900 /* Pods-RunnerTests.release.xcconfig */;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
@@ -411,6 +522,7 @@
|
||||
};
|
||||
331C808A294A63A400263BE5 /* Profile */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = E754D1191B3E54E52B6DCC49 /* Pods-RunnerTests.profile.xcconfig */;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
@@ -473,7 +585,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
@@ -524,7 +636,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SUPPORTED_PLATFORMS = iphoneos;
|
||||
|
||||
3
ios/Runner.xcworkspace/contents.xcworkspacedata
generated
@@ -4,4 +4,7 @@
|
||||
<FileRef
|
||||
location = "group:Runner.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Pods/Pods.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
|
||||
@@ -1,122 +1,14 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-20x20@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-20x20@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-29x29@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-40x40@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-40x40@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-60x60@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"idiom" : "iphone",
|
||||
"filename" : "Icon-App-60x60@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-20x20@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "20x20",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-20x20@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-29x29@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-29x29@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-40x40@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "40x40",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-40x40@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-76x76@1x.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "76x76",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-76x76@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "83.5x83.5",
|
||||
"idiom" : "ipad",
|
||||
"filename" : "Icon-App-83.5x83.5@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "1024x1024",
|
||||
"idiom" : "ios-marketing",
|
||||
"filename" : "Icon-App-1024x1024@1x.png",
|
||||
"scale" : "1x"
|
||||
"filename" : "icon_x1024.png",
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 295 B |
|
Before Width: | Height: | Size: 406 B |
|
Before Width: | Height: | Size: 450 B |
|
Before Width: | Height: | Size: 282 B |
|
Before Width: | Height: | Size: 462 B |
|
Before Width: | Height: | Size: 704 B |
|
Before Width: | Height: | Size: 406 B |
|
Before Width: | Height: | Size: 586 B |
|
Before Width: | Height: | Size: 862 B |
|
Before Width: | Height: | Size: 862 B |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 762 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/icon_x1024.png
Normal file
|
After Width: | Height: | Size: 8.8 KiB |
6
ios/Runner/Assets.xcassets/Contents.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 68 B |
|
Before Width: | Height: | Size: 68 B |
|
Before Width: | Height: | Size: 68 B |
@@ -1,5 +0,0 @@
|
||||
# Launch Screen Assets
|
||||
|
||||
You can customize the launch screen with your own desired assets by replacing the image files in this directory.
|
||||
|
||||
You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.043",
|
||||
"green" : "0.043",
|
||||
"red" : "0.043"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "icon.png",
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage@3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
ios/Runner/Assets.xcassets/LauncherIcon.imageset/icon.png
vendored
Normal file
|
After Width: | Height: | Size: 9.6 KiB |
@@ -1,8 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="24412" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<device id="retina6_12" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="24405"/>
|
||||
<capability name="Named colors" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
@@ -14,24 +17,27 @@
|
||||
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="LauncherIcon" translatesAutoresizingMaskIntoConstraints="NO" id="ygV-Op-Bu5">
|
||||
<rect key="frame" x="46" y="334" width="301" height="184"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
|
||||
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
|
||||
</constraints>
|
||||
<color key="backgroundColor" name="LauncherBackgroundColor"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375"/>
|
||||
<point key="canvasLocation" x="80.152671755725194" y="264.08450704225356"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<color key="tintColor" red="0.90196078431372551" green="0.94509803921568625" blue="0.89411764705882346" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<resources>
|
||||
<image name="LaunchImage" width="168" height="185"/>
|
||||
<image name="LauncherIcon" width="1000" height="1000"/>
|
||||
<namedColor name="LauncherBackgroundColor">
|
||||
<color red="0.90196078431372551" green="0.94509803921568625" blue="0.89411764705882346" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</namedColor>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="24412" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
|
||||
<device id="retina6_12" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="24405"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Flutter View Controller-->
|
||||
@@ -14,13 +16,14 @@
|
||||
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="141" y="131"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
|
||||
@@ -3,7 +3,23 @@ import 'package:flutter/material.dart';
|
||||
class CustomTheme {
|
||||
static Color primaryColor = const Color(0xFF7505E4);
|
||||
static Color secondaryColor = const Color(0xFFAFA2FF);
|
||||
static Color backgroundColor = const Color(0xFF1A1A1A);
|
||||
static Color backgroundColor = const Color(0xFF0B0B0B);
|
||||
static Color boxColor = const Color(0xFF101010);
|
||||
static Color onBoxColor = const Color(0xFF181818);
|
||||
static Color boxBorder = const Color(0xFF272727);
|
||||
|
||||
static BoxDecoration standardBoxDecoration = BoxDecoration(
|
||||
color: boxColor,
|
||||
border: Border.all(color: boxBorder),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
);
|
||||
|
||||
static BoxDecoration highlightedBoxDecoration = BoxDecoration(
|
||||
color: boxColor,
|
||||
border: Border.all(color: primaryColor),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: [BoxShadow(color: primaryColor.withAlpha(120), blurRadius: 12)],
|
||||
);
|
||||
|
||||
static AppBarTheme appBarTheme = AppBarTheme(
|
||||
backgroundColor: backgroundColor,
|
||||
|
||||
31
lib/core/enums.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
/// Button types used for styling the [CustomWidthButton]
|
||||
enum ButtonType { primary, secondary, tertiary }
|
||||
|
||||
/// Result types for import operations in the [SettingsView]
|
||||
/// - [ImportResult.success]: The import operation was successful.
|
||||
/// - [ImportResult.canceled]: The import operation was canceled by the user.
|
||||
/// - [ImportResult.fileReadError]: There was an error reading the selected file.
|
||||
/// - [ImportResult.invalidSchema]: The JSON schema of the imported data is invalid.
|
||||
/// - [ImportResult.formatException]: A format exception occurred during import.
|
||||
/// - [ImportResult.unknownException]: An exception occurred during import.
|
||||
enum ImportResult {
|
||||
success,
|
||||
canceled,
|
||||
fileReadError,
|
||||
invalidSchema,
|
||||
formatException,
|
||||
unknownException,
|
||||
}
|
||||
|
||||
/// Result types for export operations in the [SettingsView]
|
||||
/// - [ExportResult.success]: The export operation was successful.
|
||||
/// - [ExportResult.canceled]: The export operation was canceled by the user.
|
||||
/// - [ExportResult.unknownException]: An exception occurred during export.
|
||||
enum ExportResult { success, canceled, unknownException }
|
||||
|
||||
/// Different rulesets available for games
|
||||
/// - [Ruleset.singleWinner]: The game is won by a single player
|
||||
/// - [Ruleset.singleLoser]: The game is lost by a single player
|
||||
/// - [Ruleset.mostPoints]: The player with the most points wins.
|
||||
/// - [Ruleset.lastPoints]: The player with the fewest points wins.
|
||||
enum Ruleset { singleWinner, singleLoser, mostPoints, lastPoints }
|
||||
320
lib/data/dao/game_dao.dart
Normal file
@@ -0,0 +1,320 @@
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:game_tracker/data/db/database.dart';
|
||||
import 'package:game_tracker/data/db/tables/game_table.dart';
|
||||
import 'package:game_tracker/data/dto/game.dart';
|
||||
import 'package:game_tracker/data/dto/group.dart';
|
||||
import 'package:game_tracker/data/dto/player.dart';
|
||||
|
||||
part 'game_dao.g.dart';
|
||||
|
||||
@DriftAccessor(tables: [GameTable])
|
||||
class GameDao extends DatabaseAccessor<AppDatabase> with _$GameDaoMixin {
|
||||
GameDao(super.db);
|
||||
|
||||
/// Retrieves all games from the database.
|
||||
Future<List<Game>> getAllGames() async {
|
||||
final query = select(gameTable);
|
||||
final result = await query.get();
|
||||
|
||||
return Future.wait(
|
||||
result.map((row) async {
|
||||
final group = await db.groupGameDao.getGroupOfGame(gameId: row.id);
|
||||
final players = await db.playerGameDao.getPlayersOfGame(gameId: row.id);
|
||||
final winner = row.winnerId != null
|
||||
? await db.playerDao.getPlayerById(playerId: row.winnerId!)
|
||||
: null;
|
||||
return Game(
|
||||
id: row.id,
|
||||
name: row.name,
|
||||
group: group,
|
||||
players: players,
|
||||
createdAt: row.createdAt,
|
||||
winner: winner,
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
/// Retrieves a [Game] by its [gameId].
|
||||
Future<Game> getGameById({required String gameId}) async {
|
||||
final query = select(gameTable)..where((g) => g.id.equals(gameId));
|
||||
final result = await query.getSingle();
|
||||
|
||||
List<Player>? players;
|
||||
if (await db.playerGameDao.gameHasPlayers(gameId: gameId)) {
|
||||
players = await db.playerGameDao.getPlayersOfGame(gameId: gameId);
|
||||
}
|
||||
Group? group;
|
||||
if (await db.groupGameDao.gameHasGroup(gameId: gameId)) {
|
||||
group = await db.groupGameDao.getGroupOfGame(gameId: gameId);
|
||||
}
|
||||
Player? winner;
|
||||
if (result.winnerId != null) {
|
||||
winner = await db.playerDao.getPlayerById(playerId: result.winnerId!);
|
||||
}
|
||||
|
||||
return Game(
|
||||
id: result.id,
|
||||
name: result.name,
|
||||
players: players,
|
||||
group: group,
|
||||
winner: winner,
|
||||
createdAt: result.createdAt,
|
||||
);
|
||||
}
|
||||
|
||||
/// Adds a new [Game] to the database.
|
||||
/// Also adds associated players and group if they exist.
|
||||
Future<void> addGame({required Game game}) async {
|
||||
await db.transaction(() async {
|
||||
await into(gameTable).insert(
|
||||
GameTableCompanion.insert(
|
||||
id: game.id,
|
||||
name: game.name,
|
||||
winnerId: Value(game.winner?.id),
|
||||
createdAt: game.createdAt,
|
||||
),
|
||||
mode: InsertMode.insertOrReplace,
|
||||
);
|
||||
|
||||
if (game.players != null) {
|
||||
await db.playerDao.addPlayersAsList(players: game.players!);
|
||||
for (final p in game.players ?? []) {
|
||||
await db.playerGameDao.addPlayerToGame(
|
||||
gameId: game.id,
|
||||
playerId: p.id,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (game.group != null) {
|
||||
await db.groupDao.addGroup(group: game.group!);
|
||||
await db.groupGameDao.addGroupToGame(
|
||||
gameId: game.id,
|
||||
groupId: game.group!.id,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Adds multiple [Game]s to the database in a batch operation.
|
||||
/// Also adds associated players and groups if they exist.
|
||||
/// If the [games] list is empty, the method returns immediately.
|
||||
Future<void> addGamesAsList({required List<Game> games}) async {
|
||||
if (games.isEmpty) return;
|
||||
await db.transaction(() async {
|
||||
// Add all games in batch
|
||||
await db.batch(
|
||||
(b) => b.insertAll(
|
||||
gameTable,
|
||||
games
|
||||
.map(
|
||||
(game) => GameTableCompanion.insert(
|
||||
id: game.id,
|
||||
name: game.name,
|
||||
createdAt: game.createdAt,
|
||||
winnerId: Value(game.winner?.id),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
mode: InsertMode.insertOrReplace,
|
||||
),
|
||||
);
|
||||
|
||||
// Add all groups of the games in batch
|
||||
await db.batch(
|
||||
(b) => b.insertAll(
|
||||
db.groupTable,
|
||||
games
|
||||
.where((game) => game.group != null)
|
||||
.map(
|
||||
(game) => GroupTableCompanion.insert(
|
||||
id: game.group!.id,
|
||||
name: game.group!.name,
|
||||
createdAt: game.group!.createdAt,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
mode: InsertMode.insertOrReplace,
|
||||
),
|
||||
);
|
||||
|
||||
// Add all players of the games in batch (unique)
|
||||
final uniquePlayers = <String, Player>{};
|
||||
for (final game in games) {
|
||||
if (game.players != null) {
|
||||
for (final p in game.players!) {
|
||||
uniquePlayers[p.id] = p;
|
||||
}
|
||||
}
|
||||
// Also include members of groups
|
||||
if (game.group != null) {
|
||||
for (final m in game.group!.members) {
|
||||
uniquePlayers[m.id] = m;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (uniquePlayers.isNotEmpty) {
|
||||
await db.batch(
|
||||
(b) => b.insertAll(
|
||||
db.playerTable,
|
||||
uniquePlayers.values
|
||||
.map(
|
||||
(p) => PlayerTableCompanion.insert(
|
||||
id: p.id,
|
||||
name: p.name,
|
||||
createdAt: p.createdAt,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
mode: InsertMode.insertOrReplace,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Add all player-game associations in batch
|
||||
await db.batch((b) {
|
||||
for (final game in games) {
|
||||
if (game.players != null) {
|
||||
for (final p in game.players ?? []) {
|
||||
b.insert(
|
||||
db.playerGameTable,
|
||||
PlayerGameTableCompanion.insert(
|
||||
gameId: game.id,
|
||||
playerId: p.id,
|
||||
),
|
||||
mode: InsertMode.insertOrReplace,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Add all player-group associations in batch
|
||||
await db.batch((b) {
|
||||
for (final game in games) {
|
||||
if (game.group != null) {
|
||||
for (final m in game.group!.members) {
|
||||
b.insert(
|
||||
db.playerGroupTable,
|
||||
PlayerGroupTableCompanion.insert(
|
||||
playerId: m.id,
|
||||
groupId: game.group!.id,
|
||||
),
|
||||
mode: InsertMode.insertOrReplace,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Add all group-game associations in batch
|
||||
await db.batch((b) {
|
||||
for (final game in games) {
|
||||
if (game.group != null) {
|
||||
b.insert(
|
||||
db.groupGameTable,
|
||||
GroupGameTableCompanion.insert(
|
||||
gameId: game.id,
|
||||
groupId: game.group!.id,
|
||||
),
|
||||
mode: InsertMode.insertOrReplace,
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/// Deletes the game with the given [gameId] from the database.
|
||||
/// Returns `true` if more than 0 rows were affected, otherwise `false`.
|
||||
Future<bool> deleteGame({required String gameId}) async {
|
||||
final query = delete(gameTable)..where((g) => g.id.equals(gameId));
|
||||
final rowsAffected = await query.go();
|
||||
return rowsAffected > 0;
|
||||
}
|
||||
|
||||
/// Retrieves the number of games in the database.
|
||||
Future<int> getGameCount() async {
|
||||
final count =
|
||||
await (selectOnly(gameTable)..addColumns([gameTable.id.count()]))
|
||||
.map((row) => row.read(gameTable.id.count()))
|
||||
.getSingle();
|
||||
return count ?? 0;
|
||||
}
|
||||
|
||||
/// Checks if a game with the given [gameId] exists in the database.
|
||||
/// Returns `true` if the game exists, otherwise `false`.
|
||||
Future<bool> gameExists({required String gameId}) async {
|
||||
final query = select(gameTable)..where((g) => g.id.equals(gameId));
|
||||
final result = await query.getSingleOrNull();
|
||||
return result != null;
|
||||
}
|
||||
|
||||
/// Deletes all games from the database.
|
||||
/// Returns `true` if more than 0 rows were affected, otherwise `false`.
|
||||
Future<bool> deleteAllGames() async {
|
||||
final query = delete(gameTable);
|
||||
final rowsAffected = await query.go();
|
||||
return rowsAffected > 0;
|
||||
}
|
||||
|
||||
/// Sets the winner of the game with the given [gameId] to the player with
|
||||
/// the given [winnerId].
|
||||
/// Returns `true` if more than 0 rows were affected, otherwise `false`.
|
||||
Future<bool> setWinner({
|
||||
required String gameId,
|
||||
required String winnerId,
|
||||
}) async {
|
||||
final query = update(gameTable)..where((g) => g.id.equals(gameId));
|
||||
final rowsAffected = await query.write(
|
||||
GameTableCompanion(winnerId: Value(winnerId)),
|
||||
);
|
||||
return rowsAffected > 0;
|
||||
}
|
||||
|
||||
/// Retrieves the winner of the game with the given [gameId].
|
||||
/// Returns the [Player] who won the game, or `null` if no winner is set.
|
||||
Future<Player?> getWinner({required String gameId}) async {
|
||||
final query = select(gameTable)..where((g) => g.id.equals(gameId));
|
||||
final result = await query.getSingleOrNull();
|
||||
if (result == null || result.winnerId == null) {
|
||||
return null;
|
||||
}
|
||||
final winner = await db.playerDao.getPlayerById(playerId: result.winnerId!);
|
||||
return winner;
|
||||
}
|
||||
|
||||
/// Removes the winner of the game with the given [gameId].
|
||||
/// Returns `true` if more than 0 rows were affected, otherwise `false`.
|
||||
Future<bool> removeWinner({required String gameId}) async {
|
||||
final query = update(gameTable)..where((g) => g.id.equals(gameId));
|
||||
final rowsAffected = await query.write(
|
||||
const GameTableCompanion(winnerId: Value(null)),
|
||||
);
|
||||
return rowsAffected > 0;
|
||||
}
|
||||
|
||||
/// Checks if the game with the given [gameId] has a winner set.
|
||||
/// Returns `true` if a winner is set, otherwise `false`.
|
||||
Future<bool> hasWinner({required String gameId}) async {
|
||||
final query = select(gameTable)
|
||||
..where((g) => g.id.equals(gameId) & g.winnerId.isNotNull());
|
||||
final result = await query.getSingleOrNull();
|
||||
return result != null;
|
||||
}
|
||||
|
||||
/// Changes the title of the game with the given [gameId] to [newName].
|
||||
/// Returns `true` if more than 0 rows were affected, otherwise `false`.
|
||||
Future<bool> updateGameName({
|
||||
required String gameId,
|
||||
required String newName,
|
||||
}) async {
|
||||
final query = update(gameTable)..where((g) => g.id.equals(gameId));
|
||||
final rowsAffected = await query.write(
|
||||
GameTableCompanion(name: Value(newName)),
|
||||
);
|
||||
return rowsAffected > 0;
|
||||
}
|
||||
}
|
||||
8
lib/data/dao/game_dao.g.dart
Normal file
@@ -0,0 +1,8 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'game_dao.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
mixin _$GameDaoMixin on DatabaseAccessor<AppDatabase> {
|
||||
$GameTableTable get gameTable => attachedDatabase.gameTable;
|
||||
}
|
||||
209
lib/data/dao/group_dao.dart
Normal file
@@ -0,0 +1,209 @@
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:game_tracker/data/db/database.dart';
|
||||
import 'package:game_tracker/data/db/tables/group_table.dart';
|
||||
import 'package:game_tracker/data/dto/group.dart';
|
||||
import 'package:game_tracker/data/dto/player.dart';
|
||||
|
||||
part 'group_dao.g.dart';
|
||||
|
||||
@DriftAccessor(tables: [GroupTable])
|
||||
class GroupDao extends DatabaseAccessor<AppDatabase> with _$GroupDaoMixin {
|
||||
GroupDao(super.db);
|
||||
|
||||
/// Retrieves all groups from the database.
|
||||
Future<List<Group>> getAllGroups() async {
|
||||
final query = select(groupTable);
|
||||
final result = await query.get();
|
||||
return Future.wait(
|
||||
result.map((groupData) async {
|
||||
final members = await db.playerGroupDao.getPlayersOfGroup(
|
||||
groupId: groupData.id,
|
||||
);
|
||||
return Group(
|
||||
id: groupData.id,
|
||||
name: groupData.name,
|
||||
members: members,
|
||||
createdAt: groupData.createdAt,
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
/// Retrieves a [Group] by its [groupId], including its members.
|
||||
Future<Group> getGroupById({required String groupId}) async {
|
||||
final query = select(groupTable)..where((g) => g.id.equals(groupId));
|
||||
final result = await query.getSingle();
|
||||
|
||||
List<Player> members = await db.playerGroupDao.getPlayersOfGroup(
|
||||
groupId: groupId,
|
||||
);
|
||||
|
||||
return Group(
|
||||
id: result.id,
|
||||
name: result.name,
|
||||
members: members,
|
||||
createdAt: result.createdAt,
|
||||
);
|
||||
}
|
||||
|
||||
/// Adds a new group with the given [id] and [name] to the database.
|
||||
/// This method also adds the group's members to the [PlayerGroupTable].
|
||||
Future<bool> addGroup({required Group group}) async {
|
||||
if (!await groupExists(groupId: group.id)) {
|
||||
await db.transaction(() async {
|
||||
await into(groupTable).insert(
|
||||
GroupTableCompanion.insert(
|
||||
id: group.id,
|
||||
name: group.name,
|
||||
createdAt: group.createdAt,
|
||||
),
|
||||
mode: InsertMode.insertOrReplace,
|
||||
);
|
||||
await Future.wait(
|
||||
group.members.map((player) => db.playerDao.addPlayer(player: player)),
|
||||
);
|
||||
await db.batch(
|
||||
(b) => b.insertAll(
|
||||
db.playerGroupTable,
|
||||
group.members
|
||||
.map(
|
||||
(member) => PlayerGroupTableCompanion.insert(
|
||||
playerId: member.id,
|
||||
groupId: group.id,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
mode: InsertMode.insertOrReplace,
|
||||
),
|
||||
);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Adds multiple groups to the database.
|
||||
/// Also adds the group's members to the [PlayerGroupTable].
|
||||
Future<void> addGroupsAsList({required List<Group> groups}) async {
|
||||
if (groups.isEmpty) return;
|
||||
await db.transaction(() async {
|
||||
// Deduplicate groups by id - keep first occurrence
|
||||
final Map<String, Group> uniqueGroups = {};
|
||||
for (final g in groups) {
|
||||
uniqueGroups.putIfAbsent(g.id, () => g);
|
||||
}
|
||||
|
||||
// Insert unique groups in batch
|
||||
await db.batch(
|
||||
(b) => b.insertAll(
|
||||
groupTable,
|
||||
uniqueGroups.values
|
||||
.map(
|
||||
(group) => GroupTableCompanion.insert(
|
||||
id: group.id,
|
||||
name: group.name,
|
||||
createdAt: group.createdAt,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
mode: InsertMode.insertOrReplace,
|
||||
),
|
||||
);
|
||||
|
||||
// Collect unique players from all groups
|
||||
final uniquePlayers = <String, Player>{};
|
||||
for (final g in uniqueGroups.values) {
|
||||
for (final m in g.members) {
|
||||
uniquePlayers[m.id] = m;
|
||||
}
|
||||
}
|
||||
|
||||
if (uniquePlayers.isNotEmpty) {
|
||||
await db.batch(
|
||||
(b) => b.insertAll(
|
||||
db.playerTable,
|
||||
uniquePlayers.values
|
||||
.map(
|
||||
(p) => PlayerTableCompanion.insert(
|
||||
id: p.id,
|
||||
name: p.name,
|
||||
createdAt: p.createdAt,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
mode: InsertMode.insertOrReplace,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Prepare all player-group associations in one list (unique pairs)
|
||||
final Set<String> seenPairs = {};
|
||||
final List<PlayerGroupTableCompanion> pgRows = [];
|
||||
for (final g in uniqueGroups.values) {
|
||||
for (final m in g.members) {
|
||||
final key = '${m.id}|${g.id}';
|
||||
if (!seenPairs.contains(key)) {
|
||||
seenPairs.add(key);
|
||||
pgRows.add(
|
||||
PlayerGroupTableCompanion.insert(playerId: m.id, groupId: g.id),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pgRows.isNotEmpty) {
|
||||
await db.batch((b) {
|
||||
for (final pg in pgRows) {
|
||||
b.insert(db.playerGroupTable, pg, mode: InsertMode.insertOrReplace);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Deletes the group with the given [id] from the database.
|
||||
/// Returns `true` if more than 0 rows were affected, otherwise `false`.
|
||||
Future<bool> deleteGroup({required String groupId}) async {
|
||||
final query = (delete(groupTable)..where((g) => g.id.equals(groupId)));
|
||||
final rowsAffected = await query.go();
|
||||
return rowsAffected > 0;
|
||||
}
|
||||
|
||||
/// Updates the name of the group with the given [id] to [newName].
|
||||
/// Returns `true` if more than 0 rows were affected, otherwise `false`.
|
||||
Future<bool> updateGroupname({
|
||||
required String groupId,
|
||||
required String newName,
|
||||
}) async {
|
||||
final rowsAffected =
|
||||
await (update(groupTable)..where((g) => g.id.equals(groupId))).write(
|
||||
GroupTableCompanion(name: Value(newName)),
|
||||
);
|
||||
return rowsAffected > 0;
|
||||
}
|
||||
|
||||
/// Retrieves the number of groups in the database.
|
||||
Future<int> getGroupCount() async {
|
||||
final count =
|
||||
await (selectOnly(groupTable)..addColumns([groupTable.id.count()]))
|
||||
.map((row) => row.read(groupTable.id.count()))
|
||||
.getSingle();
|
||||
return count ?? 0;
|
||||
}
|
||||
|
||||
/// Checks if a group with the given [groupId] exists in the database.
|
||||
/// Returns `true` if the group exists, `false` otherwise.
|
||||
Future<bool> groupExists({required String groupId}) async {
|
||||
final query = select(groupTable)..where((g) => g.id.equals(groupId));
|
||||
final result = await query.getSingleOrNull();
|
||||
return result != null;
|
||||
}
|
||||
|
||||
/// Deletes all groups from the database.
|
||||
/// Returns `true` if more than 0 rows were affected, otherwise `false`.
|
||||
Future<bool> deleteAllGroups() async {
|
||||
final query = delete(groupTable);
|
||||
final rowsAffected = await query.go();
|
||||
return rowsAffected > 0;
|
||||
}
|
||||
}
|
||||
8
lib/data/dao/group_dao.g.dart
Normal file
@@ -0,0 +1,8 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'group_dao.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
mixin _$GroupDaoMixin on DatabaseAccessor<AppDatabase> {
|
||||
$GroupTableTable get groupTable => attachedDatabase.groupTable;
|
||||
}
|
||||
98
lib/data/dao/group_game_dao.dart
Normal file
@@ -0,0 +1,98 @@
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:game_tracker/data/db/database.dart';
|
||||
import 'package:game_tracker/data/db/tables/group_game_table.dart';
|
||||
import 'package:game_tracker/data/dto/group.dart';
|
||||
|
||||
part 'group_game_dao.g.dart';
|
||||
|
||||
@DriftAccessor(tables: [GroupGameTable])
|
||||
class GroupGameDao extends DatabaseAccessor<AppDatabase>
|
||||
with _$GroupGameDaoMixin {
|
||||
GroupGameDao(super.db);
|
||||
|
||||
/// Associates a group with a game by inserting a record into the
|
||||
/// [GroupGameTable].
|
||||
Future<void> addGroupToGame({
|
||||
required String gameId,
|
||||
required String groupId,
|
||||
}) async {
|
||||
if (await gameHasGroup(gameId: gameId)) {
|
||||
throw Exception('Game already has a group');
|
||||
}
|
||||
await into(groupGameTable).insert(
|
||||
GroupGameTableCompanion.insert(groupId: groupId, gameId: gameId),
|
||||
mode: InsertMode.insertOrReplace,
|
||||
);
|
||||
}
|
||||
|
||||
/// Retrieves the [Group] associated with the given [gameId].
|
||||
/// Returns `null` if no group is found.
|
||||
Future<Group?> getGroupOfGame({required String gameId}) async {
|
||||
final result = await (select(
|
||||
groupGameTable,
|
||||
)..where((g) => g.gameId.equals(gameId))).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 [gameId].
|
||||
/// Returns `true` if there is a group, otherwise `false`.
|
||||
Future<bool> gameHasGroup({required String gameId}) async {
|
||||
final count =
|
||||
await (selectOnly(groupGameTable)
|
||||
..where(groupGameTable.gameId.equals(gameId))
|
||||
..addColumns([groupGameTable.groupId.count()]))
|
||||
.map((row) => row.read(groupGameTable.groupId.count()))
|
||||
.getSingle();
|
||||
return (count ?? 0) > 0;
|
||||
}
|
||||
|
||||
/// Checks if a specific group is associated with a specific game.
|
||||
/// Returns `true` if the group is in the game, otherwise `false`.
|
||||
Future<bool> isGroupInGame({
|
||||
required String gameId,
|
||||
required String groupId,
|
||||
}) async {
|
||||
final count =
|
||||
await (selectOnly(groupGameTable)
|
||||
..where(
|
||||
groupGameTable.gameId.equals(gameId) &
|
||||
groupGameTable.groupId.equals(groupId),
|
||||
)
|
||||
..addColumns([groupGameTable.groupId.count()]))
|
||||
.map((row) => row.read(groupGameTable.groupId.count()))
|
||||
.getSingle();
|
||||
return (count ?? 0) > 0;
|
||||
}
|
||||
|
||||
/// Removes the association of a group from a game based on [groupId] and
|
||||
/// [gameId].
|
||||
/// Returns `true` if more than 0 rows were affected, otherwise `false`.
|
||||
Future<bool> removeGroupFromGame({
|
||||
required String gameId,
|
||||
required String groupId,
|
||||
}) async {
|
||||
final query = delete(groupGameTable)
|
||||
..where((g) => g.gameId.equals(gameId) & g.groupId.equals(groupId));
|
||||
final rowsAffected = await query.go();
|
||||
return rowsAffected > 0;
|
||||
}
|
||||
|
||||
/// Updates the group associated with a game to [newGroupId] based on
|
||||
/// [gameId].
|
||||
/// Returns `true` if more than 0 rows were affected, otherwise `false`.
|
||||
Future<bool> updateGroupOfGame({
|
||||
required String gameId,
|
||||
required String newGroupId,
|
||||
}) async {
|
||||
final updatedRows =
|
||||
await (update(groupGameTable)..where((g) => g.gameId.equals(gameId)))
|
||||
.write(GroupGameTableCompanion(groupId: Value(newGroupId)));
|
||||
return updatedRows > 0;
|
||||
}
|
||||
}
|
||||
10
lib/data/dao/group_game_dao.g.dart
Normal file
@@ -0,0 +1,10 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'group_game_dao.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
mixin _$GroupGameDaoMixin on DatabaseAccessor<AppDatabase> {
|
||||
$GroupTableTable get groupTable => attachedDatabase.groupTable;
|
||||
$GameTableTable get gameTable => attachedDatabase.gameTable;
|
||||
$GroupGameTableTable get groupGameTable => attachedDatabase.groupGameTable;
|
||||
}
|
||||
117
lib/data/dao/player_dao.dart
Normal file
@@ -0,0 +1,117 @@
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:game_tracker/data/db/database.dart';
|
||||
import 'package:game_tracker/data/db/tables/player_table.dart';
|
||||
import 'package:game_tracker/data/dto/player.dart';
|
||||
|
||||
part 'player_dao.g.dart';
|
||||
|
||||
@DriftAccessor(tables: [PlayerTable])
|
||||
class PlayerDao extends DatabaseAccessor<AppDatabase> with _$PlayerDaoMixin {
|
||||
PlayerDao(super.db);
|
||||
|
||||
/// Retrieves all players from the database.
|
||||
Future<List<Player>> getAllPlayers() async {
|
||||
final query = select(playerTable);
|
||||
final result = await query.get();
|
||||
return result
|
||||
.map(
|
||||
(row) => Player(id: row.id, name: row.name, createdAt: row.createdAt),
|
||||
)
|
||||
.toList();
|
||||
}
|
||||
|
||||
/// Retrieves a [Player] by their [id].
|
||||
Future<Player> getPlayerById({required String playerId}) async {
|
||||
final query = select(playerTable)..where((p) => p.id.equals(playerId));
|
||||
final result = await query.getSingle();
|
||||
return Player(
|
||||
id: result.id,
|
||||
name: result.name,
|
||||
createdAt: result.createdAt,
|
||||
);
|
||||
}
|
||||
|
||||
/// Adds a new [player] to the database.
|
||||
/// If a player with the same ID already exists, updates their name to
|
||||
/// the new one.
|
||||
Future<bool> addPlayer({required Player player}) async {
|
||||
if (!await playerExists(playerId: player.id)) {
|
||||
await into(playerTable).insert(
|
||||
PlayerTableCompanion.insert(
|
||||
id: player.id,
|
||||
name: player.name,
|
||||
createdAt: player.createdAt,
|
||||
),
|
||||
mode: InsertMode.insertOrReplace,
|
||||
);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Adds multiple [players] to the database in a batch operation.
|
||||
Future<bool> addPlayersAsList({required List<Player> players}) async {
|
||||
if (players.isEmpty) return false;
|
||||
|
||||
await db.batch(
|
||||
(b) => b.insertAll(
|
||||
playerTable,
|
||||
players
|
||||
.map(
|
||||
(player) => PlayerTableCompanion.insert(
|
||||
id: player.id,
|
||||
name: player.name,
|
||||
createdAt: player.createdAt,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
mode: InsertMode.insertOrReplace,
|
||||
),
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Deletes the player with the given [id] from the database.
|
||||
/// Returns `true` if the player was deleted, `false` if the player did not exist.
|
||||
Future<bool> deletePlayer({required String playerId}) async {
|
||||
final query = delete(playerTable)..where((p) => p.id.equals(playerId));
|
||||
final rowsAffected = await query.go();
|
||||
return rowsAffected > 0;
|
||||
}
|
||||
|
||||
/// Checks if a player with the given [id] exists in the database.
|
||||
/// Returns `true` if the player exists, `false` otherwise.
|
||||
Future<bool> playerExists({required String playerId}) async {
|
||||
final query = select(playerTable)..where((p) => p.id.equals(playerId));
|
||||
final result = await query.getSingleOrNull();
|
||||
return result != null;
|
||||
}
|
||||
|
||||
/// Updates the name of the player with the given [playerId] to [newName].
|
||||
Future<void> updatePlayername({
|
||||
required String playerId,
|
||||
required String newName,
|
||||
}) async {
|
||||
await (update(playerTable)..where((p) => p.id.equals(playerId))).write(
|
||||
PlayerTableCompanion(name: Value(newName)),
|
||||
);
|
||||
}
|
||||
|
||||
/// Retrieves the total count of players in the database.
|
||||
Future<int> getPlayerCount() async {
|
||||
final count =
|
||||
await (selectOnly(playerTable)..addColumns([playerTable.id.count()]))
|
||||
.map((row) => row.read(playerTable.id.count()))
|
||||
.getSingle();
|
||||
return count ?? 0;
|
||||
}
|
||||
|
||||
/// Deletes all players from the database.
|
||||
/// Returns `true` if more than 0 rows were affected, otherwise `false`.
|
||||
Future<bool> deleteAllPlayers() async {
|
||||
final query = delete(playerTable);
|
||||
final rowsAffected = await query.go();
|
||||
return rowsAffected > 0;
|
||||
}
|
||||
}
|
||||
8
lib/data/dao/player_dao.g.dart
Normal file
@@ -0,0 +1,8 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'player_dao.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
mixin _$PlayerDaoMixin on DatabaseAccessor<AppDatabase> {
|
||||
$PlayerTableTable get playerTable => attachedDatabase.playerTable;
|
||||
}
|
||||
128
lib/data/dao/player_game_dao.dart
Normal file
@@ -0,0 +1,128 @@
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:game_tracker/data/db/database.dart';
|
||||
import 'package:game_tracker/data/db/tables/player_game_table.dart';
|
||||
import 'package:game_tracker/data/dto/player.dart';
|
||||
|
||||
part 'player_game_dao.g.dart';
|
||||
|
||||
@DriftAccessor(tables: [PlayerGameTable])
|
||||
class PlayerGameDao extends DatabaseAccessor<AppDatabase>
|
||||
with _$PlayerGameDaoMixin {
|
||||
PlayerGameDao(super.db);
|
||||
|
||||
/// Associates a player with a game by inserting a record into the
|
||||
/// [PlayerGameTable].
|
||||
Future<void> addPlayerToGame({
|
||||
required String gameId,
|
||||
required String playerId,
|
||||
}) async {
|
||||
await into(playerGameTable).insert(
|
||||
PlayerGameTableCompanion.insert(playerId: playerId, gameId: gameId),
|
||||
mode: InsertMode.insertOrReplace,
|
||||
);
|
||||
}
|
||||
|
||||
/// Retrieves a list of [Player]s associated with the given [gameId].
|
||||
/// Returns null if no players are found.
|
||||
Future<List<Player>?> getPlayersOfGame({required String gameId}) async {
|
||||
final result = await (select(
|
||||
playerGameTable,
|
||||
)..where((p) => p.gameId.equals(gameId))).get();
|
||||
|
||||
if (result.isEmpty) return null;
|
||||
|
||||
final futures = result.map(
|
||||
(row) => db.playerDao.getPlayerById(playerId: row.playerId),
|
||||
);
|
||||
final players = await Future.wait(futures);
|
||||
return players;
|
||||
}
|
||||
|
||||
/// Checks if there are any players associated with the given [gameId].
|
||||
/// Returns `true` if there are players, otherwise `false`.
|
||||
Future<bool> gameHasPlayers({required String gameId}) async {
|
||||
final count =
|
||||
await (selectOnly(playerGameTable)
|
||||
..where(playerGameTable.gameId.equals(gameId))
|
||||
..addColumns([playerGameTable.playerId.count()]))
|
||||
.map((row) => row.read(playerGameTable.playerId.count()))
|
||||
.getSingle();
|
||||
return (count ?? 0) > 0;
|
||||
}
|
||||
|
||||
/// Checks if a specific player is associated with a specific game.
|
||||
/// Returns `true` if the player is in the game, otherwise `false`.
|
||||
Future<bool> isPlayerInGame({
|
||||
required String gameId,
|
||||
required String playerId,
|
||||
}) async {
|
||||
final count =
|
||||
await (selectOnly(playerGameTable)
|
||||
..where(playerGameTable.gameId.equals(gameId))
|
||||
..where(playerGameTable.playerId.equals(playerId))
|
||||
..addColumns([playerGameTable.playerId.count()]))
|
||||
.map((row) => row.read(playerGameTable.playerId.count()))
|
||||
.getSingle();
|
||||
return (count ?? 0) > 0;
|
||||
}
|
||||
|
||||
/// Removes the association of a player with a game by deleting the record
|
||||
/// from the [PlayerGameTable].
|
||||
/// Returns `true` if more than 0 rows were affected, otherwise `false`.
|
||||
Future<bool> removePlayerFromGame({
|
||||
required String gameId,
|
||||
required String playerId,
|
||||
}) async {
|
||||
final query = delete(playerGameTable)
|
||||
..where((pg) => pg.gameId.equals(gameId))
|
||||
..where((pg) => pg.playerId.equals(playerId));
|
||||
final rowsAffected = await query.go();
|
||||
return rowsAffected > 0;
|
||||
}
|
||||
|
||||
/// Updates the players associated with a game based on the provided
|
||||
/// [newPlayer] list. It adds new players and removes players that are no
|
||||
/// longer associated with the game.
|
||||
Future<void> updatePlayersFromGame({
|
||||
required String gameId,
|
||||
required List<Player> newPlayer,
|
||||
}) async {
|
||||
final currentPlayers = await getPlayersOfGame(gameId: gameId);
|
||||
// Create sets of player IDs for easy comparison
|
||||
final currentPlayerIds = currentPlayers?.map((p) => p.id).toSet() ?? {};
|
||||
final newPlayerIdsSet = newPlayer.map((p) => p.id).toSet();
|
||||
|
||||
// Determine players to add and remove
|
||||
final playersToAdd = newPlayerIdsSet.difference(currentPlayerIds);
|
||||
final playersToRemove = currentPlayerIds.difference(newPlayerIdsSet);
|
||||
|
||||
db.transaction(() async {
|
||||
// Remove old players
|
||||
if (playersToRemove.isNotEmpty) {
|
||||
await (delete(playerGameTable)..where(
|
||||
(pg) =>
|
||||
pg.gameId.equals(gameId) &
|
||||
pg.playerId.isIn(playersToRemove.toList()),
|
||||
))
|
||||
.go();
|
||||
}
|
||||
|
||||
// Add new players
|
||||
if (playersToAdd.isNotEmpty) {
|
||||
final inserts = playersToAdd
|
||||
.map(
|
||||
(id) =>
|
||||
PlayerGameTableCompanion.insert(playerId: id, gameId: gameId),
|
||||
)
|
||||
.toList();
|
||||
await Future.wait(
|
||||
inserts.map(
|
||||
(c) => into(
|
||||
playerGameTable,
|
||||
).insert(c, mode: InsertMode.insertOrReplace),
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
10
lib/data/dao/player_game_dao.g.dart
Normal file
@@ -0,0 +1,10 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'player_game_dao.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
mixin _$PlayerGameDaoMixin on DatabaseAccessor<AppDatabase> {
|
||||
$PlayerTableTable get playerTable => attachedDatabase.playerTable;
|
||||
$GameTableTable get gameTable => attachedDatabase.gameTable;
|
||||
$PlayerGameTableTable get playerGameTable => attachedDatabase.playerGameTable;
|
||||
}
|
||||
78
lib/data/dao/player_group_dao.dart
Normal file
@@ -0,0 +1,78 @@
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:game_tracker/data/db/database.dart';
|
||||
import 'package:game_tracker/data/db/tables/player_group_table.dart';
|
||||
import 'package:game_tracker/data/dto/player.dart';
|
||||
|
||||
part 'player_group_dao.g.dart';
|
||||
|
||||
@DriftAccessor(tables: [PlayerGroupTable])
|
||||
class PlayerGroupDao extends DatabaseAccessor<AppDatabase>
|
||||
with _$PlayerGroupDaoMixin {
|
||||
PlayerGroupDao(super.db);
|
||||
|
||||
/// No need for a groupHasPlayers method since the members attribute is
|
||||
/// not nullable
|
||||
|
||||
/// Adds a [player] to a group with the given [groupId].
|
||||
/// If the player is already in the group, no action is taken.
|
||||
/// If the player does not exist in the player table, they are added.
|
||||
/// Returns `true` if the player was added, otherwise `false`.
|
||||
Future<bool> addPlayerToGroup({
|
||||
required Player player,
|
||||
required String groupId,
|
||||
}) async {
|
||||
if (await isPlayerInGroup(playerId: player.id, groupId: groupId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!await db.playerDao.playerExists(playerId: player.id)) {
|
||||
db.playerDao.addPlayer(player: player);
|
||||
}
|
||||
|
||||
await into(playerGroupTable).insert(
|
||||
PlayerGroupTableCompanion.insert(playerId: player.id, groupId: groupId),
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Retrieves all players belonging to a specific group by [groupId].
|
||||
Future<List<Player>> getPlayersOfGroup({required String groupId}) async {
|
||||
final query = select(playerGroupTable)
|
||||
..where((pG) => pG.groupId.equals(groupId));
|
||||
final result = await query.get();
|
||||
|
||||
List<Player> groupMembers = List.empty(growable: true);
|
||||
|
||||
for (var entry in result) {
|
||||
final player = await db.playerDao.getPlayerById(playerId: entry.playerId);
|
||||
groupMembers.add(player);
|
||||
}
|
||||
|
||||
return groupMembers;
|
||||
}
|
||||
|
||||
/// Removes a player from a group based on [playerId] and [groupId].
|
||||
/// Returns `true` if more than 0 rows were affected, otherwise `false`.
|
||||
Future<bool> removePlayerFromGroup({
|
||||
required String playerId,
|
||||
required String groupId,
|
||||
}) async {
|
||||
final query = delete(playerGroupTable)
|
||||
..where((p) => p.playerId.equals(playerId) & p.groupId.equals(groupId));
|
||||
final rowsAffected = await query.go();
|
||||
return rowsAffected > 0;
|
||||
}
|
||||
|
||||
/// Checks if a player with [playerId] is in the group with [groupId].
|
||||
/// Returns `true` if the player is in the group, otherwise `false`.
|
||||
Future<bool> isPlayerInGroup({
|
||||
required String playerId,
|
||||
required String groupId,
|
||||
}) async {
|
||||
final query = select(playerGroupTable)
|
||||
..where((p) => p.playerId.equals(playerId) & p.groupId.equals(groupId));
|
||||
final result = await query.getSingleOrNull();
|
||||
return result != null;
|
||||
}
|
||||
}
|
||||
11
lib/data/dao/player_group_dao.g.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'player_group_dao.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
mixin _$PlayerGroupDaoMixin on DatabaseAccessor<AppDatabase> {
|
||||
$PlayerTableTable get playerTable => attachedDatabase.playerTable;
|
||||
$GroupTableTable get groupTable => attachedDatabase.groupTable;
|
||||
$PlayerGroupTableTable get playerGroupTable =>
|
||||
attachedDatabase.playerGroupTable;
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:drift_flutter/drift_flutter.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
part 'database.g.dart';
|
||||
|
||||
class User extends Table {
|
||||
TextColumn get id => text()();
|
||||
TextColumn get name => text()();
|
||||
|
||||
@override
|
||||
Set<Column<Object>> get primaryKey => {id};
|
||||
}
|
||||
|
||||
class Group extends Table {
|
||||
TextColumn get id => text()();
|
||||
TextColumn get name => text()();
|
||||
|
||||
@override
|
||||
Set<Column<Object>> get primaryKey => {id};
|
||||
}
|
||||
|
||||
class UserGroup extends Table {
|
||||
TextColumn get userId => text().references(User, #id)();
|
||||
TextColumn get groupId => text().references(Group, #id)();
|
||||
|
||||
@override
|
||||
Set<Column<Object>> get primaryKey => {userId, groupId};
|
||||
}
|
||||
|
||||
@DriftDatabase(tables: [User, Group, UserGroup])
|
||||
class AppDatabase extends _$AppDatabase {
|
||||
AppDatabase([QueryExecutor? executor]) : super(executor ?? _openConnection());
|
||||
|
||||
@override
|
||||
int get schemaVersion => 1;
|
||||
|
||||
static QueryExecutor _openConnection() {
|
||||
return driftDatabase(
|
||||
name: 'gametracker_db',
|
||||
native: const DriftNativeOptions(
|
||||
databaseDirectory: getApplicationSupportDirectory,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
60
lib/data/db/database.dart
Normal file
@@ -0,0 +1,60 @@
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:drift_flutter/drift_flutter.dart';
|
||||
import 'package:game_tracker/data/dao/game_dao.dart';
|
||||
import 'package:game_tracker/data/dao/group_dao.dart';
|
||||
import 'package:game_tracker/data/dao/group_game_dao.dart';
|
||||
import 'package:game_tracker/data/dao/player_dao.dart';
|
||||
import 'package:game_tracker/data/dao/player_game_dao.dart';
|
||||
import 'package:game_tracker/data/dao/player_group_dao.dart';
|
||||
import 'package:game_tracker/data/db/tables/game_table.dart';
|
||||
import 'package:game_tracker/data/db/tables/group_game_table.dart';
|
||||
import 'package:game_tracker/data/db/tables/group_table.dart';
|
||||
import 'package:game_tracker/data/db/tables/player_game_table.dart';
|
||||
import 'package:game_tracker/data/db/tables/player_group_table.dart';
|
||||
import 'package:game_tracker/data/db/tables/player_table.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
part 'database.g.dart';
|
||||
|
||||
@DriftDatabase(
|
||||
tables: [
|
||||
PlayerTable,
|
||||
GroupTable,
|
||||
GameTable,
|
||||
PlayerGroupTable,
|
||||
PlayerGameTable,
|
||||
GroupGameTable,
|
||||
],
|
||||
daos: [
|
||||
PlayerDao,
|
||||
GroupDao,
|
||||
GameDao,
|
||||
PlayerGroupDao,
|
||||
PlayerGameDao,
|
||||
GroupGameDao,
|
||||
],
|
||||
)
|
||||
class AppDatabase extends _$AppDatabase {
|
||||
AppDatabase([QueryExecutor? executor]) : super(executor ?? _openConnection());
|
||||
|
||||
@override
|
||||
int get schemaVersion => 1;
|
||||
|
||||
@override
|
||||
MigrationStrategy get migration {
|
||||
return MigrationStrategy(
|
||||
beforeOpen: (details) async {
|
||||
await customStatement('PRAGMA foreign_keys = ON');
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
static QueryExecutor _openConnection() {
|
||||
return driftDatabase(
|
||||
name: 'gametracker_db',
|
||||
native: const DriftNativeOptions(
|
||||
databaseDirectory: getApplicationSupportDirectory,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
3824
lib/data/db/database.g.dart
Normal file
11
lib/data/db/tables/game_table.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
import 'package:drift/drift.dart';
|
||||
|
||||
class GameTable extends Table {
|
||||
TextColumn get id => text()();
|
||||
TextColumn get name => text()();
|
||||
late final winnerId = text().nullable()();
|
||||
DateTimeColumn get createdAt => dateTime()();
|
||||
|
||||
@override
|
||||
Set<Column<Object>> get primaryKey => {id};
|
||||
}
|
||||
13
lib/data/db/tables/group_game_table.dart
Normal file
@@ -0,0 +1,13 @@
|
||||
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 GroupGameTable extends Table {
|
||||
TextColumn get groupId =>
|
||||
text().references(GroupTable, #id, onDelete: KeyAction.cascade)();
|
||||
TextColumn get gameId =>
|
||||
text().references(GameTable, #id, onDelete: KeyAction.cascade)();
|
||||
|
||||
@override
|
||||
Set<Column<Object>> get primaryKey => {groupId, gameId};
|
||||
}
|
||||
10
lib/data/db/tables/group_table.dart
Normal file
@@ -0,0 +1,10 @@
|
||||
import 'package:drift/drift.dart';
|
||||
|
||||
class GroupTable extends Table {
|
||||
TextColumn get id => text()();
|
||||
TextColumn get name => text()();
|
||||
DateTimeColumn get createdAt => dateTime()();
|
||||
|
||||
@override
|
||||
Set<Column<Object>> get primaryKey => {id};
|
||||
}
|
||||
13
lib/data/db/tables/player_game_table.dart
Normal file
@@ -0,0 +1,13 @@
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:game_tracker/data/db/tables/game_table.dart';
|
||||
import 'package:game_tracker/data/db/tables/player_table.dart';
|
||||
|
||||
class PlayerGameTable extends Table {
|
||||
TextColumn get playerId =>
|
||||
text().references(PlayerTable, #id, onDelete: KeyAction.cascade)();
|
||||
TextColumn get gameId =>
|
||||
text().references(GameTable, #id, onDelete: KeyAction.cascade)();
|
||||
|
||||
@override
|
||||
Set<Column<Object>> get primaryKey => {playerId, gameId};
|
||||
}
|
||||
13
lib/data/db/tables/player_group_table.dart
Normal file
@@ -0,0 +1,13 @@
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:game_tracker/data/db/tables/group_table.dart';
|
||||
import 'package:game_tracker/data/db/tables/player_table.dart';
|
||||
|
||||
class PlayerGroupTable extends Table {
|
||||
TextColumn get playerId =>
|
||||
text().references(PlayerTable, #id, onDelete: KeyAction.cascade)();
|
||||
TextColumn get groupId =>
|
||||
text().references(GroupTable, #id, onDelete: KeyAction.cascade)();
|
||||
|
||||
@override
|
||||
Set<Column<Object>> get primaryKey => {playerId, groupId};
|
||||
}
|
||||
10
lib/data/db/tables/player_table.dart
Normal file
@@ -0,0 +1,10 @@
|
||||
import 'package:drift/drift.dart';
|
||||
|
||||
class PlayerTable extends Table {
|
||||
TextColumn get id => text()();
|
||||
TextColumn get name => text()();
|
||||
DateTimeColumn get createdAt => dateTime()();
|
||||
|
||||
@override
|
||||
Set<Column<Object>> get primaryKey => {id};
|
||||
}
|
||||
51
lib/data/dto/game.dart
Normal file
@@ -0,0 +1,51 @@
|
||||
import 'package:clock/clock.dart';
|
||||
import 'package:game_tracker/data/dto/group.dart';
|
||||
import 'package:game_tracker/data/dto/player.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
class Game {
|
||||
final String id;
|
||||
final DateTime createdAt;
|
||||
final String name;
|
||||
final List<Player>? players;
|
||||
final Group? group;
|
||||
final Player? winner;
|
||||
|
||||
Game({
|
||||
String? id,
|
||||
DateTime? createdAt,
|
||||
required this.name,
|
||||
this.players,
|
||||
this.group,
|
||||
this.winner,
|
||||
}) : id = id ?? const Uuid().v4(),
|
||||
createdAt = createdAt ?? clock.now();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Game{\n\tid: $id,\n\tname: $name,\n\tplayers: $players,\n\tgroup: $group,\n\twinner: $winner\n}';
|
||||
}
|
||||
|
||||
/// Creates a Game instance from a JSON object.
|
||||
Game.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
name = json['name'],
|
||||
createdAt = DateTime.parse(json['createdAt']),
|
||||
players = json['players'] != null
|
||||
? (json['players'] as List)
|
||||
.map((playerJson) => Player.fromJson(playerJson))
|
||||
.toList()
|
||||
: null,
|
||||
group = json['group'] != null ? Group.fromJson(json['group']) : null,
|
||||
winner = json['winner'] != null ? Player.fromJson(json['winner']) : null;
|
||||
|
||||
/// Converts the Game instance to a JSON object.
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'createdAt': createdAt.toIso8601String(),
|
||||
'name': name,
|
||||
'players': players?.map((player) => player.toJson()).toList(),
|
||||
'group': group?.toJson(),
|
||||
'winner': winner?.toJson(),
|
||||
};
|
||||
}
|
||||
40
lib/data/dto/group.dart
Normal file
@@ -0,0 +1,40 @@
|
||||
import 'package:clock/clock.dart';
|
||||
import 'package:game_tracker/data/dto/player.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
class Group {
|
||||
final String id;
|
||||
final DateTime createdAt;
|
||||
final String name;
|
||||
final List<Player> members;
|
||||
|
||||
Group({
|
||||
String? id,
|
||||
DateTime? createdAt,
|
||||
required this.name,
|
||||
required this.members,
|
||||
}) : id = id ?? const Uuid().v4(),
|
||||
createdAt = createdAt ?? clock.now();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Group{id: $id, name: $name,members: $members}';
|
||||
}
|
||||
|
||||
/// Creates a Group instance from a JSON object.
|
||||
Group.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
createdAt = DateTime.parse(json['createdAt']),
|
||||
name = json['name'],
|
||||
members = (json['members'] as List)
|
||||
.map((memberJson) => Player.fromJson(memberJson))
|
||||
.toList();
|
||||
|
||||
/// Converts the Group instance to a JSON object.
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'createdAt': createdAt.toIso8601String(),
|
||||
'name': name,
|
||||
'members': members.map((member) => member.toJson()).toList(),
|
||||
};
|
||||
}
|
||||
30
lib/data/dto/player.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
import 'package:clock/clock.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
class Player {
|
||||
final String id;
|
||||
final DateTime createdAt;
|
||||
final String name;
|
||||
|
||||
Player({String? id, DateTime? createdAt, required this.name})
|
||||
: id = id ?? const Uuid().v4(),
|
||||
createdAt = createdAt ?? clock.now();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Player{id: $id,name: $name}';
|
||||
}
|
||||
|
||||
/// Creates a Player instance from a JSON object.
|
||||
Player.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
createdAt = DateTime.parse(json['createdAt']),
|
||||
name = json['name'];
|
||||
|
||||
/// Converts the Player instance to a JSON object.
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'createdAt': createdAt.toIso8601String(),
|
||||
'name': name,
|
||||
};
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
import 'package:game_tracker/data/database.dart';
|
||||
import 'package:drift/drift.dart';
|
||||
|
||||
extension GroupMethods on AppDatabase {
|
||||
Future<List<GroupData>> getAllGroups() async {
|
||||
return await select(group).get();
|
||||
}
|
||||
|
||||
Future<GroupData> getGroupById(String id) async {
|
||||
return await (select(group)..where((g) => g.id.equals(id))).getSingle();
|
||||
}
|
||||
|
||||
Future<void> addGroup(String id, String name) async {
|
||||
await into(group).insert(
|
||||
GroupCompanion.insert(id: id, name: name),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> deleteGroup(String id) async {
|
||||
await (delete(group)..where((g) => g.id.equals(id))).go();
|
||||
}
|
||||
|
||||
Future<void> updateGroupname(String id, String newName) async {
|
||||
await (update(group)..where((g) => g.id.equals(id))).write(
|
||||
GroupCompanion(name: Value(newName)),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
import 'package:game_tracker/data/database.dart';
|
||||
import 'package:drift/drift.dart';
|
||||
|
||||
extension UserMethods on AppDatabase {
|
||||
Future<List<UserData>> getAllUsers() async {
|
||||
return await select(user).get();
|
||||
}
|
||||
|
||||
Future<UserData> getUserById(String id) async {
|
||||
return await (select(user)..where((u) => u.id.equals(id))).getSingle();
|
||||
}
|
||||
|
||||
Future<void> addUser(String id, String name) async {
|
||||
await into(user).insert(
|
||||
UserCompanion.insert(id: id, name: name),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> deleteUser(String id) async {
|
||||
await (delete(user)..where((u) => u.id.equals(id))).go();
|
||||
}
|
||||
|
||||
Future<void> updateUsername(String id, String newName) async {
|
||||
await (update(user)..where((u) => u.id.equals(id))).write(
|
||||
UserCompanion(name: Value(newName)),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
import 'package:game_tracker/data/database.dart';
|
||||
import 'package:drift/drift.dart';
|
||||
|
||||
extension UserGroupMethods on AppDatabase {
|
||||
Future<List<UserGroupData>> getAllUsersAndGroups() async {
|
||||
return await select(userGroup).get();
|
||||
}
|
||||
|
||||
Future<List<UserGroupData>> getUsersGroups(String userId) async {
|
||||
return await (select(userGroup)..where((uG) => uG.userId.equals(userId))).get();
|
||||
}
|
||||
|
||||
Future<List<UserGroupData>> getGroupsUsers(String groupId) async {
|
||||
return await (select(userGroup)..where((uG) => uG.groupId.equals(groupId))).get();
|
||||
}
|
||||
|
||||
Future<void> addUserToGroup(String userId, String groupId) async {
|
||||
await into(userGroup).insert(
|
||||
UserGroupCompanion.insert(userId: userId, groupId: groupId),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> removeUserFromGroup(String userId, String groupId) async {
|
||||
await (delete(userGroup)..where((uG) => uG.userId.equals(userId) & uG.groupId.equals(groupId))).go();
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,21 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:game_tracker/presentation/views/main_menu/custom_navigation_bar.dart';
|
||||
import 'package:game_tracker/core/custom_theme.dart';
|
||||
import 'package:game_tracker/data/database.dart';
|
||||
import 'package:game_tracker/data/db/database.dart';
|
||||
import 'package:game_tracker/presentation/views/main_menu/custom_navigation_bar.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
void main() {
|
||||
runApp(
|
||||
Provider<AppDatabase>(
|
||||
create: (context) => AppDatabase(),
|
||||
child: const MyApp(),
|
||||
child: const GameTracker(),
|
||||
dispose: (context, db) => db.close(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
class GameTracker extends StatelessWidget {
|
||||
const GameTracker({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:game_tracker/core/custom_theme.dart';
|
||||
import 'package:game_tracker/data/dto/group.dart';
|
||||
import 'package:game_tracker/presentation/widgets/tiles/group_tile.dart';
|
||||
|
||||
class ChooseGroupView extends StatefulWidget {
|
||||
final List<Group> groups;
|
||||
final int initialGroupIndex;
|
||||
|
||||
const ChooseGroupView({
|
||||
super.key,
|
||||
required this.groups,
|
||||
required this.initialGroupIndex,
|
||||
});
|
||||
|
||||
@override
|
||||
State<ChooseGroupView> createState() => _ChooseGroupViewState();
|
||||
}
|
||||
|
||||
class _ChooseGroupViewState extends State<ChooseGroupView> {
|
||||
late int selectedGroupIndex;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
selectedGroupIndex = widget.initialGroupIndex;
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: CustomTheme.backgroundColor,
|
||||
appBar: AppBar(
|
||||
backgroundColor: CustomTheme.backgroundColor,
|
||||
scrolledUnderElevation: 0,
|
||||
title: const Text(
|
||||
'Choose Group',
|
||||
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||
),
|
||||
centerTitle: true,
|
||||
),
|
||||
body: ListView.builder(
|
||||
padding: const EdgeInsets.only(bottom: 85),
|
||||
itemCount: widget.groups.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
selectedGroupIndex = index;
|
||||
});
|
||||
|
||||
Future.delayed(const Duration(milliseconds: 500), () {
|
||||
if (!context.mounted) return;
|
||||
Navigator.of(context).pop(widget.groups[index]);
|
||||
});
|
||||
},
|
||||
child: GroupTile(
|
||||
group: widget.groups[index],
|
||||
isHighlighted: selectedGroupIndex == index,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:game_tracker/core/custom_theme.dart';
|
||||
import 'package:game_tracker/core/enums.dart';
|
||||
import 'package:game_tracker/presentation/widgets/tiles/ruleset_list_tile.dart';
|
||||
|
||||
class ChooseRulesetView extends StatefulWidget {
|
||||
final List<(Ruleset, String, String)> rulesets;
|
||||
final int initialRulesetIndex;
|
||||
const ChooseRulesetView({
|
||||
super.key,
|
||||
required this.rulesets,
|
||||
required this.initialRulesetIndex,
|
||||
});
|
||||
|
||||
@override
|
||||
State<ChooseRulesetView> createState() => _ChooseRulesetViewState();
|
||||
}
|
||||
|
||||
class _ChooseRulesetViewState extends State<ChooseRulesetView> {
|
||||
late int selectedRulesetIndex;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
selectedRulesetIndex = widget.initialRulesetIndex;
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DefaultTabController(
|
||||
length: 2,
|
||||
initialIndex: 0,
|
||||
child: Scaffold(
|
||||
backgroundColor: CustomTheme.backgroundColor,
|
||||
appBar: AppBar(
|
||||
backgroundColor: CustomTheme.backgroundColor,
|
||||
scrolledUnderElevation: 0,
|
||||
title: const Text(
|
||||
'Choose Ruleset',
|
||||
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||
),
|
||||
centerTitle: true,
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Container(
|
||||
color: CustomTheme.backgroundColor,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
child: TabBar(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 5),
|
||||
// Label Settings
|
||||
labelStyle: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
labelColor: Colors.white,
|
||||
unselectedLabelStyle: const TextStyle(fontSize: 14),
|
||||
unselectedLabelColor: Colors.white70,
|
||||
// Indicator Settings
|
||||
indicator: CustomTheme.standardBoxDecoration,
|
||||
indicatorSize: TabBarIndicatorSize.tab,
|
||||
indicatorWeight: 1,
|
||||
indicatorPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 20,
|
||||
vertical: 0,
|
||||
),
|
||||
// Divider Settings
|
||||
dividerHeight: 0,
|
||||
tabs: const [
|
||||
Tab(text: 'Rulesets'),
|
||||
Tab(text: 'Gametypes'),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Divider(
|
||||
indent: 30,
|
||||
endIndent: 30,
|
||||
thickness: 3,
|
||||
radius: BorderRadius.all(Radius.circular(12)),
|
||||
),
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
children: [
|
||||
ListView.builder(
|
||||
padding: const EdgeInsets.only(bottom: 85),
|
||||
itemCount: widget.rulesets.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return RulesetListTile(
|
||||
onPressed: () async {
|
||||
setState(() {
|
||||
selectedRulesetIndex = index;
|
||||
});
|
||||
Future.delayed(const Duration(milliseconds: 500), () {
|
||||
if (!context.mounted) return;
|
||||
Navigator.of(
|
||||
context,
|
||||
).pop(widget.rulesets[index].$1);
|
||||
});
|
||||
},
|
||||
title: widget.rulesets[index].$2,
|
||||
description: widget.rulesets[index].$3,
|
||||
isHighlighted: selectedRulesetIndex == index,
|
||||
);
|
||||
},
|
||||
),
|
||||
const Center(
|
||||
child: Text(
|
||||
'No gametypes available',
|
||||
style: TextStyle(color: Colors.white70),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,232 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:game_tracker/core/custom_theme.dart';
|
||||
import 'package:game_tracker/core/enums.dart';
|
||||
import 'package:game_tracker/data/db/database.dart';
|
||||
import 'package:game_tracker/data/dto/game.dart';
|
||||
import 'package:game_tracker/data/dto/group.dart';
|
||||
import 'package:game_tracker/data/dto/player.dart';
|
||||
import 'package:game_tracker/presentation/views/main_menu/create_game/choose_group_view.dart';
|
||||
import 'package:game_tracker/presentation/views/main_menu/create_game/choose_ruleset_view.dart';
|
||||
import 'package:game_tracker/presentation/widgets/buttons/custom_width_button.dart';
|
||||
import 'package:game_tracker/presentation/widgets/player_selection.dart';
|
||||
import 'package:game_tracker/presentation/widgets/text_input/text_input_field.dart';
|
||||
import 'package:game_tracker/presentation/widgets/tiles/choose_tile.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class CreateGameView extends StatefulWidget {
|
||||
const CreateGameView({super.key});
|
||||
|
||||
@override
|
||||
State<CreateGameView> createState() => _CreateGameViewState();
|
||||
}
|
||||
|
||||
class _CreateGameViewState extends State<CreateGameView> {
|
||||
/// Reference to the app database
|
||||
late final AppDatabase db;
|
||||
|
||||
/// Futures to load all groups and players from the database
|
||||
late Future<List<Group>> _allGroupsFuture;
|
||||
|
||||
/// Future to load all players from the database
|
||||
late Future<List<Player>> _allPlayersFuture;
|
||||
|
||||
/// Controller for the game name input field
|
||||
final TextEditingController _gameNameController = TextEditingController();
|
||||
|
||||
/// List of all groups from the database
|
||||
List<Group> groupsList = [];
|
||||
|
||||
/// List of all players from the database
|
||||
List<Player> playerList = [];
|
||||
|
||||
/// The currently selected group
|
||||
Group? selectedGroup;
|
||||
|
||||
/// The index of the currently selected group in [groupsList] to mark it in
|
||||
/// the [ChooseGroupView]
|
||||
int selectedGroupIndex = -1;
|
||||
|
||||
/// The currently selected ruleset
|
||||
Ruleset? selectedRuleset;
|
||||
|
||||
/// The index of the currently selected ruleset in [rulesets] to mark it in
|
||||
/// the [ChooseRulesetView]
|
||||
int selectedRulesetIndex = -1;
|
||||
|
||||
/// The currently selected players
|
||||
List<Player>? selectedPlayers;
|
||||
|
||||
/// List of available rulesets with their display names and descriptions
|
||||
/// as tuples of (Ruleset, String, String)
|
||||
List<(Ruleset, String, String)> rulesets = [
|
||||
(
|
||||
Ruleset.singleWinner,
|
||||
'Single Winner',
|
||||
'Exactly one winner is chosen; ties are resolved by a predefined tiebreaker.',
|
||||
),
|
||||
(
|
||||
Ruleset.singleLoser,
|
||||
'Single Loser',
|
||||
'Exactly one loser is determined; last place receives the penalty or consequence.',
|
||||
),
|
||||
(
|
||||
Ruleset.mostPoints,
|
||||
'Most Points',
|
||||
'Traditional ruleset: the player with the most points wins.',
|
||||
),
|
||||
(
|
||||
Ruleset.lastPoints,
|
||||
'Least Points',
|
||||
'Inverse scoring: the player with the fewest points wins.',
|
||||
),
|
||||
];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
db = Provider.of<AppDatabase>(context, listen: false);
|
||||
|
||||
_allGroupsFuture = db.groupDao.getAllGroups();
|
||||
_allPlayersFuture = db.playerDao.getAllPlayers();
|
||||
|
||||
Future.wait([_allGroupsFuture, _allPlayersFuture]).then((result) async {
|
||||
groupsList = result[0] as List<Group>;
|
||||
playerList = result[1] as List<Player>;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: CustomTheme.backgroundColor,
|
||||
appBar: AppBar(
|
||||
backgroundColor: CustomTheme.backgroundColor,
|
||||
scrolledUnderElevation: 0,
|
||||
title: const Text(
|
||||
'Create new game',
|
||||
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||
),
|
||||
centerTitle: true,
|
||||
),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
|
||||
child: TextInputField(
|
||||
controller: _gameNameController,
|
||||
hintText: 'Game name',
|
||||
onChanged: (value) {
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
),
|
||||
ChooseTile(
|
||||
title: 'Ruleset',
|
||||
trailingText: selectedRuleset == null
|
||||
? 'None'
|
||||
: translateRulesetToString(selectedRuleset!),
|
||||
onPressed: () async {
|
||||
selectedRuleset = await Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ChooseRulesetView(
|
||||
rulesets: rulesets,
|
||||
initialRulesetIndex: selectedRulesetIndex,
|
||||
),
|
||||
),
|
||||
);
|
||||
selectedRulesetIndex = rulesets.indexWhere(
|
||||
(r) => r.$1 == selectedRuleset,
|
||||
);
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
ChooseTile(
|
||||
title: 'Group',
|
||||
trailingText: selectedGroup == null
|
||||
? 'None'
|
||||
: selectedGroup!.name,
|
||||
onPressed: () async {
|
||||
selectedGroup = await Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ChooseGroupView(
|
||||
groups: groupsList,
|
||||
initialGroupIndex: selectedGroupIndex,
|
||||
),
|
||||
),
|
||||
);
|
||||
selectedGroupIndex = groupsList.indexWhere(
|
||||
(g) => g.id == selectedGroup?.id,
|
||||
);
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
child: PlayerSelection(
|
||||
key: ValueKey(selectedGroup?.id ?? 'no_group'),
|
||||
initialPlayers: selectedGroup == null
|
||||
? playerList
|
||||
: playerList
|
||||
.where(
|
||||
(p) => !selectedGroup!.members.any(
|
||||
(m) => m.id == p.id,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
selectedPlayers = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
CustomWidthButton(
|
||||
text: 'Create game',
|
||||
sizeRelativeToWidth: 0.95,
|
||||
buttonType: ButtonType.primary,
|
||||
onPressed: _enableCreateGameButton()
|
||||
? () async {
|
||||
Game game = Game(
|
||||
name: _gameNameController.text.trim(),
|
||||
createdAt: DateTime.now(),
|
||||
group: selectedGroup!,
|
||||
players: selectedPlayers,
|
||||
);
|
||||
// TODO: Replace with navigation to GameResultView()
|
||||
print('Created game: $game');
|
||||
Navigator.pop(context);
|
||||
}
|
||||
: null,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Translates a [Ruleset] enum value to its corresponding string representation.
|
||||
String translateRulesetToString(Ruleset ruleset) {
|
||||
switch (ruleset) {
|
||||
case Ruleset.singleWinner:
|
||||
return 'Single Winner';
|
||||
case Ruleset.singleLoser:
|
||||
return 'Single Loser';
|
||||
case Ruleset.mostPoints:
|
||||
return 'Most Points';
|
||||
case Ruleset.lastPoints:
|
||||
return 'Least Points';
|
||||
}
|
||||
}
|
||||
|
||||
/// Determines whether the "Create Game" button should be enabled based on
|
||||
/// the current state of the input fields.
|
||||
bool _enableCreateGameButton() {
|
||||
return _gameNameController.text.isNotEmpty &&
|
||||
(selectedGroup != null ||
|
||||
(selectedPlayers != null && selectedPlayers!.isNotEmpty)) &&
|
||||
selectedRuleset != null;
|
||||
}
|
||||
}
|
||||