82 lines
2.2 KiB
Dart
82 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'clasic.dart';
|
|
|
|
void main() {
|
|
runApp(const MyApp());
|
|
}
|
|
|
|
class MyApp extends StatelessWidget {
|
|
const MyApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
title: 'Super Tic-Tac-Toe',
|
|
theme: ThemeData(
|
|
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
|
useMaterial3: true,
|
|
),
|
|
home: const MyHomePage(title: 'Local Tic Tac Toe'),
|
|
);
|
|
}
|
|
}
|
|
|
|
class MyHomePage extends StatefulWidget {
|
|
const MyHomePage({super.key, required this.title});
|
|
|
|
final String title;
|
|
|
|
@override
|
|
State<MyHomePage> createState() => _MyHomePageState();
|
|
}
|
|
|
|
enum GameType { classicTTC, superTTC }
|
|
|
|
class _MyHomePageState extends State<MyHomePage> {
|
|
GameType type = GameType.classicTTC;
|
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
drawer: Drawer(
|
|
key: _scaffoldKey,
|
|
child: ListView(
|
|
children: [
|
|
const DrawerHeader(
|
|
child: Text(
|
|
"Game Types",
|
|
style: TextStyle(fontSize: 25),
|
|
),
|
|
),
|
|
ListTile(
|
|
title: const Text("Classic"),
|
|
onTap: () {
|
|
setState(() {
|
|
type = GameType.classicTTC;
|
|
});
|
|
Navigator.pop(context);
|
|
},
|
|
),
|
|
ListTile(
|
|
title: const Text("Super"),
|
|
onTap: () {
|
|
setState(() {
|
|
type = GameType.superTTC;
|
|
});
|
|
Navigator.pop(context);
|
|
}),
|
|
],
|
|
)),
|
|
appBar: AppBar(
|
|
title: Text(widget.title),
|
|
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
|
),
|
|
body: Padding(
|
|
padding: const EdgeInsets.all(10),
|
|
child: type == GameType.classicTTC
|
|
? const ClassicGame()
|
|
: const Center(child: Text("Under Construction")),
|
|
));
|
|
}
|
|
}
|