From 2fc7eab1ac465f53ff9e3f2e417f6a9609d8a8ed Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Mon, 17 Nov 2025 13:19:05 +0100 Subject: [PATCH] Corrected game tile skeleton --- .../views/main_menu/home_view.dart | 41 ++++++++----------- lib/presentation/widgets/game_tile.dart | 35 +++++++++------- 2 files changed, 37 insertions(+), 39 deletions(-) diff --git a/lib/presentation/views/main_menu/home_view.dart b/lib/presentation/views/main_menu/home_view.dart index 57c4f61..cf6288a 100644 --- a/lib/presentation/views/main_menu/home_view.dart +++ b/lib/presentation/views/main_menu/home_view.dart @@ -26,7 +26,8 @@ class _HomeViewState extends State { _gameCountFuture = db.gameDao.getGameCount(); _groupCountFuture = db.groupDao.getGroupCount(); - Future.wait([_gameCountFuture, _groupCountFuture]).then((_) { + Future.wait([_gameCountFuture, _groupCountFuture]).then((_) async { + await Future.delayed(const Duration(milliseconds: 50)); if (mounted) { setState(() { isLoading = false; @@ -102,37 +103,29 @@ class _HomeViewState extends State { width: constraints.maxWidth * 0.95, title: 'Recent Games', icon: Icons.timer, - content: Padding( - padding: const EdgeInsets.symmetric(horizontal: 40.0), + content: const Padding( + padding: EdgeInsets.symmetric(horizontal: 40.0), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Skeleton.unite( - unite: true, - borderRadius: BorderRadius.circular(8), - child: const GameTile( - gameTitle: 'Gamenight', - gameType: 'Cabo', - ruleset: 'Lowest Points', - players: '5 Players', - winner: 'Leonard', - ), + GameTile( + gameTitle: 'Gamenight', + gameType: 'Cabo', + ruleset: 'Lowest Points', + players: '5 Players', + winner: 'Leonard', ), - const Padding( + Padding( padding: EdgeInsets.symmetric(vertical: 8.0), child: Divider(), ), - Skeleton.unite( - unite: true, - borderRadius: BorderRadius.circular(8), - child: const GameTile( - gameTitle: 'Schoolbreak', - gameType: 'Uno', - ruleset: 'Highest Points', - players: 'The Gang', - winner: 'Lina', - ), + GameTile( + gameTitle: 'Schoolbreak', + gameType: 'Uno', + ruleset: 'Highest Points', + players: 'The Gang', + winner: 'Lina', ), SizedBox(height: 8), ], diff --git a/lib/presentation/widgets/game_tile.dart b/lib/presentation/widgets/game_tile.dart index c79a6b7..fcd2f65 100644 --- a/lib/presentation/widgets/game_tile.dart +++ b/lib/presentation/widgets/game_tile.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:game_tracker/core/custom_theme.dart'; +import 'package:skeletonizer/skeletonizer.dart'; class GameTile extends StatefulWidget { final String gameTitle; @@ -48,9 +49,11 @@ class _GameTileState extends State { borderRadius: BorderRadius.circular(4), color: CustomTheme.primaryColor, ), - child: Text( - widget.ruleset, - style: const TextStyle(fontWeight: FontWeight.bold), + child: Skeleton.ignore( + child: Text( + widget.ruleset, + style: const TextStyle(fontWeight: FontWeight.bold), + ), ), ), Center( @@ -68,19 +71,21 @@ class _GameTileState extends State { borderRadius: BorderRadius.circular(4), color: Colors.yellow.shade300, ), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Icon(Icons.emoji_events, color: Colors.black, size: 20), - Text( - widget.winner, - textAlign: TextAlign.center, - style: const TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black87, + child: Skeleton.ignore( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Icon(Icons.emoji_events, color: Colors.black, size: 20), + Text( + widget.winner, + textAlign: TextAlign.center, + style: const TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black87, + ), ), - ), - ], + ], + ), ), ), ),