Added icons to rulesets
Some checks failed
Pull Request Pipeline / test (pull_request) Successful in 45s
Pull Request Pipeline / lint (pull_request) Failing after 47s

This commit is contained in:
2026-05-04 11:09:05 +02:00
parent b53facc16c
commit a9b86fe7ff
2 changed files with 30 additions and 6 deletions

View File

@@ -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 /// 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 /// Returns the text you append after the group name, e.g. " + 5" or an empty

View File

@@ -222,7 +222,7 @@ class _CreateGameViewState extends State<CreateGameView> {
contentDecoration: CustomTheme.standardBoxDecoration, contentDecoration: CustomTheme.standardBoxDecoration,
content: StatefulBuilder( content: StatefulBuilder(
builder: (context, setPopupState) => SizedBox( builder: (context, setPopupState) => SizedBox(
width: 250, width: 280,
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@@ -258,6 +258,10 @@ class _CreateGameViewState extends State<CreateGameView> {
child: Row( child: Row(
spacing: 8, spacing: 8,
children: [ children: [
Icon(
getRulesetIcon(_rulesets[index].$1),
size: 16,
),
Text( Text(
_rulesets[index].$2, _rulesets[index].$2,
style: const TextStyle( style: const TextStyle(
@@ -278,11 +282,15 @@ class _CreateGameViewState extends State<CreateGameView> {
), ),
), ),
), ),
child: selectedRuleset == null child: Row(
? Text(loc.none) children: [
: Text( Icon(getRulesetIcon(selectedRuleset!), size: 16),
translateRulesetToString(selectedRuleset!, context), SizedBox(width: 5),
), Text(
translateRulesetToString(selectedRuleset!, context),
),
],
),
), ),
), ),