diff --git a/lib/core/common.dart b/lib/core/common.dart index 2db8d19..14d90aa 100644 --- a/lib/core/common.dart +++ b/lib/core/common.dart @@ -58,7 +58,7 @@ Color getColorFromGameColor(GameColor color) { case GameColor.purple: return Colors.purple; case GameColor.orange: - return Colors.orange; + return const Color(0xFFef681f); case GameColor.pink: return Colors.pink; case GameColor.teal: @@ -66,8 +66,10 @@ Color getColorFromGameColor(GameColor color) { } } -/// Counts how many players in the match are not part of the group -/// Returns the count as a string, or an empty string if there is no group +/// Counts how many players in the [match] are not part of the group +/// +/// Returns the text you append after the group name, e.g. " + 5" or an empty +/// string if there are no extra players String getExtraPlayerCount(Match match) { int count = 0; 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 8f3e06e..42d5253 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 @@ -6,7 +6,7 @@ import 'package:tallee/data/models/game.dart'; import 'package:tallee/l10n/generated/app_localizations.dart'; import 'package:tallee/presentation/views/main_menu/match_view/create_match/create_game/create_game_view.dart'; import 'package:tallee/presentation/widgets/text_input/custom_search_bar.dart'; -import 'package:tallee/presentation/widgets/tiles/title_description_list_tile.dart'; +import 'package:tallee/presentation/widgets/tiles/game_tile.dart'; class ChooseGameView extends StatefulWidget { /// A view that allows the user to choose a game from a list of available games @@ -110,6 +110,7 @@ class _ChooseGameViewState extends State { }, child: Column( children: [ + // Search Bar Padding( padding: const EdgeInsets.symmetric(horizontal: 10), child: CustomSearchBar( @@ -121,15 +122,18 @@ class _ChooseGameViewState extends State { ), ), const SizedBox(height: 5), + + // Game list Expanded( child: ListView.builder( itemCount: filteredGames.length, itemBuilder: (BuildContext context, int index) { final game = filteredGames[index]; - return TitleDescriptionListTile( + return GameTile( title: game.name, description: game.description, badgeText: translateRulesetToString(game.ruleset, context), + badgeColor: getColorFromGameColor(game.color), isHighlighted: selectedGameId == game.id, onTap: () async { setState(() { diff --git a/lib/presentation/views/main_menu/match_view/create_match/create_game/choose_color_view.dart b/lib/presentation/views/main_menu/match_view/create_match/create_game/choose_color_view.dart index bf764ad..e6d0b7e 100644 --- a/lib/presentation/views/main_menu/match_view/create_match/create_game/choose_color_view.dart +++ b/lib/presentation/views/main_menu/match_view/create_match/create_game/choose_color_view.dart @@ -3,7 +3,7 @@ import 'package:tallee/core/common.dart'; import 'package:tallee/core/custom_theme.dart'; import 'package:tallee/core/enums.dart'; import 'package:tallee/l10n/generated/app_localizations.dart'; -import 'package:tallee/presentation/widgets/tiles/title_description_list_tile.dart'; +import 'package:tallee/presentation/widgets/tiles/game_tile.dart'; class ChooseColorView extends StatefulWidget { /// A view that allows the user to choose a color from a list of available game colors @@ -54,7 +54,7 @@ class _ChooseColorViewState extends State { itemCount: colors.length, itemBuilder: (BuildContext context, int index) { final color = colors[index]; - return TitleDescriptionListTile( + return GameTile( onTap: () { setState(() { if (selectedColor == color) {