From a9b86fe7ffeb9ad3ee494d7797ae6e98c79c6167 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Mon, 4 May 2026 11:09:05 +0200 Subject: [PATCH] Added icons to rulesets --- lib/core/common.dart | 16 +++++++++++++++ .../create_match/create_game_view.dart | 20 +++++++++++++------ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/lib/core/common.dart b/lib/core/common.dart index 14d90aa..fc61a94 100644 --- a/lib/core/common.dart +++ b/lib/core/common.dart @@ -66,6 +66,22 @@ Color getColorFromGameColor(GameColor color) { } } +/// Returns [IconData] corresponding to a [Ruleset] enum value. +IconData getRulesetIcon(Ruleset ruleset) { + switch (ruleset) { + case Ruleset.highestScore: + return Icons.arrow_upward; + case Ruleset.lowestScore: + return Icons.arrow_downward; + case Ruleset.singleWinner: + return Icons.emoji_events; + case Ruleset.singleLoser: + return Icons.sentiment_dissatisfied; + case Ruleset.multipleWinners: + return Icons.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 diff --git a/lib/presentation/views/main_menu/match_view/create_match/create_game_view.dart b/lib/presentation/views/main_menu/match_view/create_match/create_game_view.dart index 6928c78..aeb2099 100644 --- a/lib/presentation/views/main_menu/match_view/create_match/create_game_view.dart +++ b/lib/presentation/views/main_menu/match_view/create_match/create_game_view.dart @@ -222,7 +222,7 @@ class _CreateGameViewState extends State { contentDecoration: CustomTheme.standardBoxDecoration, content: StatefulBuilder( builder: (context, setPopupState) => SizedBox( - width: 250, + width: 280, child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, @@ -258,6 +258,10 @@ class _CreateGameViewState extends State { child: Row( spacing: 8, children: [ + Icon( + getRulesetIcon(_rulesets[index].$1), + size: 16, + ), Text( _rulesets[index].$2, style: const TextStyle( @@ -278,11 +282,15 @@ class _CreateGameViewState extends State { ), ), ), - child: selectedRuleset == null - ? Text(loc.none) - : Text( - translateRulesetToString(selectedRuleset!, context), - ), + child: Row( + children: [ + Icon(getRulesetIcon(selectedRuleset!), size: 16), + SizedBox(width: 5), + Text( + translateRulesetToString(selectedRuleset!, context), + ), + ], + ), ), ),