UI fixes and league

This commit is contained in:
Jan Pleterski
2026-11-28 12:22:02 +01:00
parent 2fc741a9f6
commit 258303deb8
118 changed files with 1439 additions and 537 deletions
+7 -2
View File
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
/// A holiday look (FigCraft Designs/holiday-themes/v2, themes.json): while a
/// A holiday look (FigCraft Designs/holiday-themes/v3, themes.json): while a
/// holiday's window is on, the app shows its background, its target (locked)
/// and its hit colour (until the user picks another one). Afterwards everything
/// is back to the user's own settings. Saved targets are never changed.
@@ -17,7 +17,12 @@ class HolidayTheme {
const HolidayTheme(this.id, this.name, this.targetId, this.color, {this.from, this.to, this.easter});
String background(bool dark) => 'assets/backgrounds/bg${id}_${dark ? 'dark' : 'light'}.webp';
String background(bool dark) => _background(id, dark);
/// The background when no holiday is on ("00 Privzeto").
static String everydayBackground(bool dark) => _background('00', dark);
static String _background(String id, bool dark) => 'assets/backgrounds/bg${id}_${dark ? 'dark' : 'light'}.webp';
/// In the order of themes.json: when windows overlap, the first one wins.
static const List<HolidayTheme> all = [
+29 -11
View File
@@ -3,13 +3,15 @@ import 'package:flutter/material.dart';
/// Where a target design comes from (only used to order and group the picker).
enum TargetGroup { classic, design, holiday }
/// One target design of the v3 set (FigCraft Designs/target-designs/v3).
/// One target design of the v5 set (FigCraft Designs/target-designs/v5).
///
/// Every design has the same geometry in a 1200 × 1200 space: centre
/// (600, 600), ring 1 at r 510, the black at r 180; decoration and glow only
/// outside ring 1. Hits are stored in that space, so a hit lands on the same
/// ring whatever design is picked. The default ([id] 0) is drawn as vectors
/// (sharp at any zoom); the others are 1600 px WebP images with transparency.
/// outside ring 1, transparent beyond. Each design comes with its own screen
/// background (target-backgrounds/v3), shown on the target screens. Hits are stored in that space, so a hit lands on the same
/// ring whatever design is picked. The default ([id] 0, "00 Privzeta") is
/// drawn as vectors (sharp at any zoom); the others are 1600 px WebP images
/// with transparency.
class TargetStyle {
final int id; // 1–35 are the old Target<id>.jpg, so saved choices carry over
final String sl;
@@ -21,10 +23,16 @@ class TargetStyle {
const TargetStyle(this.id, this.sl, this.en, this.de, this.group, this.glow);
bool get isDefault => id == 0;
bool get isHoliday => group == TargetGroup.holiday;
/// Image asset; null for the vector default.
String? get asset => isDefault ? null : 'assets/targets/v3/t${id.toString().padLeft(2, '0')}.webp';
String? get asset => isDefault ? null : 'assets/targets/v5/t${id.toString().padLeft(2, '0')}.webp';
/// Its background on the target screens (target-backgrounds/v3, laid out
/// round the result screen's target), in dark or light.
String background(bool dark) => 'assets/backgrounds/t${id.toString().padLeft(2, '0')}_${dark ? 'dark' : 'light'}.webp';
String name(String language) => switch (language) {
'Slovenian' => sl,
@@ -52,15 +60,25 @@ class TargetStyle {
TargetStyle(79, 'Dan državnosti', 'Statehood Day', 'Staatsfeiertag', TargetGroup.holiday, Color(0xFF1C4FA0)),
];
/// The designs the app ships, in picker order. The rest of the v3 set
/// (FigCraft Designs/target-designs/v3) is not used for now; to bring one
/// back, add its line here and its webp to assets/targets/v3.
/// The designs the app ships, in picker order (light to dark, then by
/// colour round the wheel: a 3 × 3 grid). The rest of the v5 set
/// (FigCraft Designs/target-designs/v5) is not used for now; to bring one
/// back, add its line here and its webp to assets/targets/v5.
static const List<TargetStyle> all = [
fallback,
TargetStyle(1, 'Lovorov venec', 'Laurel wreath', 'Lorbeerkranz', TargetGroup.classic, Color(0xFF3E8A1E)),
TargetStyle(42, 'ISSF ecru', 'ISSF ecru', 'ISSF Ecru', TargetGroup.design, Color(0xFFE8D9B0)),
TargetStyle(5, 'Plameni', 'Flames', 'Flammen', TargetGroup.classic, Color(0xFFFF3D00)),
TargetStyle(8, 'Val', 'Wave', 'Welle', TargetGroup.classic, Color(0xFF0B8BD9)),
TargetStyle(7, 'Sončno rumena', 'Sunny yellow', 'Sonnengelb', TargetGroup.classic, Color(0xFFFFA000)),
TargetStyle(19, 'Oranžna', 'Orange', 'Orange', TargetGroup.classic, Color(0xFFFF5A00)),
TargetStyle(5, 'Plameni', 'Flames', 'Flammen', TargetGroup.classic, Color(0xFFFF3D00)),
TargetStyle(61, 'Cvetlice', 'Flowers', 'Blumen', TargetGroup.design, Color(0xFFFF6FB0)),
TargetStyle(18, 'Ledeni kristal', 'Ice crystal', 'Eiskristall', TargetGroup.classic, Color(0xFF00B8FF)),
TargetStyle(53, 'Kamuflaža', 'Camouflage', 'Tarnmuster', TargetGroup.design, Color(0xFF3E4A26)),
TargetStyle(1, 'Lovorov venec', 'Laurel wreath', 'Lorbeerkranz', TargetGroup.classic, Color(0xFF3E8A1E)),
];
@override
bool operator ==(Object other) => other is TargetStyle && other.id == id;
@override
int get hashCode => id.hashCode;
}