Skip to content

Instantly share code, notes, and snippets.

@SidneyMachara
Last active December 13, 2019 12:01
Show Gist options
  • Save SidneyMachara/63f558b5236d6589a98d7756e613f4a4 to your computer and use it in GitHub Desktop.
Save SidneyMachara/63f558b5236d6589a98d7756e613f4a4 to your computer and use it in GitHub Desktop.
appBar: AppBar(
title: Text("Tic Tac Toe"),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
child: GridView.builder(
padding: const EdgeInsets.all(10.0),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
childAspectRatio: 1.0,
crossAxisSpacing: 9.0,
mainAxisSpacing: 9.0),
itemCount: buttonsList.length,
itemBuilder: (context, i) => SizedBox(
width: 100,
height: 100,
child: RaisedButton(
padding: const EdgeInsets.all(8.0),
onPressed: buttonsList[i].enabled ? () {
//TODO play(i)
} : null,
child: Text(
buttonsList[i].text,
style: TextStyle(color: Colors.white, fontSize: 20.0),
),
color: buttonsList[i].bg,
disabledColor: buttonsList[i].bg,
),
),
),
),
Text(
gameOver == true ? "${activePlayer.playerHandle} Won" : "",
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
Padding(
padding: EdgeInsets.only(left: 20.0, bottom: 40.0),
child: Text(
gameOver == true ? "i am a BUG fix me !!" : "",
style: TextStyle(fontSize: 10, fontWeight: FontWeight.bold,color: Colors.red),
),
),
RaisedButton(
onPressed: () => {
//TODO restart()
},
child: Text(
"Restart",
style: TextStyle(fontSize: 20.0, color: Colors.white),
),
padding: const EdgeInsets.all(20.0),
)
],
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment