From 27fde6474ef7d35a88b665c6fa50338da4618f6b Mon Sep 17 00:00:00 2001 From: Hyperling Date: Tue, 24 Feb 2026 11:23:53 -0700 Subject: [PATCH] Make the game board its own widget. --- lib/main.dart | 81 +++++++++++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 38 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 6e7453d..c068436 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -9,51 +9,56 @@ class MainApp extends StatelessWidget { @override Widget build(BuildContext context) { - return const MaterialApp( - home: Scaffold( - body: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.stretch, + return const MaterialApp(home: Scaffold(body: GameBoard())); + } +} + +class GameBoard extends StatelessWidget { + const GameBoard({super.key}); + + @override + Widget build(BuildContext context) { + return Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + // Player 1 Goal + Column(children: [Center(child: Text(" P1 "))]), + // Center holes + Column( + spacing: 2, children: [ - // Player 1 Goal - Column(children: [Center(child: Text(" P1 "))]), - // Center holes - Column( + Row( spacing: 2, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - Row( - spacing: 2, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Column(children: [Text(" 0,0 ")]), - Column(children: [Text(" 1,0 ")]), - Column(children: [Text(" 2,0 ")]), - Column(children: [Text(" 3,0 ")]), - Column(children: [Text(" 4,0 ")]), - Column(children: [Text(" 5,0 ")]), - ], - ), - Row( - spacing: 2, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Column(children: [Text(" 0,1 ")]), - Column(children: [Text(" 1,1 ")]), - Column(children: [Text(" 2,1 ")]), - Column(children: [Text(" 3,1 ")]), - Column(children: [Text(" 4,1 ")]), - Column(children: [Text(" 5,1 ")]), - ], - ), + Column(children: [Text(" 0,0 ")]), + Column(children: [Text(" 1,0 ")]), + Column(children: [Text(" 2,0 ")]), + Column(children: [Text(" 3,0 ")]), + Column(children: [Text(" 4,0 ")]), + Column(children: [Text(" 5,0 ")]), + ], + ), + Row( + spacing: 2, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Column(children: [Text(" 0,1 ")]), + Column(children: [Text(" 1,1 ")]), + Column(children: [Text(" 2,1 ")]), + Column(children: [Text(" 3,1 ")]), + Column(children: [Text(" 4,1 ")]), + Column(children: [Text(" 5,1 ")]), ], ), - // Player 2 Goal - Column(children: [Center(child: Text(" P2 "))]), ], ), - ), + // Player 2 Goal + Column(children: [Center(child: Text(" P2 "))]), + ], ); } }