Removed unnecessary declared attributes

This commit is contained in:
2026-04-21 20:24:10 +02:00
parent 0bad0862a7
commit 2035e5b7d4
11 changed files with 46 additions and 58 deletions

View File

@@ -148,7 +148,7 @@ class _CreateGroupViewState extends State<CreateGroupView> {
final groupName = _groupNameController.text.trim();
final success = await db.groupDao.addGroup(
group: Group(name: groupName, description: '', members: selectedPlayers),
group: Group(name: groupName, members: selectedPlayers),
);
return success;

View File

@@ -36,7 +36,7 @@ class _GroupViewState extends State<GroupView> {
Group(
name: 'Skeleton Group',
description: '',
members: List.filled(6, Player(name: 'Skeleton Player', description: '')),
members: List.filled(6, Player(name: 'Skeleton Player')),
),
);

View File

@@ -167,8 +167,7 @@ class _StatisticsViewState extends State<StatisticsView> {
final playerId = winCounts[i].$1;
final player = players.firstWhere(
(p) => p.id == playerId,
orElse: () =>
Player(id: playerId, name: loc.not_available, description: ''),
orElse: () => Player(id: playerId, name: loc.not_available),
);
winCounts[i] = (player.name, winCounts[i].$2);
}
@@ -230,8 +229,7 @@ class _StatisticsViewState extends State<StatisticsView> {
final playerId = matchCounts[i].$1;
final player = players.firstWhere(
(p) => p.id == playerId,
orElse: () =>
Player(id: playerId, name: loc.not_available, description: ''),
orElse: () => Player(id: playerId, name: loc.not_available),
);
matchCounts[i] = (player.name, matchCounts[i].$2);
}

View File

@@ -62,7 +62,7 @@ class _PlayerSelectionState extends State<PlayerSelection> {
/// Skeleton data used while loading players.
late final List<Player> skeletonData = List.filled(
7,
Player(name: 'Player 0', description: ''),
Player(name: 'Player 0'),
);
@override
@@ -282,7 +282,7 @@ class _PlayerSelectionState extends State<PlayerSelection> {
final loc = AppLocalizations.of(context);
final playerName = _searchBarController.text.trim();
final createdPlayer = Player(name: playerName, description: '');
final createdPlayer = Player(name: playerName);
final success = await db.playerDao.addPlayer(player: createdPlayer);
if (!context.mounted) return;

View File

@@ -29,10 +29,10 @@ void main() {
);
withClock(fakeClock, () {
testPlayer1 = Player(name: 'Alice', description: '');
testPlayer2 = Player(name: 'Bob', description: '');
testPlayer3 = Player(name: 'Charlie', description: '');
testPlayer4 = Player(name: 'Diana', description: '');
testPlayer1 = Player(name: 'Alice');
testPlayer2 = Player(name: 'Bob');
testPlayer3 = Player(name: 'Charlie');
testPlayer4 = Player(name: 'Diana');
testGroup1 = Group(
name: 'Test Group',
description: '',

View File

@@ -36,11 +36,11 @@ void main() {
);
withClock(fakeClock, () {
testPlayer1 = Player(name: 'Alice', description: '');
testPlayer2 = Player(name: 'Bob', description: '');
testPlayer3 = Player(name: 'Charlie', description: '');
testPlayer4 = Player(name: 'Diana', description: '');
testPlayer5 = Player(name: 'Eve', description: '');
testPlayer1 = Player(name: 'Alice');
testPlayer2 = Player(name: 'Bob');
testPlayer3 = Player(name: 'Charlie');
testPlayer4 = Player(name: 'Diana');
testPlayer5 = Player(name: 'Eve');
testGroup1 = Group(
name: 'Test Group 1',
description: '',
@@ -62,28 +62,24 @@ void main() {
name: 'First Test Match',
game: testGame,
group: testGroup1,
players: [testPlayer4, testPlayer5],
notes: '',
players: [testPlayer4, testPlayer5]
);
testMatch2 = Match(
name: 'Second Test Match',
game: testGame,
group: testGroup2,
players: [testPlayer1, testPlayer2, testPlayer3],
notes: '',
players: [testPlayer1, testPlayer2, testPlayer3]
);
testMatchOnlyPlayers = Match(
name: 'Test Match with Players',
game: testGame,
players: [testPlayer1, testPlayer2, testPlayer3],
notes: '',
players: [testPlayer1, testPlayer2, testPlayer3]
);
testMatchOnlyGroup = Match(
name: 'Test Match with Group',
game: testGame,
group: testGroup2,
players: testGroup2.members,
notes: '',
players: testGroup2.members
);
});
await database.playerDao.addPlayersAsList(

View File

@@ -33,10 +33,10 @@ void main() {
);
withClock(fakeClock, () {
testPlayer1 = Player(name: 'Alice', description: '');
testPlayer2 = Player(name: 'Bob', description: '');
testPlayer3 = Player(name: 'Charlie', description: '');
testPlayer4 = Player(name: 'Diana', description: '');
testPlayer1 = Player(name: 'Alice');
testPlayer2 = Player(name: 'Bob');
testPlayer3 = Player(name: 'Charlie');
testPlayer4 = Player(name: 'Diana');
testTeam1 = Team(name: 'Team Alpha', members: [testPlayer1, testPlayer2]);
testTeam2 = Team(name: 'Team Beta', members: [testPlayer3, testPlayer4]);
testTeam3 = Team(name: 'Team Gamma', members: [testPlayer1, testPlayer3]);

View File

@@ -24,10 +24,10 @@ void main() {
);
withClock(fakeClock, () {
testPlayer1 = Player(name: 'Test Player', description: '');
testPlayer2 = Player(name: 'Second Player', description: '');
testPlayer3 = Player(name: 'Charlie', description: '');
testPlayer4 = Player(name: 'Diana', description: '');
testPlayer1 = Player(name: 'Test Player');
testPlayer2 = Player(name: 'Second Player');
testPlayer3 = Player(name: 'Charlie');
testPlayer4 = Player(name: 'Diana');
});
});
tearDown(() async {
@@ -348,7 +348,7 @@ void main() {
// Verifies that a player with empty string name is stored correctly.
test('Player with empty string name is stored correctly', () async {
final emptyNamePlayer = Player(name: '', description: '');
final emptyNamePlayer = Player(name: '');
await database.playerDao.addPlayer(player: emptyNamePlayer);
@@ -361,7 +361,7 @@ void main() {
// Verifies that a player with very long name is stored correctly.
test('Player with very long name is stored correctly', () async {
final longName = 'A' * 1000;
final longNamePlayer = Player(name: longName, description: '');
final longNamePlayer = Player(name: longName);
await database.playerDao.addPlayer(player: longNamePlayer);

View File

@@ -26,10 +26,10 @@ void main() {
);
withClock(fakeClock, () {
testPlayer1 = Player(name: 'Alice', description: '');
testPlayer2 = Player(name: 'Bob', description: '');
testPlayer3 = Player(name: 'Charlie', description: '');
testPlayer4 = Player(name: 'Diana', description: '');
testPlayer1 = Player(name: 'Alice');
testPlayer2 = Player(name: 'Bob');
testPlayer3 = Player(name: 'Charlie');
testPlayer4 = Player(name: 'Diana');
testGroup = Group(
name: 'Test Group',
description: '',

View File

@@ -37,12 +37,12 @@ void main() {
);
withClock(fakeClock, () {
testPlayer1 = Player(name: 'Alice', description: '');
testPlayer2 = Player(name: 'Bob', description: '');
testPlayer3 = Player(name: 'Charlie', description: '');
testPlayer4 = Player(name: 'Diana', description: '');
testPlayer5 = Player(name: 'Eve', description: '');
testPlayer6 = Player(name: 'Frank', description: '');
testPlayer1 = Player(name: 'Alice');
testPlayer2 = Player(name: 'Bob');
testPlayer3 = Player(name: 'Charlie');
testPlayer4 = Player(name: 'Diana');
testPlayer5 = Player(name: 'Eve');
testPlayer6 = Player(name: 'Frank');
testGroup = Group(
name: 'Test Group',
description: '',
@@ -59,14 +59,12 @@ void main() {
name: 'Test Match with Group',
game: testGame,
players: testGroup.members,
group: testGroup,
notes: '',
group: testGroup
);
testMatchOnlyPlayers = Match(
name: 'Test Match with Players',
game: testGame,
players: [testPlayer4, testPlayer5, testPlayer6],
notes: '',
players: [testPlayer4, testPlayer5, testPlayer6]
);
testTeam1 = Team(name: 'Team Alpha', members: [testPlayer1, testPlayer2]);
testTeam2 = Team(name: 'Team Beta', members: [testPlayer3, testPlayer4]);
@@ -568,14 +566,12 @@ void main() {
final match1 = Match(
name: 'Match 1',
game: testGame,
players: playersList,
notes: '',
players: playersList
);
final match2 = Match(
name: 'Match 2',
game: testGame,
players: playersList,
notes: '',
players: playersList
);
await Future.wait([

View File

@@ -30,9 +30,9 @@ void main() {
);
withClock(fakeClock, () {
testPlayer1 = Player(name: 'Alice', description: '');
testPlayer2 = Player(name: 'Bob', description: '');
testPlayer3 = Player(name: 'Charlie', description: '');
testPlayer1 = Player(name: 'Alice');
testPlayer2 = Player(name: 'Bob');
testPlayer3 = Player(name: 'Charlie');
testGame = Game(
name: 'Test Game',
ruleset: Ruleset.singleWinner,
@@ -44,13 +44,11 @@ void main() {
name: 'Test Match 1',
game: testGame,
players: [testPlayer1, testPlayer2],
notes: '',
);
testMatch2 = Match(
name: 'Test Match 2',
game: testGame,
players: [testPlayer2, testPlayer3],
notes: '',
);
});