diff --git a/lib/presentation/views/main_menu/match_view/create_match/create_match_view.dart b/lib/presentation/views/main_menu/match_view/create_match/create_match_view.dart index 787d200..f3b4d79 100644 --- a/lib/presentation/views/main_menu/match_view/create_match/create_match_view.dart +++ b/lib/presentation/views/main_menu/match_view/create_match/create_match_view.dart @@ -28,8 +28,8 @@ class _CreateMatchViewState extends State { /// Reference to the app database late final AppDatabase db; - /// Controller for the game name input field - final TextEditingController _gameNameController = TextEditingController(); + /// Controller for the match name input field + final TextEditingController _matchNameController = TextEditingController(); /// List of all groups from the database List groupsList = []; @@ -95,7 +95,7 @@ class _CreateMatchViewState extends State { @override void initState() { super.initState(); - _gameNameController.addListener(() { + _matchNameController.addListener(() { setState(() {}); }); @@ -119,7 +119,7 @@ class _CreateMatchViewState extends State { backgroundColor: CustomTheme.backgroundColor, scrolledUnderElevation: 0, title: const Text( - 'Create new game', + 'Create new match', style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), ), centerTitle: true, @@ -131,8 +131,8 @@ class _CreateMatchViewState extends State { Container( margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 5), child: TextInputField( - controller: _gameNameController, - hintText: 'Game name', + controller: _matchNameController, + hintText: 'Match name', ), ), ChooseTile( @@ -222,13 +222,13 @@ class _CreateMatchViewState extends State { ), ), CustomWidthButton( - text: 'Create game', + text: 'Create match', sizeRelativeToWidth: 0.95, buttonType: ButtonType.primary, onPressed: _enableCreateGameButton() ? () async { Match match = Match( - name: _gameNameController.text.trim(), + name: _matchNameController.text.trim(), createdAt: DateTime.now(), group: selectedGroup, players: selectedPlayers, @@ -239,7 +239,7 @@ class _CreateMatchViewState extends State { context, CupertinoPageRoute( fullscreenDialog: true, - builder: (context) => GameResultView( + builder: (context) => MatchResultView( match: match, onWinnerChanged: widget.onWinnerChanged, ), @@ -258,7 +258,7 @@ class _CreateMatchViewState extends State { /// Determines whether the "Create Game" button should be enabled based on /// the current state of the input fields. bool _enableCreateGameButton() { - return _gameNameController.text.isNotEmpty && + return _matchNameController.text.isNotEmpty && (selectedGroup != null || (selectedPlayers != null && selectedPlayers!.length > 1)) && selectedRuleset != null; diff --git a/lib/presentation/views/main_menu/match_view/match_result_view.dart b/lib/presentation/views/main_menu/match_view/match_result_view.dart index c6c3dae..e8075f6 100644 --- a/lib/presentation/views/main_menu/match_view/match_result_view.dart +++ b/lib/presentation/views/main_menu/match_view/match_result_view.dart @@ -6,17 +6,17 @@ import 'package:game_tracker/data/dto/player.dart'; import 'package:game_tracker/presentation/widgets/tiles/custom_radio_list_tile.dart'; import 'package:provider/provider.dart'; -class GameResultView extends StatefulWidget { +class MatchResultView extends StatefulWidget { final Match match; final VoidCallback? onWinnerChanged; - const GameResultView({super.key, required this.match, this.onWinnerChanged}); + const MatchResultView({super.key, required this.match, this.onWinnerChanged}); @override - State createState() => _GameResultViewState(); + State createState() => _MatchResultViewState(); } -class _GameResultViewState extends State { +class _MatchResultViewState extends State { late final List allPlayers; late final AppDatabase db; Player? _selectedPlayer; @@ -142,12 +142,12 @@ class _GameResultViewState extends State { widget.onWinnerChanged?.call(); } - List getAllPlayers(Match game) { - if (game.group == null && game.players != null) { - return [...game.players!]; - } else if (game.group != null && game.players != null) { - return [...game.players!, ...game.group!.members]; + List getAllPlayers(Match match) { + if (match.group == null && match.players != null) { + return [...match.players!]; + } else if (match.group != null && match.players != null) { + return [...match.players!, ...match.group!.members]; } - return [...game.group!.members]; + return [...match.group!.members]; } } diff --git a/lib/presentation/views/main_menu/match_view/match_view.dart b/lib/presentation/views/main_menu/match_view/match_view.dart index 462e1b5..e7d29c0 100644 --- a/lib/presentation/views/main_menu/match_view/match_view.dart +++ b/lib/presentation/views/main_menu/match_view/match_view.dart @@ -80,7 +80,7 @@ class _MatchViewState extends State { context, CupertinoPageRoute( fullscreenDialog: true, - builder: (context) => GameResultView( + builder: (context) => MatchResultView( match: matches[index], onWinnerChanged: loadGames, ), diff --git a/test/db_tests/group_game_test.dart b/test/db_tests/group_match_test.dart similarity index 100% rename from test/db_tests/group_game_test.dart rename to test/db_tests/group_match_test.dart diff --git a/test/db_tests/player_game_test.dart b/test/db_tests/player_match_test.dart similarity index 100% rename from test/db_tests/player_game_test.dart rename to test/db_tests/player_match_test.dart