From ff4ec3552cb97e6ec4995170cdcf9b94e739b177 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Mon, 3 Mar 2025 01:02:27 +0100 Subject: [PATCH] 80 line length correction --- lib/views/active_game_view.dart | 7 +++--- lib/views/create_game_view.dart | 13 ++++++----- lib/views/information_view.dart | 2 ++ lib/views/mode_selection_view.dart | 6 +++-- lib/views/round_view.dart | 35 ++++++++++++++++-------------- 5 files changed, 37 insertions(+), 26 deletions(-) diff --git a/lib/views/active_game_view.dart b/lib/views/active_game_view.dart index d2e8986..3f85fc6 100644 --- a/lib/views/active_game_view.dart +++ b/lib/views/active_game_view.dart @@ -52,8 +52,8 @@ class _ActiveGameViewState extends State { 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 { // Erstelle eine Liste von Indizes der Spieler List playerIndices = List.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]; diff --git a/lib/views/create_game_view.dart b/lib/views/create_game_view.dart index da075ff..7090d40 100644 --- a/lib/views/create_game_view.dart +++ b/lib/views/create_game_view.dart @@ -131,7 +131,8 @@ class _CreateGameState extends State { 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 { 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 { 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'), diff --git a/lib/views/information_view.dart b/lib/views/information_view.dart index 58f11e6..ea07b19 100644 --- a/lib/views/information_view.dart +++ b/lib/views/information_view.dart @@ -1,6 +1,8 @@ import 'package:flutter/cupertino.dart'; class InformationView extends StatelessWidget { + const InformationView({super.key}); + @override Widget build(BuildContext context) { return CupertinoPageScaffold( diff --git a/lib/views/mode_selection_view.dart b/lib/views/mode_selection_view.dart index 9fbd9b7..aa3c501 100644 --- a/lib/views/mode_selection_view.dart +++ b/lib/views/mode_selection_view.dart @@ -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, ), diff --git a/lib/views/round_view.dart b/lib/views/round_view.dart index 9dba717..97a8aa9 100644 --- a/lib/views/round_view.dart +++ b/lib/views/round_view.dart @@ -21,7 +21,8 @@ class _RoundViewState extends State { /// 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 _isKamikazeChecked = List.filled(widget.gameSession.players.length, false); @@ -139,7 +140,8 @@ class _RoundViewState extends State { ], ), 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 { ], )), Positioned( - bottom: 0, + bottom: MediaQuery.of(context).viewInsets.bottom, left: 0, right: 0, child: Container( @@ -255,23 +257,23 @@ class _RoundViewState extends State { 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 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 { /// 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 winnnerIndex, int loserIndex, List roundScores) { print('Punkte der Spieler'); @@ -312,17 +315,17 @@ class _RoundViewState extends State { List _getLowestScoreIndex(List roundScores) { int lowestScore = roundScores[0]; List 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); } }