Implement comprehensive localization framework with English and Finnish support
- Add flutter_localizations dependency and l10n configuration - Create ARB files for English (en) and Finnish (fi) translations - Localize UI strings across all major components: * Navigation drawer and page titles * Scoring interface (arrows per end, ruleset names) * Scorecard headers (End, Arrows, Sum of 3/6, Accumulative) * Keypad functional buttons (CLEAR/TYHJENNÄ, CLOSE/SULJE) * Settings page placeholder content * Dialog messages and confirmation prompts - Preserve universal archery scoring notation (X, 10, 9, M remain unlocalised) - Use authentic Finnish archery terminology throughout - Configure main app with proper localization delegates and supported locales - Generate localization classes automatically via flutter_localizations 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
# Flutter localization configuration
|
||||||
|
arb-dir: lib/config/localization
|
||||||
|
template-arb-file: app_en.arb
|
||||||
|
output-localization-file: app_localizations.dart
|
||||||
|
output-class: AppLocalizations
|
||||||
|
output-dir: lib/config/localization/generated
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
{
|
||||||
|
"@@locale": "en",
|
||||||
|
|
||||||
|
"appTitle": "Archery Bookkeeper",
|
||||||
|
"appVersion": "Alpha 0.1",
|
||||||
|
|
||||||
|
"navMainScorer": "Main (Scorer)",
|
||||||
|
"navSettings": "Settings",
|
||||||
|
|
||||||
|
"arrowsPerEnd": "Arrows per end",
|
||||||
|
"ruleset": "Ruleset",
|
||||||
|
"rulesetIndoor": "Indoor",
|
||||||
|
"rulesetOutdoor": "Outdoor",
|
||||||
|
"endsCount": "{count} ends",
|
||||||
|
"@endsCount": {
|
||||||
|
"placeholders": {
|
||||||
|
"count": {
|
||||||
|
"type": "int",
|
||||||
|
"example": "10"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"headerEnd": "End",
|
||||||
|
"headerArrows": "Arrows",
|
||||||
|
"headerSumOf3": "Sum of 3",
|
||||||
|
"headerSumOf6": "Sum of 6",
|
||||||
|
"headerAccumulative": "Accumulative",
|
||||||
|
"headerXCount": "X",
|
||||||
|
"header10Count": "10",
|
||||||
|
"header9Count": "9",
|
||||||
|
"scoreTotal": "Total",
|
||||||
|
|
||||||
|
"keypadClear": "CLEAR",
|
||||||
|
"keypadClose": "CLOSE",
|
||||||
|
|
||||||
|
"dialogClearScoresTitle": "Clear scores",
|
||||||
|
"dialogClearScoresMessage": "This will clear all scores for the current session. Continue?",
|
||||||
|
"dialogArrowChangeTitle": "Change arrow count",
|
||||||
|
"dialogArrowChangeMessage": "Changing arrow count will clear existing scores. Continue?",
|
||||||
|
"dialogPreserveScores": "Preserve existing scores when possible?",
|
||||||
|
"dialogCancel": "Cancel",
|
||||||
|
"dialogContinue": "Continue",
|
||||||
|
"dialogYes": "Yes",
|
||||||
|
"dialogNo": "No",
|
||||||
|
|
||||||
|
"settingsTitle": "Settings",
|
||||||
|
"settingsAppearance": "Appearance",
|
||||||
|
"settingsScoring": "Scoring",
|
||||||
|
"settingsExport": "Export",
|
||||||
|
"settingsAbout": "About",
|
||||||
|
|
||||||
|
"settingsPlaceholder": "This is a placeholder settings page.",
|
||||||
|
"settingsFutureWillInclude": "Future settings will include:",
|
||||||
|
"settingsColorScheme": "• Color scheme preferences",
|
||||||
|
"settingsDefaultArrows": "• Default arrow counts",
|
||||||
|
"settingsScoreInput": "• Score input preferences",
|
||||||
|
"settingsExportOptions": "• Export settings",
|
||||||
|
"settingsSessionManagement": "• Session management",
|
||||||
|
|
||||||
|
"dialogKeepScoresTitle": "Keep scores?",
|
||||||
|
|
||||||
|
"devTodoLocalization": "REPLACE ALL THESE TEXTS WITH LOCALISATION MARKERS!!"
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
{
|
||||||
|
"@@locale": "fi",
|
||||||
|
|
||||||
|
"appTitle": "Jousiammunnan tuloskirja",
|
||||||
|
"appVersion": "Alpha 0.1",
|
||||||
|
|
||||||
|
"navMainScorer": "Pääsivu (Tuloslaskuri)",
|
||||||
|
"navSettings": "Asetukset",
|
||||||
|
|
||||||
|
"arrowsPerEnd": "Nuolia per päätös",
|
||||||
|
"ruleset": "Sääntökokoelma",
|
||||||
|
"rulesetIndoor": "Sisärata",
|
||||||
|
"rulesetOutdoor": "Ulkorata",
|
||||||
|
"endsCount": "{count} päätöstä",
|
||||||
|
"@endsCount": {
|
||||||
|
"placeholders": {
|
||||||
|
"count": {
|
||||||
|
"type": "int",
|
||||||
|
"example": "10"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"headerEnd": "Päätös",
|
||||||
|
"headerArrows": "Nuolet",
|
||||||
|
"headerSumOf3": "Summa 3",
|
||||||
|
"headerSumOf6": "Summa 6",
|
||||||
|
"headerAccumulative": "Yhteensä",
|
||||||
|
"headerXCount": "X",
|
||||||
|
"header10Count": "10",
|
||||||
|
"header9Count": "9",
|
||||||
|
"scoreTotal": "Yhteensä",
|
||||||
|
|
||||||
|
"keypadClear": "TYHJENNÄ",
|
||||||
|
"keypadClose": "SULJE",
|
||||||
|
|
||||||
|
"dialogClearScoresTitle": "Tyhjennä pisteet",
|
||||||
|
"dialogClearScoresMessage": "Tämä tyhjentää kaikki pisteet nykyiseltä kierrokselta. Jatka?",
|
||||||
|
"dialogArrowChangeTitle": "Muuta nuolien määrää",
|
||||||
|
"dialogArrowChangeMessage": "Nuolien määrän muuttaminen tyhjentää olemassa olevat pisteet. Jatka?",
|
||||||
|
"dialogPreserveScores": "Säilytetäänkö olemassa olevat pisteet mahdollisuuksien mukaan?",
|
||||||
|
"dialogCancel": "Peruuta",
|
||||||
|
"dialogContinue": "Jatka",
|
||||||
|
"dialogYes": "Kyllä",
|
||||||
|
"dialogNo": "Ei",
|
||||||
|
|
||||||
|
"settingsTitle": "Asetukset",
|
||||||
|
"settingsAppearance": "Ulkoasu",
|
||||||
|
"settingsScoring": "Pisteidenlasku",
|
||||||
|
"settingsExport": "Vienti",
|
||||||
|
"settingsAbout": "Tietoja",
|
||||||
|
|
||||||
|
"settingsPlaceholder": "Tämä on väliaikainen asetukset-sivu.",
|
||||||
|
"settingsFutureWillInclude": "Tulevat asetukset sisältävät:",
|
||||||
|
"settingsColorScheme": "• Väriteeman asetukset",
|
||||||
|
"settingsDefaultArrows": "• Nuolien oletusmäärät",
|
||||||
|
"settingsScoreInput": "• Pisteidenluonnin asetukset",
|
||||||
|
"settingsExportOptions": "• Vientiasetukset",
|
||||||
|
"settingsSessionManagement": "• Istunnon hallinta",
|
||||||
|
|
||||||
|
"dialogKeepScoresTitle": "Säilytetäänkö pisteet?",
|
||||||
|
|
||||||
|
"devTodoLocalization": "KORVAA KAIKKI NÄMÄ TEKSTIT LOKALISOINTIMERKINNÖILLÄ!!"
|
||||||
|
}
|
||||||
@@ -0,0 +1,392 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||||
|
import 'package:intl/intl.dart' as intl;
|
||||||
|
|
||||||
|
import 'app_localizations_en.dart';
|
||||||
|
import 'app_localizations_fi.dart';
|
||||||
|
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
|
||||||
|
/// Callers can lookup localized strings with an instance of AppLocalizations
|
||||||
|
/// returned by `AppLocalizations.of(context)`.
|
||||||
|
///
|
||||||
|
/// Applications need to include `AppLocalizations.delegate()` in their app's
|
||||||
|
/// `localizationDelegates` list, and the locales they support in the app's
|
||||||
|
/// `supportedLocales` list. For example:
|
||||||
|
///
|
||||||
|
/// ```dart
|
||||||
|
/// import 'generated/app_localizations.dart';
|
||||||
|
///
|
||||||
|
/// return MaterialApp(
|
||||||
|
/// localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||||
|
/// supportedLocales: AppLocalizations.supportedLocales,
|
||||||
|
/// home: MyApplicationHome(),
|
||||||
|
/// );
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// ## Update pubspec.yaml
|
||||||
|
///
|
||||||
|
/// Please make sure to update your pubspec.yaml to include the following
|
||||||
|
/// packages:
|
||||||
|
///
|
||||||
|
/// ```yaml
|
||||||
|
/// dependencies:
|
||||||
|
/// # Internationalization support.
|
||||||
|
/// flutter_localizations:
|
||||||
|
/// sdk: flutter
|
||||||
|
/// intl: any # Use the pinned version from flutter_localizations
|
||||||
|
///
|
||||||
|
/// # Rest of dependencies
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// ## iOS Applications
|
||||||
|
///
|
||||||
|
/// iOS applications define key application metadata, including supported
|
||||||
|
/// locales, in an Info.plist file that is built into the application bundle.
|
||||||
|
/// To configure the locales supported by your app, you’ll need to edit this
|
||||||
|
/// file.
|
||||||
|
///
|
||||||
|
/// First, open your project’s ios/Runner.xcworkspace Xcode workspace file.
|
||||||
|
/// Then, in the Project Navigator, open the Info.plist file under the Runner
|
||||||
|
/// project’s Runner folder.
|
||||||
|
///
|
||||||
|
/// Next, select the Information Property List item, select Add Item from the
|
||||||
|
/// Editor menu, then select Localizations from the pop-up menu.
|
||||||
|
///
|
||||||
|
/// Select and expand the newly-created Localizations item then, for each
|
||||||
|
/// locale your application supports, add a new item and select the locale
|
||||||
|
/// you wish to add from the pop-up menu in the Value field. This list should
|
||||||
|
/// be consistent with the languages listed in the AppLocalizations.supportedLocales
|
||||||
|
/// property.
|
||||||
|
abstract class AppLocalizations {
|
||||||
|
AppLocalizations(String locale)
|
||||||
|
: localeName = intl.Intl.canonicalizedLocale(locale.toString());
|
||||||
|
|
||||||
|
final String localeName;
|
||||||
|
|
||||||
|
static AppLocalizations? of(BuildContext context) {
|
||||||
|
return Localizations.of<AppLocalizations>(context, AppLocalizations);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const LocalizationsDelegate<AppLocalizations> delegate =
|
||||||
|
_AppLocalizationsDelegate();
|
||||||
|
|
||||||
|
/// A list of this localizations delegate along with the default localizations
|
||||||
|
/// delegates.
|
||||||
|
///
|
||||||
|
/// Returns a list of localizations delegates containing this delegate along with
|
||||||
|
/// GlobalMaterialLocalizations.delegate, GlobalCupertinoLocalizations.delegate,
|
||||||
|
/// and GlobalWidgetsLocalizations.delegate.
|
||||||
|
///
|
||||||
|
/// 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<LocalizationsDelegate<dynamic>> localizationsDelegates =
|
||||||
|
<LocalizationsDelegate<dynamic>>[
|
||||||
|
delegate,
|
||||||
|
GlobalMaterialLocalizations.delegate,
|
||||||
|
GlobalCupertinoLocalizations.delegate,
|
||||||
|
GlobalWidgetsLocalizations.delegate,
|
||||||
|
];
|
||||||
|
|
||||||
|
/// A list of this localizations delegate's supported locales.
|
||||||
|
static const List<Locale> supportedLocales = <Locale>[
|
||||||
|
Locale('en'),
|
||||||
|
Locale('fi'),
|
||||||
|
];
|
||||||
|
|
||||||
|
/// No description provided for @appTitle.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Archery Bookkeeper'**
|
||||||
|
String get appTitle;
|
||||||
|
|
||||||
|
/// No description provided for @appVersion.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Alpha 0.1'**
|
||||||
|
String get appVersion;
|
||||||
|
|
||||||
|
/// No description provided for @navMainScorer.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Main (Scorer)'**
|
||||||
|
String get navMainScorer;
|
||||||
|
|
||||||
|
/// No description provided for @navSettings.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Settings'**
|
||||||
|
String get navSettings;
|
||||||
|
|
||||||
|
/// No description provided for @arrowsPerEnd.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Arrows per end'**
|
||||||
|
String get arrowsPerEnd;
|
||||||
|
|
||||||
|
/// No description provided for @ruleset.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Ruleset'**
|
||||||
|
String get ruleset;
|
||||||
|
|
||||||
|
/// No description provided for @rulesetIndoor.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Indoor'**
|
||||||
|
String get rulesetIndoor;
|
||||||
|
|
||||||
|
/// No description provided for @rulesetOutdoor.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Outdoor'**
|
||||||
|
String get rulesetOutdoor;
|
||||||
|
|
||||||
|
/// No description provided for @endsCount.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'{count} ends'**
|
||||||
|
String endsCount(int count);
|
||||||
|
|
||||||
|
/// No description provided for @headerEnd.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'End'**
|
||||||
|
String get headerEnd;
|
||||||
|
|
||||||
|
/// No description provided for @headerArrows.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Arrows'**
|
||||||
|
String get headerArrows;
|
||||||
|
|
||||||
|
/// No description provided for @headerSumOf3.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Sum of 3'**
|
||||||
|
String get headerSumOf3;
|
||||||
|
|
||||||
|
/// No description provided for @headerSumOf6.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Sum of 6'**
|
||||||
|
String get headerSumOf6;
|
||||||
|
|
||||||
|
/// No description provided for @headerAccumulative.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Accumulative'**
|
||||||
|
String get headerAccumulative;
|
||||||
|
|
||||||
|
/// No description provided for @headerXCount.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'X'**
|
||||||
|
String get headerXCount;
|
||||||
|
|
||||||
|
/// No description provided for @header10Count.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'10'**
|
||||||
|
String get header10Count;
|
||||||
|
|
||||||
|
/// No description provided for @header9Count.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'9'**
|
||||||
|
String get header9Count;
|
||||||
|
|
||||||
|
/// No description provided for @scoreTotal.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Total'**
|
||||||
|
String get scoreTotal;
|
||||||
|
|
||||||
|
/// No description provided for @keypadClear.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'CLEAR'**
|
||||||
|
String get keypadClear;
|
||||||
|
|
||||||
|
/// No description provided for @keypadClose.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'CLOSE'**
|
||||||
|
String get keypadClose;
|
||||||
|
|
||||||
|
/// No description provided for @dialogClearScoresTitle.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Clear scores'**
|
||||||
|
String get dialogClearScoresTitle;
|
||||||
|
|
||||||
|
/// No description provided for @dialogClearScoresMessage.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'This will clear all scores for the current session. Continue?'**
|
||||||
|
String get dialogClearScoresMessage;
|
||||||
|
|
||||||
|
/// No description provided for @dialogArrowChangeTitle.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Change arrow count'**
|
||||||
|
String get dialogArrowChangeTitle;
|
||||||
|
|
||||||
|
/// No description provided for @dialogArrowChangeMessage.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Changing arrow count will clear existing scores. Continue?'**
|
||||||
|
String get dialogArrowChangeMessage;
|
||||||
|
|
||||||
|
/// No description provided for @dialogPreserveScores.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Preserve existing scores when possible?'**
|
||||||
|
String get dialogPreserveScores;
|
||||||
|
|
||||||
|
/// No description provided for @dialogCancel.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Cancel'**
|
||||||
|
String get dialogCancel;
|
||||||
|
|
||||||
|
/// No description provided for @dialogContinue.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Continue'**
|
||||||
|
String get dialogContinue;
|
||||||
|
|
||||||
|
/// No description provided for @dialogYes.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Yes'**
|
||||||
|
String get dialogYes;
|
||||||
|
|
||||||
|
/// No description provided for @dialogNo.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'No'**
|
||||||
|
String get dialogNo;
|
||||||
|
|
||||||
|
/// No description provided for @settingsTitle.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Settings'**
|
||||||
|
String get settingsTitle;
|
||||||
|
|
||||||
|
/// No description provided for @settingsAppearance.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Appearance'**
|
||||||
|
String get settingsAppearance;
|
||||||
|
|
||||||
|
/// No description provided for @settingsScoring.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Scoring'**
|
||||||
|
String get settingsScoring;
|
||||||
|
|
||||||
|
/// No description provided for @settingsExport.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Export'**
|
||||||
|
String get settingsExport;
|
||||||
|
|
||||||
|
/// No description provided for @settingsAbout.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'About'**
|
||||||
|
String get settingsAbout;
|
||||||
|
|
||||||
|
/// No description provided for @settingsPlaceholder.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'This is a placeholder settings page.'**
|
||||||
|
String get settingsPlaceholder;
|
||||||
|
|
||||||
|
/// No description provided for @settingsFutureWillInclude.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Future settings will include:'**
|
||||||
|
String get settingsFutureWillInclude;
|
||||||
|
|
||||||
|
/// No description provided for @settingsColorScheme.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'• Color scheme preferences'**
|
||||||
|
String get settingsColorScheme;
|
||||||
|
|
||||||
|
/// No description provided for @settingsDefaultArrows.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'• Default arrow counts'**
|
||||||
|
String get settingsDefaultArrows;
|
||||||
|
|
||||||
|
/// No description provided for @settingsScoreInput.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'• Score input preferences'**
|
||||||
|
String get settingsScoreInput;
|
||||||
|
|
||||||
|
/// No description provided for @settingsExportOptions.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'• Export settings'**
|
||||||
|
String get settingsExportOptions;
|
||||||
|
|
||||||
|
/// No description provided for @settingsSessionManagement.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'• Session management'**
|
||||||
|
String get settingsSessionManagement;
|
||||||
|
|
||||||
|
/// No description provided for @dialogKeepScoresTitle.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'Keep scores?'**
|
||||||
|
String get dialogKeepScoresTitle;
|
||||||
|
|
||||||
|
/// No description provided for @devTodoLocalization.
|
||||||
|
///
|
||||||
|
/// In en, this message translates to:
|
||||||
|
/// **'REPLACE ALL THESE TEXTS WITH LOCALISATION MARKERS!!'**
|
||||||
|
String get devTodoLocalization;
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AppLocalizationsDelegate
|
||||||
|
extends LocalizationsDelegate<AppLocalizations> {
|
||||||
|
const _AppLocalizationsDelegate();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<AppLocalizations> load(Locale locale) {
|
||||||
|
return SynchronousFuture<AppLocalizations>(lookupAppLocalizations(locale));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool isSupported(Locale locale) =>
|
||||||
|
<String>['en', 'fi'].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 'en':
|
||||||
|
return AppLocalizationsEn();
|
||||||
|
case 'fi':
|
||||||
|
return AppLocalizationsFi();
|
||||||
|
}
|
||||||
|
|
||||||
|
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.',
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
// ignore: unused_import
|
||||||
|
import 'package:intl/intl.dart' as intl;
|
||||||
|
import 'app_localizations.dart';
|
||||||
|
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
|
||||||
|
/// The translations for English (`en`).
|
||||||
|
class AppLocalizationsEn extends AppLocalizations {
|
||||||
|
AppLocalizationsEn([String locale = 'en']) : super(locale);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get appTitle => 'Archery Bookkeeper';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get appVersion => 'Alpha 0.1';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get navMainScorer => 'Main (Scorer)';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get navSettings => 'Settings';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get arrowsPerEnd => 'Arrows per end';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get ruleset => 'Ruleset';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get rulesetIndoor => 'Indoor';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get rulesetOutdoor => 'Outdoor';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String endsCount(int count) {
|
||||||
|
return '$count ends';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get headerEnd => 'End';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get headerArrows => 'Arrows';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get headerSumOf3 => 'Sum of 3';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get headerSumOf6 => 'Sum of 6';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get headerAccumulative => 'Accumulative';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get headerXCount => 'X';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get header10Count => '10';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get header9Count => '9';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get scoreTotal => 'Total';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get keypadClear => 'CLEAR';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get keypadClose => 'CLOSE';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get dialogClearScoresTitle => 'Clear scores';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get dialogClearScoresMessage =>
|
||||||
|
'This will clear all scores for the current session. Continue?';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get dialogArrowChangeTitle => 'Change arrow count';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get dialogArrowChangeMessage =>
|
||||||
|
'Changing arrow count will clear existing scores. Continue?';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get dialogPreserveScores => 'Preserve existing scores when possible?';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get dialogCancel => 'Cancel';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get dialogContinue => 'Continue';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get dialogYes => 'Yes';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get dialogNo => 'No';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settingsTitle => 'Settings';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settingsAppearance => 'Appearance';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settingsScoring => 'Scoring';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settingsExport => 'Export';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settingsAbout => 'About';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settingsPlaceholder => 'This is a placeholder settings page.';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settingsFutureWillInclude => 'Future settings will include:';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settingsColorScheme => '• Color scheme preferences';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settingsDefaultArrows => '• Default arrow counts';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settingsScoreInput => '• Score input preferences';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settingsExportOptions => '• Export settings';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settingsSessionManagement => '• Session management';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get dialogKeepScoresTitle => 'Keep scores?';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get devTodoLocalization =>
|
||||||
|
'REPLACE ALL THESE TEXTS WITH LOCALISATION MARKERS!!';
|
||||||
|
}
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
// ignore: unused_import
|
||||||
|
import 'package:intl/intl.dart' as intl;
|
||||||
|
import 'app_localizations.dart';
|
||||||
|
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
|
||||||
|
/// The translations for Finnish (`fi`).
|
||||||
|
class AppLocalizationsFi extends AppLocalizations {
|
||||||
|
AppLocalizationsFi([String locale = 'fi']) : super(locale);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get appTitle => 'Jousiammunnan tuloskirja';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get appVersion => 'Alpha 0.1';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get navMainScorer => 'Pääsivu (Tuloslaskuri)';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get navSettings => 'Asetukset';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get arrowsPerEnd => 'Nuolia per päätös';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get ruleset => 'Sääntökokoelma';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get rulesetIndoor => 'Sisärata';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get rulesetOutdoor => 'Ulkorata';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String endsCount(int count) {
|
||||||
|
return '$count päätöstä';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get headerEnd => 'Päätös';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get headerArrows => 'Nuolet';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get headerSumOf3 => 'Summa 3';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get headerSumOf6 => 'Summa 6';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get headerAccumulative => 'Yhteensä';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get headerXCount => 'X';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get header10Count => '10';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get header9Count => '9';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get scoreTotal => 'Yhteensä';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get keypadClear => 'TYHJENNÄ';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get keypadClose => 'SULJE';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get dialogClearScoresTitle => 'Tyhjennä pisteet';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get dialogClearScoresMessage =>
|
||||||
|
'Tämä tyhjentää kaikki pisteet nykyiseltä kierrokselta. Jatka?';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get dialogArrowChangeTitle => 'Muuta nuolien määrää';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get dialogArrowChangeMessage =>
|
||||||
|
'Nuolien määrän muuttaminen tyhjentää olemassa olevat pisteet. Jatka?';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get dialogPreserveScores =>
|
||||||
|
'Säilytetäänkö olemassa olevat pisteet mahdollisuuksien mukaan?';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get dialogCancel => 'Peruuta';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get dialogContinue => 'Jatka';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get dialogYes => 'Kyllä';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get dialogNo => 'Ei';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settingsTitle => 'Asetukset';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settingsAppearance => 'Ulkoasu';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settingsScoring => 'Pisteidenlasku';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settingsExport => 'Vienti';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settingsAbout => 'Tietoja';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settingsPlaceholder => 'Tämä on väliaikainen asetukset-sivu.';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settingsFutureWillInclude => 'Tulevat asetukset sisältävät:';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settingsColorScheme => '• Väriteeman asetukset';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settingsDefaultArrows => '• Nuolien oletusmäärät';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settingsScoreInput => '• Pisteidenluonnin asetukset';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settingsExportOptions => '• Vientiasetukset';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get settingsSessionManagement => '• Istunnon hallinta';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get dialogKeepScoresTitle => 'Säilytetäänkö pisteet?';
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get devTodoLocalization =>
|
||||||
|
'KORVAA KAIKKI NÄMÄ TEKSTIT LOKALISOINTIMERKINNÖILLÄ!!';
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||||
|
import 'config/localization/generated/app_localizations.dart';
|
||||||
import 'presentation/pages/main_navigation_page.dart';
|
import 'presentation/pages/main_navigation_page.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
@@ -12,6 +14,19 @@ class ArcheryScorerApp extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
title: 'Archery scorer',
|
title: 'Archery scorer',
|
||||||
|
|
||||||
|
// Localization configuration
|
||||||
|
localizationsDelegates: const [
|
||||||
|
AppLocalizations.delegate,
|
||||||
|
GlobalMaterialLocalizations.delegate,
|
||||||
|
GlobalWidgetsLocalizations.delegate,
|
||||||
|
GlobalCupertinoLocalizations.delegate,
|
||||||
|
],
|
||||||
|
supportedLocales: const [
|
||||||
|
Locale('en', ''),
|
||||||
|
Locale('fi', ''),
|
||||||
|
],
|
||||||
|
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
colorScheme: ColorScheme.fromSeed(
|
colorScheme: ColorScheme.fromSeed(
|
||||||
seedColor: Colors.green,
|
seedColor: Colors.green,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import '../../config/localization/generated/app_localizations.dart';
|
||||||
import 'scoring_page.dart';
|
import 'scoring_page.dart';
|
||||||
import 'settings_page.dart';
|
import 'settings_page.dart';
|
||||||
|
|
||||||
@@ -56,9 +57,9 @@ class _MainNavigationPageState extends State<MainNavigationPage> {
|
|||||||
const SettingsPage(),
|
const SettingsPage(),
|
||||||
];
|
];
|
||||||
|
|
||||||
final List<String> _pageTitles = [
|
List<String> _getPageTitles(BuildContext context) => [
|
||||||
'Main (Scorer)',
|
AppLocalizations.of(context)!.navMainScorer,
|
||||||
'Settings',
|
AppLocalizations.of(context)!.navSettings,
|
||||||
];
|
];
|
||||||
|
|
||||||
void _onNavigationItemSelected(int index) {
|
void _onNavigationItemSelected(int index) {
|
||||||
@@ -70,9 +71,12 @@ class _MainNavigationPageState extends State<MainNavigationPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final l10n = AppLocalizations.of(context)!;
|
||||||
|
final pageTitles = _getPageTitles(context);
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(_pageTitles[_selectedIndex]),
|
title: Text(pageTitles[_selectedIndex]),
|
||||||
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
||||||
),
|
),
|
||||||
body: _pages[_selectedIndex],
|
body: _pages[_selectedIndex],
|
||||||
@@ -84,22 +88,22 @@ class _MainNavigationPageState extends State<MainNavigationPage> {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context).colorScheme.inversePrimary,
|
color: Theme.of(context).colorScheme.inversePrimary,
|
||||||
),
|
),
|
||||||
child: const Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'Archery Bookkeeper',
|
l10n.appTitle,
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 24,
|
fontSize: 24,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Text(
|
Text(
|
||||||
'Alpha 0.1',
|
l10n.appVersion,
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.white70,
|
color: Colors.white70,
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
),
|
),
|
||||||
@@ -109,22 +113,22 @@ class _MainNavigationPageState extends State<MainNavigationPage> {
|
|||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.sports),
|
leading: const Icon(Icons.sports),
|
||||||
title: const Text('Main (Scorer)'),
|
title: Text(l10n.navMainScorer),
|
||||||
selected: _selectedIndex == 0,
|
selected: _selectedIndex == 0,
|
||||||
onTap: () => _onNavigationItemSelected(0),
|
onTap: () => _onNavigationItemSelected(0),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.settings),
|
leading: const Icon(Icons.settings),
|
||||||
title: const Text('Settings'),
|
title: Text(l10n.navSettings),
|
||||||
selected: _selectedIndex == 1,
|
selected: _selectedIndex == 1,
|
||||||
onTap: () => _onNavigationItemSelected(1),
|
onTap: () => _onNavigationItemSelected(1),
|
||||||
),
|
),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
const Padding(
|
Padding(
|
||||||
padding: EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
'REPLACE ALL THESE TEXTS WITH LOCALISATION MARKERS!!',
|
l10n.devTodoLocalization,
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import '../../config/localization/generated/app_localizations.dart';
|
||||||
import '../widgets/scoring_grid/scoring_grid.dart';
|
import '../widgets/scoring_grid/scoring_grid.dart';
|
||||||
import '../widgets/scoring_grid/scoring_keypad.dart';
|
import '../widgets/scoring_grid/scoring_keypad.dart';
|
||||||
import '../widgets/common/toggle_switches.dart';
|
import '../widgets/common/toggle_switches.dart';
|
||||||
@@ -87,16 +88,17 @@ class _ScoringPageState extends State<ScoringPage> with SingleTickerProviderStat
|
|||||||
final bool? keepScores = await showDialog<bool>(
|
final bool? keepScores = await showDialog<bool>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
|
final l10n = AppLocalizations.of(context)!;
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text('Keep scores?'),
|
title: Text(l10n.dialogKeepScoresTitle),
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => Navigator.of(context).pop(false),
|
onPressed: () => Navigator.of(context).pop(false),
|
||||||
child: const Text('No'),
|
child: Text(l10n.dialogNo),
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => Navigator.of(context).pop(true),
|
onPressed: () => Navigator.of(context).pop(true),
|
||||||
child: const Text('Yes'),
|
child: Text(l10n.dialogYes),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,49 +1,52 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import '../../config/localization/generated/app_localizations.dart';
|
||||||
|
|
||||||
class SettingsPage extends StatelessWidget {
|
class SettingsPage extends StatelessWidget {
|
||||||
const SettingsPage({super.key});
|
const SettingsPage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final l10n = AppLocalizations.of(context)!;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('Settings'),
|
title: Text(l10n.settingsTitle),
|
||||||
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
||||||
),
|
),
|
||||||
body: const Padding(
|
body: Padding(
|
||||||
padding: EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'Settings',
|
l10n.settingsTitle,
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 24,
|
fontSize: 24,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
Text(
|
Text(
|
||||||
'This is a placeholder settings page.',
|
l10n.settingsPlaceholder,
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
Text(
|
Text(
|
||||||
'Future settings will include:',
|
l10n.settingsFutureWillInclude,
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Text('• Color scheme preferences'),
|
Text(l10n.settingsColorScheme),
|
||||||
Text('• Default arrow counts'),
|
Text(l10n.settingsDefaultArrows),
|
||||||
Text('• Score input preferences'),
|
Text(l10n.settingsScoreInput),
|
||||||
Text('• Export settings'),
|
Text(l10n.settingsExportOptions),
|
||||||
Text('• Session management'),
|
Text(l10n.settingsSessionManagement),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import '../../../config/localization/generated/app_localizations.dart';
|
||||||
|
|
||||||
class ToggleSwitches extends StatelessWidget {
|
class ToggleSwitches extends StatelessWidget {
|
||||||
final int arrowsPerEnd;
|
final int arrowsPerEnd;
|
||||||
@@ -15,18 +16,21 @@ class ToggleSwitches extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final l10n = AppLocalizations.of(context)!;
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: [
|
children: [
|
||||||
_buildToggleGroup(
|
_buildToggleGroup(
|
||||||
'Arrows per end',
|
context,
|
||||||
|
l10n.arrowsPerEnd,
|
||||||
[3, 6],
|
[3, 6],
|
||||||
arrowsPerEnd,
|
arrowsPerEnd,
|
||||||
onArrowsPerEndChanged,
|
onArrowsPerEndChanged,
|
||||||
),
|
),
|
||||||
_buildRulesetInfo(),
|
_buildRulesetInfo(context),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -34,6 +38,7 @@ class ToggleSwitches extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildToggleGroup(
|
Widget _buildToggleGroup(
|
||||||
|
BuildContext context,
|
||||||
String label,
|
String label,
|
||||||
List<int> options,
|
List<int> options,
|
||||||
int currentValue,
|
int currentValue,
|
||||||
@@ -66,12 +71,14 @@ class ToggleSwitches extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildRulesetInfo() {
|
Widget _buildRulesetInfo(BuildContext context) {
|
||||||
final rulesetName = arrowsPerEnd == 3 ? 'Indoor' : 'Outdoor';
|
final l10n = AppLocalizations.of(context)!;
|
||||||
|
final rulesetName = arrowsPerEnd == 3 ? l10n.rulesetIndoor : l10n.rulesetOutdoor;
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'Ruleset',
|
l10n.ruleset,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
@@ -95,7 +102,7 @@ class ToggleSwitches extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'$endsPerSet ends',
|
l10n.endsCount(endsPerSet),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: Colors.blue.shade600,
|
color: Colors.blue.shade600,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'scoring_cell.dart';
|
import 'scoring_cell.dart';
|
||||||
import '../../../config/constants/scoring_colors.dart';
|
import '../../../config/constants/scoring_colors.dart';
|
||||||
|
import '../../../config/localization/generated/app_localizations.dart';
|
||||||
|
|
||||||
class ScoringGrid extends StatelessWidget {
|
class ScoringGrid extends StatelessWidget {
|
||||||
final List<List<String>> scores;
|
final List<List<String>> scores;
|
||||||
@@ -139,6 +140,8 @@ class ScoringGrid extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final l10n = AppLocalizations.of(context)!;
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(color: Colors.grey.shade400),
|
border: Border.all(color: Colors.grey.shade400),
|
||||||
@@ -161,7 +164,7 @@ class ScoringGrid extends StatelessWidget {
|
|||||||
// End column: ~13% (50/395)
|
// End column: ~13% (50/395)
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 13,
|
flex: 13,
|
||||||
child: Center(child: Text('End\\Shot', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 12))),
|
child: Center(child: Text(l10n.headerEnd, style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 12))),
|
||||||
),
|
),
|
||||||
// Arrow columns: ~42% (165/395)
|
// Arrow columns: ~42% (165/395)
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -173,7 +176,7 @@ class ScoringGrid extends StatelessWidget {
|
|||||||
color: Colors.blue.shade100,
|
color: Colors.blue.shade100,
|
||||||
borderRadius: BorderRadius.circular(4),
|
borderRadius: BorderRadius.circular(4),
|
||||||
),
|
),
|
||||||
child: const Text('Arrows', style: TextStyle(fontWeight: FontWeight.bold)),
|
child: Text(l10n.headerArrows, style: const TextStyle(fontWeight: FontWeight.bold)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -182,7 +185,7 @@ class ScoringGrid extends StatelessWidget {
|
|||||||
flex: 14,
|
flex: 14,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
'Sum of 3',
|
l10n.headerSumOf3,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
@@ -196,7 +199,7 @@ class ScoringGrid extends StatelessWidget {
|
|||||||
flex: 14,
|
flex: 14,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
'Sum of 6',
|
l10n.headerSumOf6,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
@@ -207,7 +210,7 @@ class ScoringGrid extends StatelessWidget {
|
|||||||
// Accumulative: ~17% (70/395)
|
// Accumulative: ~17% (70/395)
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 17,
|
flex: 17,
|
||||||
child: Center(child: Text('Accumulative', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 12))),
|
child: Center(child: Text(l10n.headerAccumulative, style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 12))),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -410,14 +413,15 @@ class ScoringGrid extends StatelessWidget {
|
|||||||
top: BorderSide(color: Colors.grey.shade400, width: 2),
|
top: BorderSide(color: Colors.grey.shade400, width: 2),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: _buildCountingSection(),
|
child: _buildCountingSection(context),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildCountingSection() {
|
Widget _buildCountingSection(BuildContext context) {
|
||||||
|
final l10n = AppLocalizations.of(context)!;
|
||||||
final counts = _calculateXAndTenCounts();
|
final counts = _calculateXAndTenCounts();
|
||||||
final finalScore = _calculateAccumulative(scores.length - 1);
|
final finalScore = _calculateAccumulative(scores.length - 1);
|
||||||
|
|
||||||
@@ -494,7 +498,7 @@ class ScoringGrid extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
const Text('Final score', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16)),
|
Text(l10n.scoreTotal, style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 16)),
|
||||||
Text(
|
Text(
|
||||||
finalScore.toString(),
|
finalScore.toString(),
|
||||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 24),
|
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 24),
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import '../../../config/constants/scoring_colors.dart';
|
import '../../../config/constants/scoring_colors.dart';
|
||||||
|
import '../../../config/localization/generated/app_localizations.dart';
|
||||||
|
|
||||||
class ScoringKeypad extends StatelessWidget {
|
class ScoringKeypad extends StatelessWidget {
|
||||||
final Function(String) onScoreInput;
|
final Function(String) onScoreInput;
|
||||||
@@ -11,6 +12,8 @@ class ScoringKeypad extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final l10n = AppLocalizations.of(context)!;
|
||||||
|
|
||||||
// Score buttons: 4 rows × 3 columns
|
// Score buttons: 4 rows × 3 columns
|
||||||
final List<List<String>> scoreLayout = [
|
final List<List<String>> scoreLayout = [
|
||||||
['X', '10', '9'],
|
['X', '10', '9'],
|
||||||
@@ -21,8 +24,8 @@ class ScoringKeypad extends StatelessWidget {
|
|||||||
|
|
||||||
// Functional buttons: 4 rows × 1 column
|
// Functional buttons: 4 rows × 1 column
|
||||||
final List<String> functionalButtons = [
|
final List<String> functionalButtons = [
|
||||||
'CLEAR',
|
l10n.keypadClear,
|
||||||
'CLOSE',
|
l10n.keypadClose,
|
||||||
'', // Reserved for future functions
|
'', // Reserved for future functions
|
||||||
'', // Reserved for future functions
|
'', // Reserved for future functions
|
||||||
];
|
];
|
||||||
@@ -83,15 +86,25 @@ class ScoringKeypad extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildKeypadButton(BuildContext context, String score, {bool isFunctional = false}) {
|
Widget _buildKeypadButton(BuildContext context, String score, {bool isFunctional = false}) {
|
||||||
|
final l10n = AppLocalizations.of(context)!;
|
||||||
|
|
||||||
// Use different styling for functional buttons
|
// Use different styling for functional buttons
|
||||||
Color buttonColor;
|
Color buttonColor;
|
||||||
Color textColor;
|
Color textColor;
|
||||||
|
|
||||||
|
// Map display text to internal values for callback
|
||||||
|
String internalValue = score;
|
||||||
|
if (score == l10n.keypadClear) {
|
||||||
|
internalValue = 'CLEAR';
|
||||||
|
} else if (score == l10n.keypadClose) {
|
||||||
|
internalValue = 'CLOSE';
|
||||||
|
}
|
||||||
|
|
||||||
if (isFunctional) {
|
if (isFunctional) {
|
||||||
if (score == 'CLEAR') {
|
if (internalValue == 'CLEAR') {
|
||||||
buttonColor = Colors.red.shade400;
|
buttonColor = Colors.red.shade400;
|
||||||
textColor = Colors.white;
|
textColor = Colors.white;
|
||||||
} else if (score == 'CLOSE') {
|
} else if (internalValue == 'CLOSE') {
|
||||||
buttonColor = Colors.blue.shade400;
|
buttonColor = Colors.blue.shade400;
|
||||||
textColor = Colors.white;
|
textColor = Colors.white;
|
||||||
} else {
|
} else {
|
||||||
@@ -99,12 +112,13 @@ class ScoringKeypad extends StatelessWidget {
|
|||||||
textColor = Colors.grey.shade600;
|
textColor = Colors.grey.shade600;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// Use score directly for color mapping since scores are not localized
|
||||||
buttonColor = ScoringColors.getScoreBackgroundColor(score);
|
buttonColor = ScoringColors.getScoreBackgroundColor(score);
|
||||||
textColor = ScoringColors.getScoreTextColor(score);
|
textColor = ScoringColors.getScoreTextColor(score);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ElevatedButton(
|
return ElevatedButton(
|
||||||
onPressed: () => onScoreInput(score),
|
onPressed: () => onScoreInput(internalValue),
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: buttonColor,
|
backgroundColor: buttonColor,
|
||||||
foregroundColor: textColor,
|
foregroundColor: textColor,
|
||||||
|
|||||||
@@ -70,11 +70,24 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.0.0"
|
version: "6.0.0"
|
||||||
|
flutter_localizations:
|
||||||
|
dependency: "direct main"
|
||||||
|
description: flutter
|
||||||
|
source: sdk
|
||||||
|
version: "0.0.0"
|
||||||
flutter_test:
|
flutter_test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
intl:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: intl
|
||||||
|
sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.20.2"
|
||||||
leak_tracker:
|
leak_tracker:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -30,6 +30,9 @@ environment:
|
|||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
flutter_localizations:
|
||||||
|
sdk: flutter
|
||||||
|
# flutter_localizations should automatically get the correct intl version
|
||||||
|
|
||||||
# The following adds the Cupertino Icons font to your application.
|
# The following adds the Cupertino Icons font to your application.
|
||||||
# Use with the CupertinoIcons class for iOS style icons.
|
# Use with the CupertinoIcons class for iOS style icons.
|
||||||
@@ -64,6 +67,9 @@ flutter:
|
|||||||
# the material Icons class.
|
# the material Icons class.
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
|
||||||
|
# Enable code generation for localization
|
||||||
|
generate: true
|
||||||
|
|
||||||
# To add assets to your application, add an assets section, like this:
|
# To add assets to your application, add an assets section, like this:
|
||||||
# assets:
|
# assets:
|
||||||
# - images/a_dot_burr.jpeg
|
# - images/a_dot_burr.jpeg
|
||||||
|
|||||||
Reference in New Issue
Block a user