From 3c9d115d08a85debb728f3cf9d0c15009944a4e0 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Sat, 23 May 2026 01:18:16 +0200 Subject: [PATCH] Updated game tile --- .../create_match/choose_game_view.dart | 5 +--- lib/presentation/widgets/tiles/game_tile.dart | 26 ++++++++++++++----- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/lib/presentation/views/main_menu/match_view/create_match/choose_game_view.dart b/lib/presentation/views/main_menu/match_view/create_match/choose_game_view.dart index 34f9be0..a4a7f2e 100644 --- a/lib/presentation/views/main_menu/match_view/create_match/choose_game_view.dart +++ b/lib/presentation/views/main_menu/match_view/create_match/choose_game_view.dart @@ -161,10 +161,7 @@ class _ChooseGameViewState extends State { return GameTile( title: game.name, description: game.description, - badgeText: translateRulesetToString( - game.ruleset, - context, - ), + subtitle: translateRulesetToString(game.ruleset, context), badgeColor: getColorFromGameColor(game.color), isHighlighted: selectedGameId == game.id, onTap: () async { diff --git a/lib/presentation/widgets/tiles/game_tile.dart b/lib/presentation/widgets/tiles/game_tile.dart index 9c274e9..2417408 100644 --- a/lib/presentation/widgets/tiles/game_tile.dart +++ b/lib/presentation/widgets/tiles/game_tile.dart @@ -7,6 +7,7 @@ import 'package:tallee/core/enums.dart'; class GameTile extends StatelessWidget { /// A list tile widget that displays a title and description, with optional highlighting and badge. /// - [title]: The title text displayed on the tile. + /// - [subtitle]: An optional subtitle displayed under the title. /// - [description]: The description text displayed below the title. /// - [onTap]: The callback invoked when the tile is tapped. /// - [onLongPress]: The callback invoked when the tile is tapped. @@ -17,6 +18,7 @@ class GameTile extends StatelessWidget { super.key, required this.title, required this.description, + this.subtitle, this.onTap, this.onLongPress, this.isHighlighted = false, @@ -24,25 +26,20 @@ class GameTile extends StatelessWidget { this.badgeColor, }); - /// The title text displayed on the tile. final String title; - /// The description text displayed below the title. + final String? subtitle; + final String description; - /// The callback invoked when the tile is tapped. final VoidCallback? onTap; - /// The callback invoked when the tile is long-pressed. final VoidCallback? onLongPress; - /// A boolean to determine if the tile should be highlighted. final bool isHighlighted; - /// Optional text to display in a badge on the right side of the title. final String? badgeText; - /// Optional color for the badge background. final Color? badgeColor; @override @@ -119,6 +116,21 @@ class GameTile extends StatelessWidget { ), ), + // Title + if (subtitle != null && subtitle!.isNotEmpty) ...[ + const SizedBox(height: 4), + Text( + subtitle!, + overflow: TextOverflow.ellipsis, + maxLines: 1, + softWrap: false, + style: const TextStyle( + fontSize: 14, + color: CustomTheme.hintColor, + ), + ), + ], + // Badge if (badgeText != null) ...[ const SizedBox(height: 5),