generated from me/template-mit
82 lines
2.3 KiB
Dart
82 lines
2.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
void main() {
|
|
runApp(const MainApp());
|
|
}
|
|
|
|
class MainApp extends StatelessWidget {
|
|
const MainApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return const MaterialApp(home: Scaffold(body: GameBoard()));
|
|
}
|
|
}
|
|
|
|
class GameBoard extends StatelessWidget {
|
|
const GameBoard({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
var text = "hello test lalala";
|
|
return Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
// Player 1 Goal
|
|
Column(
|
|
children: [Center(child: BoardSpot(text: "P1"))],
|
|
),
|
|
// Center holes
|
|
Column(
|
|
spacing: 2,
|
|
children: [
|
|
Row(
|
|
spacing: 2,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
Column(children: [BoardSpot(text: "0,0")]),
|
|
Column(children: [BoardSpot(text: "1,0")]),
|
|
Column(children: [BoardSpot(text: "2,0")]),
|
|
Column(children: [BoardSpot(text: "3,0")]),
|
|
Column(children: [BoardSpot(text: "4,0")]),
|
|
Column(children: [BoardSpot(text: "5,0")]),
|
|
],
|
|
),
|
|
Row(
|
|
spacing: 2,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
Column(children: [BoardSpot(text: "0,1")]),
|
|
Column(children: [BoardSpot(text: "1,1")]),
|
|
Column(children: [BoardSpot(text: "2,1")]),
|
|
Column(children: [BoardSpot(text: "3,1")]),
|
|
Column(children: [BoardSpot(text: "4,1")]),
|
|
Column(children: [BoardSpot(text: "5,1")]),
|
|
],
|
|
),
|
|
BoardSpot(text: text),
|
|
],
|
|
),
|
|
// Player 2 Goal
|
|
Column(
|
|
children: [Center(child: BoardSpot(text: "P2"))],
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|
|
|
|
class BoardSpot extends StatelessWidget {
|
|
const BoardSpot({super.key, required this.text});
|
|
|
|
final String text;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SizedBox(width: 25.0, height: 25.0, child: Text(text));
|
|
}
|
|
}
|