Added button state update in round view

This commit is contained in:
2025-06-08 18:37:30 +02:00
parent cc4970c732
commit c03b891c44
2 changed files with 14 additions and 1 deletions

View File

@@ -58,6 +58,11 @@ class _RoundViewState extends State<RoundView> {
_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<RoundView> {
/// 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<RoundView> {
}
}
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();
}

View File

@@ -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