From ddf32797aa240dc1e672fc6f8b2c8da53f2966b3 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Tue, 14 Apr 2026 23:26:26 +0200 Subject: [PATCH] Implemented ruleset in match view --- lib/l10n/generated/app_localizations.dart | 37 +++++++++++-------- lib/l10n/generated/app_localizations_de.dart | 30 ++++++++++----- lib/l10n/generated/app_localizations_en.dart | 27 +++++++++----- .../widgets/tiles/match_tile.dart | 18 +++++++++ 4 files changed, 77 insertions(+), 35 deletions(-) diff --git a/lib/l10n/generated/app_localizations.dart b/lib/l10n/generated/app_localizations.dart index 66d5b88..456a6fc 100644 --- a/lib/l10n/generated/app_localizations.dart +++ b/lib/l10n/generated/app_localizations.dart @@ -62,7 +62,8 @@ import 'app_localizations_en.dart'; /// be consistent with the languages listed in the AppLocalizations.supportedLocales /// property. abstract class AppLocalizations { - AppLocalizations(String locale) : localeName = intl.Intl.canonicalizedLocale(locale.toString()); + AppLocalizations(String locale) + : localeName = intl.Intl.canonicalizedLocale(locale.toString()); final String localeName; @@ -70,7 +71,8 @@ abstract class AppLocalizations { return Localizations.of(context, AppLocalizations)!; } - static const LocalizationsDelegate delegate = _AppLocalizationsDelegate(); + static const LocalizationsDelegate delegate = + _AppLocalizationsDelegate(); /// A list of this localizations delegate along with the default localizations /// delegates. @@ -82,17 +84,18 @@ abstract class AppLocalizations { /// 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 /// of delegates is preferred or required. - static const List> localizationsDelegates = >[ - delegate, - GlobalMaterialLocalizations.delegate, - GlobalCupertinoLocalizations.delegate, - GlobalWidgetsLocalizations.delegate, - ]; + static const List> localizationsDelegates = + >[ + delegate, + GlobalMaterialLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ]; /// A list of this localizations delegate's supported locales. static const List supportedLocales = [ Locale('de'), - Locale('en') + Locale('en'), ]; /// Label for all players list @@ -756,7 +759,8 @@ abstract class AppLocalizations { String get yesterday_at; } -class _AppLocalizationsDelegate extends LocalizationsDelegate { +class _AppLocalizationsDelegate + extends LocalizationsDelegate { const _AppLocalizationsDelegate(); @override @@ -765,25 +769,26 @@ class _AppLocalizationsDelegate extends LocalizationsDelegate } @override - bool isSupported(Locale locale) => ['de', 'en'].contains(locale.languageCode); + bool isSupported(Locale locale) => + ['de', 'en'].contains(locale.languageCode); @override bool shouldReload(_AppLocalizationsDelegate old) => false; } AppLocalizations lookupAppLocalizations(Locale locale) { - - // Lookup logic when only language code is specified. switch (locale.languageCode) { - case 'de': return AppLocalizationsDe(); - case 'en': return AppLocalizationsEn(); + case 'de': + return AppLocalizationsDe(); + case 'en': + return AppLocalizationsEn(); } throw FlutterError( 'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely ' 'an issue with the localizations generation tool. Please file an issue ' 'on GitHub with a reproducible sample app and the gen-l10n configuration ' - 'that was used.' + 'that was used.', ); } diff --git a/lib/l10n/generated/app_localizations_de.dart b/lib/l10n/generated/app_localizations_de.dart index 82c0081..a3a1b26 100644 --- a/lib/l10n/generated/app_localizations_de.dart +++ b/lib/l10n/generated/app_localizations_de.dart @@ -97,13 +97,16 @@ class AppLocalizationsDe extends AppLocalizations { String get enter_results => 'Ergebnisse eintragen'; @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 - 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 - 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 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'; @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 String get no_players_selected => 'Keine Spieler:innen ausgewählt'; @@ -258,16 +262,20 @@ class AppLocalizationsDe extends AppLocalizations { String get ruleset => 'Regelwerk'; @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 - 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 - 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 - 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 String get save_changes => 'Änderungen speichern'; @@ -320,10 +328,12 @@ class AppLocalizationsDe extends AppLocalizations { } @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 - 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 String get today_at => 'Heute um'; diff --git a/lib/l10n/generated/app_localizations_en.dart b/lib/l10n/generated/app_localizations_en.dart index cbbfb3c..61b8934 100644 --- a/lib/l10n/generated/app_localizations_en.dart +++ b/lib/l10n/generated/app_localizations_en.dart @@ -97,13 +97,16 @@ class AppLocalizationsEn extends AppLocalizations { String get enter_results => 'Enter Results'; @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 - 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 - 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 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'; @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 String get no_players_selected => 'No players selected'; @@ -258,16 +262,20 @@ class AppLocalizationsEn extends AppLocalizations { String get ruleset => 'Ruleset'; @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 - 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 - 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 - 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 String get save_changes => 'Save Changes'; @@ -320,7 +328,8 @@ class AppLocalizationsEn extends AppLocalizations { } @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 String get this_cannot_be_undone => 'This can\'t be undone.'; diff --git a/lib/presentation/widgets/tiles/match_tile.dart b/lib/presentation/widgets/tiles/match_tile.dart index 39f9cdf..4977b8e 100644 --- a/lib/presentation/widgets/tiles/match_tile.dart +++ b/lib/presentation/widgets/tiles/match_tile.dart @@ -79,6 +79,24 @@ class _MatchTileState extends State { ], ), + 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), if (group != null) ...[