Got the UI to update for the button being pressed! Other buttons are not getting updated yet though.

This commit is contained in:
2026-05-08 10:48:27 -07:00
parent 4d0dab8c41
commit 375a0599c1
+8 -6
View File
@@ -141,19 +141,21 @@ class _BoardSpotState extends State<BoardSpot> {
super.initState(); super.initState();
} }
void _getText() { void _playBoardSpot() {
setState() { logger.d(method: "_playBoardSpot", "Playing spot '$_spot'");
setState(() {
logger.d(method: "_playBoardSpot", "Inside setState()");
if (widget.text == "Reset") { if (widget.text == "Reset") {
gameReset(); gameReset();
} }
if (widget.spot >= 12) { if (widget.spot >= 12) {
null; null;
} else { } else {
gameTurn(widget.spot, BOARD[widget.spot]); gameTurn(_spot, BOARD[_spot]);
} }
_text = BOARD[_spot].toString(); _text = BOARD[_spot].toString();
} });
} }
@override @override
@@ -162,8 +164,8 @@ class _BoardSpotState extends State<BoardSpot> {
width: widget.w, width: widget.w,
height: widget.h, height: widget.h,
child: TextButton( child: TextButton(
onPressed: _getText, onPressed: _playBoardSpot,
child: Center(child: Text("$_text", textAlign: TextAlign.center)), child: Center(child: Text(_text, textAlign: TextAlign.center)),
), ),
); );
} }