From c4094a547e40de2989d713544a01f7a6e52a0d00 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Tue, 9 Dec 2025 20:52:14 +0100 Subject: [PATCH] Fixed button state problem --- .../views/main_menu/create_game/create_game_view.dart | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/presentation/views/main_menu/create_game/create_game_view.dart b/lib/presentation/views/main_menu/create_game/create_game_view.dart index 8b3271c..b9a8141 100644 --- a/lib/presentation/views/main_menu/create_game/create_game_view.dart +++ b/lib/presentation/views/main_menu/create_game/create_game_view.dart @@ -126,6 +126,11 @@ class _CreateGameViewState extends State { child: TextInputField( controller: _gameNameController, hintText: 'Game name', + onChanged: (value) { + setState(() { + _gameNameController; + }); + }, ), ), ChooseTile( @@ -144,7 +149,6 @@ class _CreateGameViewState extends State { ); setState(() { if (selectedGameIndex != -1) { - print('selectedGameIndex: $selectedGameIndex'); selectedRuleset = games[selectedGameIndex].$3; selectedRulesetIndex = rulesets.indexWhere( (r) => r.$1 == selectedRuleset, @@ -251,9 +255,12 @@ class _CreateGameViewState 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 && + final value = + _gameNameController.text.isNotEmpty && (selectedGroup != null || (selectedPlayers != null && selectedPlayers!.length > 1)) && selectedRuleset != null; + print('button: $value'); + return value; } }