Fix up the grid agin

This commit is contained in:
2025-02-22 15:51:53 +01:00
parent edb7dbfe05
commit 406be305e2

View File

@@ -80,15 +80,18 @@ class _MyHomePageState extends State<MyHomePage> {
),
body: RefreshIndicator(
onRefresh: _refreshGames,
child: SingleChildScrollView(
child: LayoutBuilder(
builder: (context, constraints) {
final cardWidth = constraints.maxWidth / 4;
return SingleChildScrollView(
padding: const EdgeInsets.all(8),
child: Wrap(
spacing: 4,
runSpacing: 4,
spacing: 8,
runSpacing: 8,
children: [
...games.values.map(
(game) => SizedBox(
width: 400,
width: cardWidth - 10, // Subtract spacing to fit 4 cards
child: GameCard(
game: game,
onGameUpdated: (game) async {
@@ -107,7 +110,7 @@ class _MyHomePageState extends State<MyHomePage> {
),
),
SizedBox(
width: 400,
width: cardWidth - 10, // Subtract spacing to fit 4 cards
child: NewGameCard(
onGameCreated: (game) async {
game = await GameRepository.upsert(game);
@@ -119,6 +122,8 @@ class _MyHomePageState extends State<MyHomePage> {
),
],
),
);
},
),
),
);