From f3f7d449948244e0ade636702f37934cb36b3f47 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Thu, 21 May 2026 17:59:26 +0200 Subject: [PATCH] refactoring --- .../create_teams/create_teams_view.dart | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/presentation/views/main_menu/match_view/create_match/create_teams/create_teams_view.dart b/lib/presentation/views/main_menu/match_view/create_match/create_teams/create_teams_view.dart index ed5fcb2..a8f3899 100644 --- a/lib/presentation/views/main_menu/match_view/create_match/create_teams/create_teams_view.dart +++ b/lib/presentation/views/main_menu/match_view/create_match/create_teams/create_teams_view.dart @@ -70,7 +70,7 @@ class _CreateTeamsViewState extends State { hintText: '${loc.team} ${index + 1}', onDelete: teams.length <= 2 ? null - : () => _removeTeam(index), + : () => removeTeam(index), onColorSelection: (color) { setState(() { teams[index] = teams[index].copyWith(color: color); @@ -121,16 +121,6 @@ class _CreateTeamsViewState extends State { ); } - /// Adds a new team to the list of teams, creates a corresponding controller, - /// and redistributes the players among all teams. - void addTeam() { - setState(() { - final newTeam = getNewTeam(); - teams.add(newTeam); - nameController.add(getNewController(newTeam)); - }); - } - /// Creates a new team with a default name and color based on the current number Team getNewTeam() { final loc = AppLocalizations.of(context); @@ -153,9 +143,19 @@ class _CreateTeamsViewState extends State { return textController; } + /// Adds a new team to the list of teams, creates a corresponding controller, + /// and redistributes the players among all teams. + void addTeam() { + setState(() { + final newTeam = getNewTeam(); + teams.add(newTeam); + nameController.add(getNewController(newTeam)); + }); + } + /// Removes the team with the given index. If there are less than 2 teams the /// removed team gets replaced with a new one - void _removeTeam(int index) { + void removeTeam(int index) { final loc = AppLocalizations.of(context); setState(() {