Moved setState to onChanged Callback in text field
This commit is contained in:
@@ -59,10 +59,6 @@ class _RoundViewState extends State<RoundView> {
|
|||||||
gameSession.roundList[widget.roundNumber - 1].kamikazePlayerIndex;
|
gameSession.roundList[widget.roundNumber - 1].kamikazePlayerIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var controller in _scoreControllerList) {
|
|
||||||
controller.addListener(_updateButtonState);
|
|
||||||
}
|
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,6 +216,7 @@ class _RoundViewState extends State<RoundView> {
|
|||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
onSubmitted: (_) =>
|
onSubmitted: (_) =>
|
||||||
_focusNextTextfield(index),
|
_focusNextTextfield(index),
|
||||||
|
onChanged: (_) => setState(() {}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 50),
|
const SizedBox(width: 50),
|
||||||
@@ -393,18 +390,11 @@ class _RoundViewState extends State<RoundView> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _updateButtonState() {
|
|
||||||
setState(() {}); // Erzwingt UI-Update
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
for (final controller in _scoreControllerList) {
|
for (final controller in _scoreControllerList) {
|
||||||
controller.dispose();
|
controller.dispose();
|
||||||
}
|
}
|
||||||
for (var controller in _scoreControllerList) {
|
|
||||||
controller.removeListener(_updateButtonState);
|
|
||||||
}
|
|
||||||
for (final focusNode in _focusNodeList) {
|
for (final focusNode in _focusNodeList) {
|
||||||
focusNode.dispose();
|
focusNode.dispose();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user