generated from me/template-mit
Got the UI to update for the button being pressed! Other buttons are not getting updated yet though.
This commit is contained in:
+8
-6
@@ -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)),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user