build method
- BuildContext context
override
Returns a box which contains the piece image and a button, also displays the background color.
Implementation
@override
Widget build(BuildContext context) {
// debugPrint("Build method called for widget with index ${widget.index}");
return GestureDetector(
onTap: () async {
await _tapped(context);
},
child: SizedBox(
width: 5,
height: 5,
child: Container(
color: _calculateSquareColor(),
child: Container(
decoration: BoxDecoration(
image: board.currentBoard[y][x].getImg() != ""
? DecorationImage(
image: AssetImage(
"images${board.currentBoard[y][x].getImg()}.png"),
fit: BoxFit.cover)
: null),
),
),
),
);
}