Corrected game tile skeleton

This commit is contained in:
2025-11-17 13:19:05 +01:00
parent c195c5e2bb
commit 2fc7eab1ac
2 changed files with 37 additions and 39 deletions

View File

@@ -26,7 +26,8 @@ class _HomeViewState extends State<HomeView> {
_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<HomeView> {
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),
],

View File

@@ -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<GameTile> {
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<GameTile> {
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,
),
),
),
],
],
),
),
),
),