From c03b891c44ec3f79e442fbb3a820b4af6ed1d4c0 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Sun, 8 Jun 2025 18:37:30 +0200 Subject: [PATCH] Added button state update in round view --- lib/views/round_view.dart | 13 +++++++++++++ pubspec.yaml | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/views/round_view.dart b/lib/views/round_view.dart index 48bc4b9..77a36c5 100644 --- a/lib/views/round_view.dart +++ b/lib/views/round_view.dart @@ -58,6 +58,11 @@ class _RoundViewState extends State { _kamikazePlayerIndex = gameSession.roundList[widget.roundNumber - 1].kamikazePlayerIndex; } + + for (var controller in _scoreControllerList) { + controller.addListener(_updateButtonState); + } + super.initState(); } @@ -337,6 +342,7 @@ class _RoundViewState extends State { /// Round Inputs are valid if every player has a score or /// kamikaze is selected for a player bool _areRoundInputsValid() { + print('Überprüfe, ob die Eingaben für die Runde gültig sind'); if (_areTextFieldsEmpty() && _kamikazePlayerIndex == null) return false; return true; } @@ -387,11 +393,18 @@ class _RoundViewState extends State { } } + void _updateButtonState() { + setState(() {}); // Erzwingt UI-Update + } + @override void dispose() { for (final controller in _scoreControllerList) { controller.dispose(); } + for (var controller in _scoreControllerList) { + controller.removeListener(_updateButtonState); + } for (final focusNode in _focusNodeList) { focusNode.dispose(); } diff --git a/pubspec.yaml b/pubspec.yaml index 9661bec..85cf31a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: cabo_counter description: "Mobile app for the card game Cabo" publish_to: 'none' -version: 0.1.6+145 +version: 0.1.6+146 environment: sdk: ^3.5.4