From 23f0c9c23e9a9f398d93c3532744608f66a24b5d Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Tue, 5 May 2026 13:42:39 +0200 Subject: [PATCH] Updated statistics view --- .../views/main_menu/statistics_view.dart | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/lib/presentation/views/main_menu/statistics_view.dart b/lib/presentation/views/main_menu/statistics_view.dart index 98a8e1d..fc6de83 100644 --- a/lib/presentation/views/main_menu/statistics_view.dart +++ b/lib/presentation/views/main_menu/statistics_view.dart @@ -6,6 +6,7 @@ import 'package:tallee/data/models/match.dart'; import 'package:tallee/data/models/player.dart'; import 'package:tallee/l10n/generated/app_localizations.dart'; import 'package:tallee/presentation/widgets/app_skeleton.dart'; +import 'package:tallee/presentation/widgets/tiles/quick_info_tile.dart'; import 'package:tallee/presentation/widgets/tiles/statistics_tile.dart'; import 'package:tallee/presentation/widgets/top_centered_message.dart'; @@ -18,6 +19,9 @@ class StatisticsView extends StatefulWidget { } class _StatisticsViewState extends State { + int matchCount = 0; + int groupCount = 0; + List<(Player, int)> winCounts = List.filled(6, ( Player(name: 'Skeleton Player'), 1, @@ -53,7 +57,27 @@ class _StatisticsViewState extends State { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ - SizedBox(height: constraints.maxHeight * 0.01), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + QuickInfoTile( + width: constraints.maxWidth * 0.45, + height: constraints.maxHeight * 0.15, + title: loc.matches, + icon: Icons.groups_rounded, + value: matchCount, + ), + SizedBox(width: constraints.maxWidth * 0.05), + QuickInfoTile( + width: constraints.maxWidth * 0.45, + height: constraints.maxHeight * 0.15, + title: loc.groups, + icon: Icons.groups_rounded, + value: groupCount, + ), + ], + ), + SizedBox(height: constraints.maxHeight * 0.02), Visibility( visible: winCounts.isEmpty && @@ -115,11 +139,17 @@ class _StatisticsViewState extends State { Future.wait([ db.matchDao.getAllMatches(), db.playerDao.getAllPlayers(), + db.matchDao.getMatchCount(), + db.groupDao.getGroupCount(), Future.delayed(Constants.MINIMUM_SKELETON_DURATION), ]).then((results) async { if (!mounted) return; + final matches = results[0] as List; final players = results[1] as List; + matchCount = results[2] as int; + groupCount = results[3] as int; + winCounts = _calculateWinsForAllPlayers( matches: matches, players: players, @@ -134,6 +164,7 @@ class _StatisticsViewState extends State { winCounts: winCounts, matchCounts: matchCounts, ); + setState(() { isLoading = false; });