Add background images for games

This commit is contained in:
2025-02-22 16:58:03 +01:00
parent 0a40e5bbcf
commit e5fc67ef43
12 changed files with 414 additions and 139 deletions

View File

@@ -82,7 +82,8 @@ class _MyHomePageState extends State<MyHomePage> {
onRefresh: _refreshGames,
child: LayoutBuilder(
builder: (context, constraints) {
final cardWidth = constraints.maxWidth / 4;
final cardWidth = constraints.maxWidth / 2;
final cardHeight = (cardWidth * 215) / 400; // Maintain aspect ratio
return SingleChildScrollView(
padding: const EdgeInsets.all(8),
child: Wrap(
@@ -91,7 +92,8 @@ class _MyHomePageState extends State<MyHomePage> {
children: [
...games.values.map(
(game) => SizedBox(
width: cardWidth - 10, // Subtract spacing to fit 4 cards
width: cardWidth - 10, // Subtract spacing to fit 3 cards
height: cardHeight - 10,
child: GameCard(
game: game,
onGameUpdated: (game) async {
@@ -110,7 +112,8 @@ class _MyHomePageState extends State<MyHomePage> {
),
),
SizedBox(
width: cardWidth - 10, // Subtract spacing to fit 4 cards
width: cardWidth - 10, // Subtract spacing to fit 3 cards
height: cardHeight - 10,
child: NewGameCard(
onGameCreated: (game) async {
game = await GameRepository.upsert(game);