Implemented ruleset in match view
Some checks failed
Pull Request Pipeline / test (pull_request) Successful in 43s
Pull Request Pipeline / lint (pull_request) Failing after 46s

This commit is contained in:
2026-04-14 23:26:26 +02:00
parent df1bc4bf32
commit ddf32797aa
4 changed files with 77 additions and 35 deletions

View File

@@ -62,7 +62,8 @@ import 'app_localizations_en.dart';
/// be consistent with the languages listed in the AppLocalizations.supportedLocales /// be consistent with the languages listed in the AppLocalizations.supportedLocales
/// property. /// property.
abstract class AppLocalizations { abstract class AppLocalizations {
AppLocalizations(String locale) : localeName = intl.Intl.canonicalizedLocale(locale.toString()); AppLocalizations(String locale)
: localeName = intl.Intl.canonicalizedLocale(locale.toString());
final String localeName; final String localeName;
@@ -70,7 +71,8 @@ abstract class AppLocalizations {
return Localizations.of<AppLocalizations>(context, AppLocalizations)!; return Localizations.of<AppLocalizations>(context, AppLocalizations)!;
} }
static const LocalizationsDelegate<AppLocalizations> delegate = _AppLocalizationsDelegate(); static const LocalizationsDelegate<AppLocalizations> delegate =
_AppLocalizationsDelegate();
/// A list of this localizations delegate along with the default localizations /// A list of this localizations delegate along with the default localizations
/// delegates. /// delegates.
@@ -82,17 +84,18 @@ abstract class AppLocalizations {
/// Additional delegates can be added by appending to this list in /// Additional delegates can be added by appending to this list in
/// MaterialApp. This list does not have to be used at all if a custom list /// MaterialApp. This list does not have to be used at all if a custom list
/// of delegates is preferred or required. /// of delegates is preferred or required.
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates = <LocalizationsDelegate<dynamic>>[ static const List<LocalizationsDelegate<dynamic>> localizationsDelegates =
delegate, <LocalizationsDelegate<dynamic>>[
GlobalMaterialLocalizations.delegate, delegate,
GlobalCupertinoLocalizations.delegate, GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate,
]; GlobalWidgetsLocalizations.delegate,
];
/// A list of this localizations delegate's supported locales. /// A list of this localizations delegate's supported locales.
static const List<Locale> supportedLocales = <Locale>[ static const List<Locale> supportedLocales = <Locale>[
Locale('de'), Locale('de'),
Locale('en') Locale('en'),
]; ];
/// Label for all players list /// Label for all players list
@@ -756,7 +759,8 @@ abstract class AppLocalizations {
String get yesterday_at; String get yesterday_at;
} }
class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> { class _AppLocalizationsDelegate
extends LocalizationsDelegate<AppLocalizations> {
const _AppLocalizationsDelegate(); const _AppLocalizationsDelegate();
@override @override
@@ -765,25 +769,26 @@ class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations>
} }
@override @override
bool isSupported(Locale locale) => <String>['de', 'en'].contains(locale.languageCode); bool isSupported(Locale locale) =>
<String>['de', 'en'].contains(locale.languageCode);
@override @override
bool shouldReload(_AppLocalizationsDelegate old) => false; bool shouldReload(_AppLocalizationsDelegate old) => false;
} }
AppLocalizations lookupAppLocalizations(Locale locale) { AppLocalizations lookupAppLocalizations(Locale locale) {
// Lookup logic when only language code is specified. // Lookup logic when only language code is specified.
switch (locale.languageCode) { switch (locale.languageCode) {
case 'de': return AppLocalizationsDe(); case 'de':
case 'en': return AppLocalizationsEn(); return AppLocalizationsDe();
case 'en':
return AppLocalizationsEn();
} }
throw FlutterError( throw FlutterError(
'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely ' 'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
'an issue with the localizations generation tool. Please file an issue ' 'an issue with the localizations generation tool. Please file an issue '
'on GitHub with a reproducible sample app and the gen-l10n configuration ' 'on GitHub with a reproducible sample app and the gen-l10n configuration '
'that was used.' 'that was used.',
); );
} }

View File

