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();
}
void _getText() {
setState() {
void _playBoardSpot() {
logger.d(method: "_playBoardSpot", "Playing spot '$_spot'");
setState(() {
logger.d(method: "_playBoardSpot", "Inside setState()");
if (widget.text == "Reset") {
gameReset();
}
if (widget.spot >= 12) {
null;
} else {
gameTurn(widget.spot, BOARD[widget.spot]);
gameTurn(_spot, BOARD[_spot]);
}
_text = BOARD[_spot].toString();
}
});
}
@override
@@ -162,8 +164,8 @@ class _BoardSpotState extends State<BoardSpot> {
width: widget.w,
height: widget.h,
child: TextButton(
onPressed: _getText,
child: Center(child: Text("$_text", textAlign: TextAlign.center)),
onPressed: _playBoardSpot,
child: Center(child: Text(_text, textAlign: TextAlign.center)),
),
);
}