From fdd0e7579ac6e486ad57cfb4fb74d108e081f7b7 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Wed, 7 Jan 2026 14:34:37 +0100 Subject: [PATCH] Updated game title process --- .../create_match/create_match_view.dart | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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 fe1e8f5..7b7deb0 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 @@ -32,7 +32,7 @@ class _CreateMatchViewState extends State { final TextEditingController _matchNameController = TextEditingController(); /// Hint text for the match name input field - String hintText = 'Match Name'; + String? hintText; /// List of all groups from the database List groupsList = []; @@ -101,6 +101,7 @@ class _CreateMatchViewState extends State { void didChangeDependencies() { super.didChangeDependencies(); final loc = AppLocalizations.of(context); + hintText ??= loc.match_name; _rulesets = [ (Ruleset.singleWinner, loc.ruleset_single_winner), (Ruleset.singleLoser, loc.ruleset_single_loser), @@ -137,7 +138,7 @@ class _CreateMatchViewState extends State { margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 5), child: TextInputField( controller: _matchNameController, - hintText: hintText, + hintText: hintText ?? '', ), ), ChooseTile( @@ -162,7 +163,7 @@ class _CreateMatchViewState extends State { (r) => r.$1 == selectedRuleset, ); } else { - hintText = 'Match Name'; + hintText = AppLocalizations.of(context).match_name; selectedRuleset = null; } }); @@ -237,7 +238,7 @@ class _CreateMatchViewState extends State { ? () async { Match match = Match( name: _matchNameController.text.isEmpty - ? hintText + ? (hintText ?? '') : _matchNameController.text.trim(), createdAt: DateTime.now(), group: selectedGroup, @@ -265,8 +266,11 @@ class _CreateMatchViewState extends State { ); } - /// Determines whether the "Create Game" button should be enabled based on - /// the current state of the input fields. + /// Determines whether the "Create Match" button should be enabled. + /// + /// Returns `true` if: + /// - A ruleset is selected AND + /// - Either a group is selected OR at least 2 players are selected bool _enableCreateGameButton() { return (selectedGroup != null || (selectedPlayers != null && selectedPlayers!.length > 1)) &&