Added icons to rulesets
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user