@@ -97,13 +97,16 @@ class AppLocalizationsDe extends AppLocalizations {
String get enter_results => 'Ergebnisse eintragen'; String get enter_results => 'Ergebnisse eintragen';
@override @override
String get error_creating_group => 'Fehler beim Erstellen der Gruppe, bitte erneut versuchen'; String get error_creating_group =>
'Fehler beim Erstellen der Gruppe, bitte erneut versuchen';
@override @override
String get error_deleting_group => 'Fehler beim Löschen der Gruppe, bitte erneut versuchen'; String get error_deleting_group =>
'Fehler beim Löschen der Gruppe, bitte erneut versuchen';
@override @override
String get error_editing_group => 'Fehler beim Bearbeiten der Gruppe, bitte erneut versuchen'; String get error_editing_group =>
'Fehler beim Bearbeiten der Gruppe, bitte erneut versuchen';
@override @override
String get error_reading_file => 'Fehler beim Lesen der Datei'; String get error_reading_file => 'Fehler beim Lesen der Datei';
@@ -199,7 +202,8 @@ class AppLocalizationsDe extends AppLocalizations {
String get no_players_created_yet => 'Noch keine Spieler:in erstellt'; String get no_players_created_yet => 'Noch keine Spieler:in erstellt';
@override @override
String get no_players_found_with_that_name => 'Keine Spieler:in mit diesem Namen gefunden'; String get no_players_found_with_that_name =>
'Keine Spieler:in mit diesem Namen gefunden';
@override @override
String get no_players_selected => 'Keine Spieler:innen ausgewählt'; String get no_players_selected => 'Keine Spieler:innen ausgewählt';
@@ -258,16 +262,20 @@ class AppLocalizationsDe extends AppLocalizations {
String get ruleset => 'Regelwerk'; String get ruleset => 'Regelwerk';
@override @override
String get ruleset_least_points => 'Umgekehrte Wertung: Der/die Spieler:in mit den wenigsten Punkten gewinnt.'; String get ruleset_least_points =>
'Umgekehrte Wertung: Der/die Spieler:in mit den wenigsten Punkten gewinnt.';
@override @override
String get ruleset_most_points => 'Traditionelles Regelwerk: Der/die Spieler:in mit den meisten Punkten gewinnt.'; String get ruleset_most_points =>
'Traditionelles Regelwerk: Der/die Spieler:in mit den meisten Punkten gewinnt.';
@override @override
String get ruleset_single_loser => 'Genau ein:e Verlierer:in wird bestimmt; der letzte Platz erhält die Strafe oder Konsequenz.'; String get ruleset_single_loser =>
'Genau ein:e Verlierer:in wird bestimmt; der letzte Platz erhält die Strafe oder Konsequenz.';
@override @override
String get ruleset_single_winner => 'Genau ein:e Gewinner:in wird gewählt; Unentschieden werden durch einen vordefinierten Tie-Breaker aufgelöst.'; String get ruleset_single_winner =>
'Genau ein:e Gewinner:in wird gewählt; Unentschieden werden durch einen vordefinierten Tie-Breaker aufgelöst.';
@override @override
String get save_changes => 'Änderungen speichern'; String get save_changes => 'Änderungen speichern';
@@ -320,10 +328,12 @@ class AppLocalizationsDe extends AppLocalizations {
} }
@override @override
String get there_is_no_group_matching_your_search => 'Es gibt keine Gruppe, die deiner Suche entspricht'; String get there_is_no_group_matching_your_search =>
'Es gibt keine Gruppe, die deiner Suche entspricht';
@override @override
String get this_cannot_be_undone => 'Dies kann nicht rückgängig gemacht werden.'; String get this_cannot_be_undone =>
'Dies kann nicht rückgängig gemacht werden.';
@override @override
String get today_at => 'Heute um'; String get today_at => 'Heute um';

View File

@@ -97,13 +97,16 @@ class AppLocalizationsEn extends AppLocalizations {
String get enter_results => 'Enter Results'; String get enter_results => 'Enter Results';
@override @override
String get error_creating_group => 'Error while creating group, please try again'; String get error_creating_group =>
'Error while creating group, please try again';
@override @override
String get error_deleting_group => 'Error while deleting group, please try again'; String get error_deleting_group =>
'Error while deleting group, please try again';
@override @override
String get error_editing_group => 'Error while editing group, please try again'; String get error_editing_group =>
'Error while editing group, please try again';
@override @override
String get error_reading_file => 'Error reading file'; String get error_reading_file => 'Error reading file';
@@ -199,7 +202,8 @@ class AppLocalizationsEn extends AppLocalizations {
String get no_players_created_yet => 'No players created yet'; String get no_players_created_yet => 'No players created yet';
@override @override
String get no_players_found_with_that_name => 'No players found with that name'; String get no_players_found_with_that_name =>
'No players found with that name';
@override @override
String get no_players_selected => 'No players selected'; String get no_players_selected => 'No players selected';
@@ -258,16 +262,20 @@ class AppLocalizationsEn extends AppLocalizations {
String get ruleset => 'Ruleset'; String get ruleset => 'Ruleset';
@override @override
String get ruleset_least_points => 'Inverse scoring: the player with the fewest points wins.'; String get ruleset_least_points =>
'Inverse scoring: the player with the fewest points wins.';
@override @override
String get ruleset_most_points => 'Traditional ruleset: the player with the most points wins.'; String get ruleset_most_points =>
'Traditional ruleset: the player with the most points wins.';
@override @override
String get ruleset_single_loser => 'Exactly one loser is determined; last place receives the penalty or consequence.'; String get ruleset_single_loser =>
'Exactly one loser is determined; last place receives the penalty or consequence.';
@override @override
String get ruleset_single_winner => 'Exactly one winner is chosen; ties are resolved by a predefined tiebreaker.'; String get ruleset_single_winner =>
'Exactly one winner is chosen; ties are resolved by a predefined tiebreaker.';
@override @override
String get save_changes => 'Save Changes'; String get save_changes => 'Save Changes';
@@ -320,7 +328,8 @@ class AppLocalizationsEn extends AppLocalizations {
} }
@override @override
String get there_is_no_group_matching_your_search => 'There is no group matching your search'; String get there_is_no_group_matching_your_search =>
'There is no group matching your search';
@override @override
String get this_cannot_be_undone => 'This can\'t be undone.'; String get this_cannot_be_undone => 'This can\'t be undone.';

View File

@@ -79,6 +79,24 @@ class _MatchTileState extends State<MatchTile> {
], ],
), ),
const SizedBox(height: 4),
Container(
decoration: BoxDecoration(
color: CustomTheme.primaryColor,
borderRadius: BorderRadius.circular(8),
),
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 8),
child: Text(
translateRulesetToString(match.game.ruleset, context),
style: const TextStyle(
fontSize: 12,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
const SizedBox(height: 8), const SizedBox(height: 8),
if (group != null) ...[ if (group != null) ...[