80 line length correction
This commit is contained in:
@@ -52,8 +52,8 @@ class _ActiveGameViewState extends State<ActiveGameView> {
|
||||
trailing: Row(
|
||||
children: [
|
||||
SizedBox(width: 5),
|
||||
Text(
|
||||
'${widget.gameSession.playerScores[playerIndex][0]} Punkte')
|
||||
Text('${widget.gameSession.playerScores[playerIndex][0]} '
|
||||
'Punkte')
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -102,7 +102,8 @@ class _ActiveGameViewState extends State<ActiveGameView> {
|
||||
// Erstelle eine Liste von Indizes der Spieler
|
||||
List<int> playerIndices =
|
||||
List<int>.generate(widget.gameSession.players.length, (index) => index);
|
||||
// Sortiere die Indizes basierend auf den summierten Punkten (playerScores[i][0])
|
||||
// Sortiere die Indizes basierend auf den summierten Punkten
|
||||
// (playerScores[i][0])
|
||||
playerIndices.sort((a, b) {
|
||||
int scoreA = widget.gameSession.playerScores[a][0];
|
||||
int scoreB = widget.gameSession.playerScores[b][0];
|
||||
|
||||
@@ -131,7 +131,8 @@ class _CreateGameState extends State<CreateGame> {
|
||||
builder: (context) => CupertinoAlertDialog(
|
||||
title: Text('Maximale Spielerzahl erreicht'),
|
||||
content: Text(
|
||||
'Es können maximal 5 Spieler hinzugefügt werden.'),
|
||||
'Es können maximal 5 Spieler hinzugefügt '
|
||||
'werden.'),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text('OK'),
|
||||
@@ -198,8 +199,9 @@ class _CreateGameState extends State<CreateGame> {
|
||||
context: context,
|
||||
builder: (context) => CupertinoAlertDialog(
|
||||
title: Text('Fehler'),
|
||||
content: Text(
|
||||
'Es muss ein Titel für das Spiel eingegeben werden.'),
|
||||
content:
|
||||
Text('Es muss ein Titel für das Spiel eingegeben '
|
||||
'werden.'),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text('OK'),
|
||||
@@ -232,8 +234,9 @@ class _CreateGameState extends State<CreateGame> {
|
||||
context: context,
|
||||
builder: (context) => CupertinoAlertDialog(
|
||||
title: Text('Fehler'),
|
||||
content: Text(
|
||||
'Es müssen mindestens 2 Spieler hinzugefügt werden.'),
|
||||
content:
|
||||
Text('Es müssen mindestens 2 Spieler hinzugefügt '
|
||||
'werden.'),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text('OK'),
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class InformationView extends StatelessWidget {
|
||||
const InformationView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CupertinoPageScaffold(
|
||||
|
||||
@@ -17,7 +17,8 @@ class ModeSelectionMenu extends StatelessWidget {
|
||||
child: CupertinoListTile(
|
||||
title: Text('101 Punkte', style: Styles.modeTitle),
|
||||
subtitle: const Text(
|
||||
'Es wird solange gespielt, bis einer Spieler die 101 Punkte genau erreicht oder überschreitet.',
|
||||
'Es wird solange gespielt, bis einer Spieler die 101 Punkte '
|
||||
'genau erreicht oder überschreitet.',
|
||||
style: Styles.modeDescription,
|
||||
maxLines: 3,
|
||||
),
|
||||
@@ -31,7 +32,8 @@ class ModeSelectionMenu extends StatelessWidget {
|
||||
child: CupertinoListTile(
|
||||
title: Text('Unbegrenzt', style: Styles.modeTitle),
|
||||
subtitle: const Text(
|
||||
'Dem Spiel sind keine Grenzen gesetzt. Es wird so lange gespielt, bis die Spieler keine Lust mehr haben.',
|
||||
'Dem Spiel sind keine Grenzen gesetzt. Es wird so lange '
|
||||
'gespielt, bis die Spieler keine Lust mehr haben.',
|
||||
style: Styles.modeDescription,
|
||||
maxLines: 3,
|
||||
),
|
||||
|
||||
@@ -21,7 +21,8 @@ class _RoundViewState extends State<RoundView> {
|
||||
/// Index of the player who said CABO.
|
||||
int _caboPlayerIndex = 0;
|
||||
|
||||
/// List of booleans that represent whether the kamikaze checkbox is checked for a player on that index.
|
||||
/// List of booleans that represent whether the kamikaze checkbox is checked
|
||||
/// for a player on that index.
|
||||
late final List<bool> _isKamikazeChecked =
|
||||
List.filled(widget.gameSession.players.length, false);
|
||||
|
||||
@@ -139,7 +140,8 @@ class _RoundViewState extends State<RoundView> {
|
||||
],
|
||||
),
|
||||
subtitle: Text(
|
||||
'${widget.gameSession.playerScores[index][0]} Punkte',
|
||||
'${widget.gameSession.playerScores[index][0]}'
|
||||
' Punkte',
|
||||
),
|
||||
trailing: Row(
|
||||
children: [
|
||||
@@ -192,7 +194,7 @@ class _RoundViewState extends State<RoundView> {
|
||||
],
|
||||
)),
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
bottom: MediaQuery.of(context).viewInsets.bottom,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
@@ -255,23 +257,23 @@ class _RoundViewState extends State<RoundView> {
|
||||
print('Spieler: ${gameSession.players}');
|
||||
print('Punkte: $roundScores');
|
||||
print('${gameSession.players[_caboPlayerIndex]} hat CABO gesagt');
|
||||
print(
|
||||
'${gameSession.players[_caboPlayerIndex]} hat ${roundScores[_caboPlayerIndex]} Punkte');
|
||||
print('${gameSession.players[_caboPlayerIndex]} hat '
|
||||
'${roundScores[_caboPlayerIndex]} Punkte');
|
||||
|
||||
/// List of the index of the player(s) with the lowest score
|
||||
List<int> lowestScoreIndex = _getLowestScoreIndex(roundScores);
|
||||
// Spieler der CABO gesagt hat, hat am wenigsten Punkte
|
||||
if (lowestScoreIndex.contains(_caboPlayerIndex)) {
|
||||
print(
|
||||
'${widget.gameSession.players[_caboPlayerIndex]} hat CABO gesagt und bekommt 0 Punkte');
|
||||
print('${widget.gameSession.players[_caboPlayerIndex]} hat CABO gesagt '
|
||||
'und bekommt 0 Punkte');
|
||||
print('Alle anderen Spieler bekommen ihre Punkte');
|
||||
|
||||
///
|
||||
_assignPoints([_caboPlayerIndex], -1, roundScores);
|
||||
} else {
|
||||
// Ein anderer Spieler hat weniger Punkte
|
||||
print(
|
||||
'${widget.gameSession.players[_caboPlayerIndex]} hat CABO gesagt, jedoch nicht die wenigsten Punkte.');
|
||||
print('${widget.gameSession.players[_caboPlayerIndex]} hat CABO gesagt, '
|
||||
'jedoch nicht die wenigsten Punkte.');
|
||||
|
||||
print('Folgende:r Spieler haben die wenigsten Punkte:');
|
||||
for (int i in lowestScoreIndex) {
|
||||
@@ -284,7 +286,8 @@ class _RoundViewState extends State<RoundView> {
|
||||
/// Assigns points to the players based on the scores of the current round.
|
||||
/// [winnerIndex] is the index of the player(s) who receive 0 points
|
||||
/// [loserIndex] is the index of the player who receives 5 extra points
|
||||
/// [roundScores] is the raw list of the scores of all players in the current round.
|
||||
/// [roundScores] is the raw list of the scores of all players in the
|
||||
/// current round.
|
||||
void _assignPoints(
|
||||
List<int> winnnerIndex, int loserIndex, List<int> roundScores) {
|
||||
print('Punkte der Spieler');
|
||||
@@ -312,17 +315,17 @@ class _RoundViewState extends State<RoundView> {
|
||||
List<int> _getLowestScoreIndex(List<int> roundScores) {
|
||||
int lowestScore = roundScores[0];
|
||||
List<int> lowestScoreIndex = [0];
|
||||
print(
|
||||
'Niedrigster Score: ${gameSession.players[lowestScoreIndex[0]]} ($lowestScore Punkte)');
|
||||
print('Niedrigster Score: ${gameSession.players[lowestScoreIndex[0]]} '
|
||||
'($lowestScore Punkte)');
|
||||
for (int i = 1; i < roundScores.length; i++) {
|
||||
if (roundScores[i] < lowestScore) {
|
||||
print(
|
||||
'Neuer niedrigster Score: ${gameSession.players[i]} (${roundScores[i]} Punkte)');
|
||||
print('Neuer niedrigster Score: ${gameSession.players[i]} '
|
||||
'(${roundScores[i]} Punkte)');
|
||||
lowestScore = roundScores[i];
|
||||
lowestScoreIndex = [i];
|
||||
} else if (roundScores[i] == lowestScore) {
|
||||
print(
|
||||
'${gameSession.players[i]} hat ebenfalls am wenigsten Punkte (${roundScores[i]} Punkte)');
|
||||
print('${gameSession.players[i]} hat ebenfalls am wenigsten Punkte '
|
||||
'(${roundScores[i]} Punkte)');
|
||||
lowestScoreIndex.add(i);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user