new UI + new targets.

This commit is contained in:
Jan Pleterski
2026-11-27 14:37:44 +01:00
parent 5f9e2a3b86
commit 2fc741a9f6
113 changed files with 6861 additions and 7381 deletions
+18
View File
@@ -0,0 +1,18 @@
import 'package:intl/intl.dart';
import '../services/app_settings.dart';
/// Decimal number the way the language writes it: 8,49 (sl, de) or 8.49 (en).
String dec(double v, [int digits = 2]) {
final s = v.toStringAsFixed(digits);
return AppSettings.instance.language == 'English' ? s : s.replaceAll('.', ',');
}
/// Signed difference: "+0,21" / "−0,06".
String signedDec(double v, [int digits = 2]) => '${v >= 0 ? '+' : '−'}${dec(v.abs(), digits)}';
/// "čet, 12. 11." (or with the year): weekday without the locale's dot.
String dayDate(DateTime d, {bool year = false}) {
final s = AppSettings.instance;
final weekday = DateFormat('EEE', s.dateLocale).format(d).replaceAll('.', '');
return '$weekday, ${DateFormat(year ? 'd. M. yyyy' : 'd. M.').format(d)}';
}
-40
View File
@@ -1,40 +0,0 @@
import 'package:flutter/material.dart';
class TargetColors {
static const Map<String, Color> targetBackgroundColors = {
'assets/target.png': Color(0xFFFFFFFF), // White
'assets/targets/Target1.jpg': Color(0xFFE8ECD5), // Light beige
'assets/targets/Target2.jpg': Color(0xFFC1DF87), // Light green
'assets/targets/Target3.jpg': Color(0xFFFEFEFE), // Off-white
'assets/targets/Target4.jpg': Color(0xFFD42931), // Red
'assets/targets/Target5.jpg': Color(0xFF02050A), // Very dark blue/black
'assets/targets/Target6.jpg': Color(0xFFF3E7D1), // Light beige
'assets/targets/Target7.jpg': Color(0xFFFFD454), // Bright yellow
'assets/targets/Target8.jpg': Color(0xFF1E5E81), // Dark teal blue
'assets/targets/Target9.jpg': Color(0xFFFEFEFC), // Off-white
'assets/targets/Target10.jpg': Color(0xFF98926E), // Olive green
'assets/targets/Target11.jpg': Color(0xFF13132B), // Dark blue
'assets/targets/Target12.jpg': Color(0xFFF5F4EF), // Off-white
'assets/targets/Target14.jpg': Color(0xFFFEE05E), // Light yellow
'assets/targets/Target15.jpg': Color(0xFFFFFFFF), // White
'assets/targets/Target16.jpg': Color(0xFF000000), // Black
'assets/targets/Target17.jpg': Color(0xFF21304D), // Dark blue
'assets/targets/Target18.jpg': Color(0xFF050608), // Very dark gray
'assets/targets/Target19.jpg': Color(0xFFF68527), // Warm orange
'assets/targets/Target20.jpg': Color(0xFFA9D9EF), // Light blue
'assets/targets/Target22.jpg': Color(0xFFFBFAF6), // Off-white
'assets/targets/Target23.jpg': Color(0xFF000000), // Black
'assets/targets/Target24.jpg': Color(0xFF646462), // Grey
'assets/targets/Target25.jpg': Color(0xFF040308), // Very dark gray
'assets/targets/Target26.jpg': Color(0xFF161C2C), // Dark blue-gray
'assets/targets/Target27.jpg': Color(0xFF28A5DF), // Blue
'assets/targets/Target28.jpg': Color(0xFFFFFFFF), // White
'assets/targets/Target29.jpg': Color(0xFF180E27), // Dark purple
'assets/targets/Target30.jpg': Color(0xFFFDFDFB), // Off-white
'assets/targets/Target35.jpg': Color(0xFFFFC5C4), // Light salmon
};
static Color getBackgroundColor(String targetPath) {
return targetBackgroundColors[targetPath] ?? Colors.grey[900]!;
}
}
+25 -5
View File
@@ -1,9 +1,10 @@
import 'dart:math';
import 'dart:ui';
/// The one scoring rule for a shot on the default target (assets/target.png,
/// 1200x1200). Saving, the preview and the target view all use it, so a shot
/// scores the same everywhere.
/// The one scoring rule for a shot, in the 1200 × 1200 space every target
/// design shares (target-designs/v3: centre 600/600, ring 1 at r 510, the
/// black at r 180). Saving, the preview and the target view all use it, so a
/// shot scores the same everywhere and on every design.
///
/// A shot counts for the best ring its edge touches: the distance from the
/// centre to the bullet's centre, minus the bullet's radius, is compared with
@@ -11,12 +12,31 @@ import 'dart:ui';
class TargetScoring {
TargetScoring._();
static const Offset center = Offset(601, 598);
static const double size = 1200;
static const Offset center = Offset(600, 600);
static const double bulletRadius = 25;
static const double bulletDiameter = 53; // drawn size of a hit
/// Outer edge of ring 10, 9, ... 1, measured from [center].
///
/// A shot touching a ring line counts the higher value, so each edge is the
/// outer edge of its printed line: the line's centre radius plus half its
/// width. Lines in the v3 designs: 5 px white at r 70 and 125 (rings 9, 8),
/// 3 px on the paper at r 235 … 510 (rings 6 … 1). Ring 7 is the edge of
/// the black and 10 the centre dot, with no line of their own.
static const double _paperLine = 3;
static const double _blackLine = 5;
static const List<double> rings = [
14, 70, 125, 180, 235, 290, 345, 400, 455, 510,
15, // 10: centre dot
70 + _blackLine / 2, // 9
125 + _blackLine / 2, // 8
180, // 7: edge of the black
235 + _paperLine / 2, // 6
290 + _paperLine / 2, // 5
345 + _paperLine / 2, // 4
400 + _paperLine / 2, // 3
455 + _paperLine / 2, // 2
510 + _paperLine / 2, // 1
];
/// Score of a shot whose centre is at [bullet] (default target coordinates).
+4
View File
@@ -1,3 +1,5 @@
import 'translations_v2.dart';
class AppTranslations {
static Map<String, Map<String, String>> translations = {
// Language names
@@ -1263,6 +1265,8 @@ class AppTranslations {
};
static String translate(String key, String language) {
final v2 = translationsV2[key]?[language];
if (v2 != null) return v2;
if (translations.containsKey(key) &&
translations[key]!.containsKey(language)) {
return translations[key]![language]!;
+161
View File
@@ -0,0 +1,161 @@
/// Strings of the V2 design (shooting-app-design/v2). Looked up before
/// [AppTranslations.translations], so an entry here also replaces an older
/// wording there (e.g. "Kontakti" instead of "Stiki").
const Map<String, Map<String, String>> translationsV2 = {
// Changed wording
'Contacts': {'English': 'Contacts', 'Slovenian': 'Kontakti', 'German': 'Kontakte'},
'COMPETITION': {'English': 'COMPETITION', 'Slovenian': 'TEKMA', 'German': 'WETTKAMPF'},
// Streljanje
'Where are we shooting today?': {'English': 'Where are we shooting today?', 'Slovenian': 'Kje streljamo danes?', 'German': 'Wo schießen wir heute?'},
'Last session': {'English': 'Last session', 'Slovenian': 'Zadnje streljanje', 'German': 'Letztes Schießen'},
'per shot': {'English': 'per shot', 'Slovenian': 'na strel', 'German': 'pro Schuss'},
'Live': {'English': 'Live', 'Slovenian': 'V živo', 'German': 'Live'},
'Choose': {'English': 'Choose', 'Slovenian': 'Izberi', 'German': 'Wählen'},
// Knjiga
'Applies to Statistics and History': {'English': 'Applies to Statistics and History', 'Slovenian': 'Velja za Statistiko in Zgodovino', 'German': 'Gilt für Statistik und Verlauf'},
'since the first saved target': {'English': 'since the first saved target', 'Slovenian': 'od prve shranjene tarče', 'German': 'seit der ersten gespeicherten Scheibe'},
'choose dates …': {'English': 'choose dates …', 'Slovenian': 'izberi datume …', 'German': 'Daten wählen …'},
'Best training / tournament in the bottom card: tap to open its targets.': {
'English': 'Best training / tournament in the bottom card: tap to open its targets.',
'Slovenian': 'Najboljši trening / tekmovanje v spodnji kartici: tapni za prikaz njegovih tarč.',
'German': 'Bestes Training / bester Wettkampf in der unteren Karte: tippen, um die Scheiben zu öffnen.',
},
'Sort: tap to switch between date order and best average per shot. The coloured number shows how far a session is from your average.': {
'English': 'Sort: tap to switch between date order and best average per shot. The coloured number shows how far a session is from your average.',
'Slovenian': 'Razvrščanje: tapni za preklop med vrstnim redom po datumu in po najboljšem povprečju na strel. Barvna številka pokaže, koliko seja odstopa od tvojega povprečja.',
'German': 'Sortierung: tippen, um zwischen Datum und bestem Schnitt pro Schuss zu wechseln. Die farbige Zahl zeigt, wie weit eine Einheit von deinem Schnitt abweicht.',
},
'Shots per target': {'English': 'Shots per target', 'Slovenian': 'Streli na tarčo', 'German': 'Schüsse pro Scheibe'},
// Rezultat
'total': {'English': 'total', 'Slovenian': 'skupaj', 'German': 'gesamt'},
'Share result': {'English': 'Share result', 'Slovenian': 'Deli rezultat', 'German': 'Ergebnis teilen'},
'Points per target': {'English': 'Points per target', 'Slovenian': 'Točke po tarčah', 'German': 'Punkte pro Scheibe'},
'Hits by value': {'English': 'Hits by value', 'Slovenian': 'Zadetki po vrednosti', 'German': 'Treffer nach Wert'},
'Gold = best target of the session': {'English': 'Gold = best target of the session', 'Slovenian': 'Zlata = najboljša tarča seje', 'German': 'Gold = beste Scheibe der Einheit'},
'Chart': {'English': 'Chart', 'Slovenian': 'Graf', 'German': 'Diagramm'},
'Failed to delete target': {'English': 'Failed to delete target', 'Slovenian': 'Tarče ni bilo mogoče izbrisati', 'German': 'Scheibe konnte nicht gelöscht werden'},
'Rename the session or move it to tournaments.': {'English': 'Rename the session or move it to tournaments.', 'Slovenian': 'Preimenuj sejo ali jo premakni med tekmovanja.', 'German': 'Einheit umbenennen oder zu den Wettkämpfen verschieben.'},
// Fotografiraj
'Camera settings': {'English': 'Camera settings', 'Slovenian': 'Nastavitve kamere', 'German': 'Kameraeinstellungen'},
'Exposure, zoom and flashlight': {'English': 'Exposure, zoom and flashlight', 'Slovenian': 'Osvetlitev, povečava in svetilka', 'German': 'Belichtung, Zoom und Taschenlampe'},
'Looking for hits …': {'English': 'Looking for hits …', 'Slovenian': 'Iščem zadetke …', 'German': 'Suche Treffer …'},
'{a}–{b} shots per target': {'English': '{a}–{b} shots per target', 'Slovenian': '{a}–{b} strelov na tarčo', 'German': '{a}–{b} Schüsse pro Scheibe'},
'Statistics in the Book only compare targets with the same number of shots.': {
'English': 'Statistics in the Book only compare targets with the same number of shots.',
'Slovenian': 'Statistika v Knjigi primerja le tarče z enakim številom strelov.',
'German': 'Die Statistik im Buch vergleicht nur Scheiben mit gleicher Schusszahl.',
},
// Preveri zadetke
'Check hits': {'English': 'Check hits', 'Slovenian': 'Preveri zadetke', 'German': 'Treffer prüfen'},
'{n} hits detected · correct them if needed': {'English': '{n} hits detected · correct them if needed', 'Slovenian': '{n} zadetkov zaznanih · popravi, če je treba', 'German': '{n} Treffer erkannt · bei Bedarf korrigieren'},
'Save to': {'English': 'Save to', 'Slovenian': 'Shrani v', 'German': 'Speichern in'},
'new': {'English': 'new', 'Slovenian': 'nova', 'German': 'neu'},
'today': {'English': 'today', 'Slovenian': 'danes', 'German': 'heute'},
'Add hit': {'English': 'Add hit', 'Slovenian': 'Dodaj zadetek', 'German': 'Treffer hinzufügen'},
'Remove hit': {'English': 'Remove hit', 'Slovenian': 'Odstrani zadetek', 'German': 'Treffer entfernen'},
'Save target': {'English': 'Save target', 'Slovenian': 'Shrani tarčo', 'German': 'Scheibe speichern'},
'Hold and drag': {'English': 'Hold and drag', 'Slovenian': 'Drži in povleci', 'German': 'Halten und ziehen'},
'Its value; then drag it to where it hit.': {'English': 'Its value; then drag it to where it hit.', 'Slovenian': 'Njegova vrednost; nato ga povleci na mesto zadetka.', 'German': 'Sein Wert; dann an die Trefferstelle ziehen.'},
'Image not available': {'English': 'Image not available', 'Slovenian': 'Slika ni na voljo', 'German': 'Bild nicht verfügbar'},
'Tap a value below to pick that hit; it gets a red border.': {
'English': 'Tap a value below to pick that hit; it gets a red border.',
'Slovenian': 'Tapni vrednost spodaj, da izbereš ta zadetek; dobi rdeč rob.',
'German': 'Tippe unten auf einen Wert, um den Treffer zu wählen; er bekommt einen roten Rand.',
},
'Hold and drag on the target to move the picked hit; a magnifier shows where it is.': {
'English': 'Hold and drag on the target to move the picked hit; a magnifier shows where it is.',
'Slovenian': 'Drži in povleci po tarči, da premakneš izbrani zadetek; povečevalo pokaže, kje je.',
'German': 'Halten und auf der Scheibe ziehen, um den gewählten Treffer zu verschieben; eine Lupe zeigt, wo er liegt.',
},
'Add hit: for a shot that was not found. Remove hit: deletes the picked one.': {
'English': 'Add hit: for a shot that was not found. Remove hit: deletes the picked one.',
'Slovenian': 'Dodaj zadetek: za strel, ki ni bil najden. Odstrani zadetek: izbriše izbranega.',
'German': 'Treffer hinzufügen: für einen nicht gefundenen Schuss. Treffer entfernen: löscht den gewählten.',
},
'Save to: training or tournament, and which folder. The last one is chosen for you.': {
'English': 'Save to: training or tournament, and which folder. The last one is chosen for you.',
'Slovenian': 'Shrani v: trening ali tekmovanje in katera mapa. Zadnja je že izbrana.',
'German': 'Speichern in: Training oder Wettkampf und welcher Ordner. Der letzte ist vorausgewählt.',
},
'Photo icon: see the photo with what was detected.': {
'English': 'Photo icon: see the photo with what was detected.',
'Slovenian': 'Ikona fotografije: pokaže fotografijo z zaznanim.',
'German': 'Foto-Symbol: zeigt das Foto mit dem Erkannten.',
},
// Kamera v živo
'of': {'English': 'of', 'Slovenian': 'od', 'German': 'von'},
'paused': {'English': 'paused', 'Slovenian': 'premor', 'German': 'pausiert'},
'Wait': {'English': 'Waiting', 'Slovenian': 'Čakanje', 'German': 'Warten'},
'Reload phase': {'English': 'Reload', 'Slovenian': 'Polnjenje', 'German': 'Laden'},
'Signal at the end': {'English': 'Signal at the end', 'Slovenian': 'Signal ob koncu', 'German': 'Signal am Ende'},
'tap for a new target': {'English': 'tap for a new target', 'Slovenian': 'tapni za novo tarčo', 'German': 'tippen für neue Scheibe'},
'Shot counter': {'English': 'Shot counter', 'Slovenian': 'Števec strelov', 'German': 'Schusszähler'},
'Start timer': {'English': 'Start timer', 'Slovenian': 'Začni časovnik', 'German': 'Timer starten'},
'Cycle: shot → reload → wait. On a full target »Change target!« is shown.': {
'English': 'Cycle: shot → reload → wait. On a full target »Change target!« is shown.',
'Slovenian': 'Cikel: strel → polnjenje → čakanje. Ob polni tarči se pokaže »Zamenjaj tarčo!«.',
'German': 'Ablauf: Schuss → Laden → Warten. Bei voller Scheibe erscheint »Scheibe wechseln!«.',
},
'saved for this camera': {'English': 'saved for this camera', 'Slovenian': 'shranjeno za to kamero', 'German': 'für diese Kamera gespeichert'},
'Timer: set shoot, reload and wait times in the timer card or with the timer button. While it runs, the button pauses it and the card stops it.': {
'English': 'Timer: set shoot, reload and wait times in the timer card or with the timer button. While it runs, the button pauses it and the card stops it.',
'Slovenian': 'Časovnik: čas streljanja, polnjenja in čakanja nastaviš v kartici časovnika ali z gumbom. Ko teče, ga gumb ustavi za premor, kartica pa ustavi.',
'German': 'Timer: Schuss-, Lade- und Wartezeit in der Timer-Karte oder mit der Timer-Taste einstellen. Läuft er, pausiert ihn die Taste und die Karte stoppt ihn.',
},
'Play / pause: control the timer.': {'English': 'Play / pause: control the timer.', 'Slovenian': 'Predvajaj / premor: upravljanje časovnika.', 'German': 'Start / Pause: steuert den Timer.'},
'Big + button: shot counter. Tap after each shot; when the target is full you get a "Change target!" warning. The dot next to it switches the counter on or off.': {
'English': 'Big + button: shot counter. Tap after each shot; when the target is full you get a "Change target!" warning. The dot next to it switches the counter on or off.',
'Slovenian': 'Velik gumb +: števec strelov. Po vsakem strelu tapni +; ko je tarča polna, se prikaže opozorilo »Zamenjaj tarčo!«. Pika ob njem števec vklopi ali izklopi.',
'German': 'Große +-Taste: Schusszähler. Nach jedem Schuss tippen; ist die Scheibe voll, erscheint »Scheibe wechseln!«. Der Punkt daneben schaltet den Zähler ein oder aus.',
},
'Picture icon: brightness, contrast, filters and rotation, saved for each camera.': {
'English': 'Picture icon: brightness, contrast, filters and rotation, saved for each camera.',
'Slovenian': 'Ikona slike: svetlost, kontrast, filtri in vrtenje, shranjeno za vsako kamero.',
'German': 'Bild-Symbol: Helligkeit, Kontrast, Filter und Drehung, für jede Kamera gespeichert.',
},
// Koledar, Kontakti
'Members': {'English': 'Members', 'Slovenian': 'Člani', 'German': 'Mitglieder'},
'Search members …': {'English': 'Search members …', 'Slovenian': 'Išči člana …', 'German': 'Mitglied suchen …'},
'Could not load the calendar': {'English': 'Could not load the calendar', 'Slovenian': 'Koledarja ni bilo mogoče naložiti', 'German': 'Kalender konnte nicht geladen werden'},
// Nastavitve
'Hits and target': {'English': 'Hits and target', 'Slovenian': 'Zadetki in tarča', 'German': 'Treffer und Scheibe'},
'Holiday target until': {'English': 'Holiday target until', 'Slovenian': 'Praznična tarča do', 'German': 'Feiertagsscheibe bis'},
'You can still change the hit colour.': {
'English': 'You can still change the hit colour.',
'Slovenian': 'Barvo zadetkov lahko še vedno zamenjaš.',
'German': 'Die Trefferfarbe kannst du trotzdem ändern.',
},
'Theme': {'English': 'Theme', 'Slovenian': 'Tema', 'German': 'Design'},
'System': {'English': 'System', 'Slovenian': 'Sistem', 'German': 'System'},
'Light': {'English': 'Light', 'Slovenian': 'Svetla', 'German': 'Hell'},
'Dark': {'English': 'Dark', 'Slovenian': 'Temna', 'German': 'Dunkel'},
'Unlocked': {'English': 'Unlocked', 'Slovenian': 'Odklenjeno', 'German': 'Freigeschaltet'},
'Unlocks calendar and contacts.': {'English': 'Unlocks calendar and contacts.', 'Slovenian': 'Odklene koledar in kontakte.', 'German': 'Schaltet Kalender und Kontakte frei.'},
'Member access is currently available only for SD Kovinar Muta.': {
'English': 'Member access is currently available only for SD Kovinar Muta.',
'Slovenian': 'Članski dostop je trenutno na voljo samo za SD Kovinar Muta.',
'German': 'Mitgliederzugang gibt es derzeit nur für SD Kovinar Muta.',
},
'Version': {'English': 'Version', 'Slovenian': 'Različica', 'German': 'Version'},
'Target style': {'English': 'Target style', 'Slovenian': 'Slog tarče', 'German': 'Scheibenstil'},
'All targets': {'English': 'All targets', 'Slovenian': 'Vse tarče', 'German': 'Alle Scheiben'},
'holiday': {'English': 'holiday', 'Slovenian': 'prazničnih', 'German': 'Feiertage'},
'Classic': {'English': 'Classic', 'Slovenian': 'Klasične', 'German': 'Klassisch'},
'Club designs': {'English': 'Club designs', 'Slovenian': 'Naši dizajni', 'German': 'Vereinsdesigns'},
'Holidays': {'English': 'Holidays', 'Slovenian': 'Praznične', 'German': 'Feiertage'},
'Locations, positions and camera addresses': {'English': 'Locations, positions and camera addresses', 'Slovenian': 'Strelišča, pozicije in naslovi kamer', 'German': 'Schießstände, Positionen und Kameraadressen'},
'One tile on the Shooting screen for each position.': {
'English': 'One tile on the Shooting screen for each position.',
'Slovenian': 'Ena ploščica na zaslonu Streljanje za vsako pozicijo.',
'German': 'Eine Kachel auf dem Schießen-Bildschirm pro Position.',
},
};