Merge remote-tracking branch 'origin/development' into feature/206-Neuer-Regelsatz-Platzierung
# Conflicts: # lib/l10n/arb/app_de.arb # lib/l10n/arb/app_en.arb # lib/l10n/generated/app_localizations.dart # lib/l10n/generated/app_localizations_de.dart # lib/l10n/generated/app_localizations_en.dart
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:tallee/core/enums.dart';
|
||||
import 'package:tallee/data/models/match.dart';
|
||||
import 'package:tallee/data/models/player.dart';
|
||||
@@ -23,8 +23,71 @@ String translateRulesetToString(Ruleset ruleset, BuildContext context) {
|
||||
}
|
||||
}
|
||||
|
||||
/// 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
|
||||
/// Translates a [GameColor] enum value to its corresponding localized string.
|
||||
String translateGameColorToString(GameColor color, BuildContext context) {
|
||||
final loc = AppLocalizations.of(context);
|
||||
switch (color) {
|
||||
case GameColor.red:
|
||||
return loc.color_red;
|
||||
case GameColor.blue:
|
||||
return loc.color_blue;
|
||||
case GameColor.green:
|
||||
return loc.color_green;
|
||||
case GameColor.yellow:
|
||||
return loc.color_yellow;
|
||||
case GameColor.purple:
|
||||
return loc.color_purple;
|
||||
case GameColor.orange:
|
||||
return loc.color_orange;
|
||||
case GameColor.pink:
|
||||
return loc.color_pink;
|
||||
case GameColor.teal:
|
||||
return loc.color_teal;
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the [Color] object corresponding to a [GameColor] enum value.
|
||||
Color getColorFromGameColor(GameColor color) {
|
||||
switch (color) {
|
||||
case GameColor.red:
|
||||
return Colors.red;
|
||||
case GameColor.blue:
|
||||
return Colors.blue;
|
||||
case GameColor.green:
|
||||
return Colors.green;
|
||||
case GameColor.yellow:
|
||||
return const Color(0xFFF7CA28);
|
||||
case GameColor.purple:
|
||||
return Colors.purple;
|
||||
case GameColor.orange:
|
||||
return const Color(0xFFef681f);
|
||||
case GameColor.pink:
|
||||
return Colors.pink;
|
||||
case GameColor.teal:
|
||||
return Colors.teal;
|
||||
}
|
||||
}
|
||||
|
||||
/// 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
|
||||
/// string if there are no extra players
|
||||
String getExtraPlayerCount(Match match) {
|
||||
int count = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user