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 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, 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.jpg, so saved choices carry over final String sl; final String en; final String de; final TargetGroup group; final Color glow; // outer glow colour, used for the picker's selection ring 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/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, 'German' => de, _ => en, }; static const TargetStyle fallback = TargetStyle(0, 'Privzeta', 'Default', 'Standard', TargetGroup.classic, Color(0xFF9FD8FF)); static TargetStyle byId(int? id) => [...all, ...holidays].firstWhere((t) => t.id == id, orElse: () => fallback); /// Holiday targets: never in the picker, only shown (locked) during their /// holiday – see HolidayTheme. static const List holidays = [ TargetStyle(70, 'Božič', 'Christmas', 'Weihnachten', TargetGroup.holiday, Color(0xFFE2231A)), TargetStyle(71, 'Novo leto', 'New Year', 'Neujahr', TargetGroup.holiday, Color(0xFF7A2CFF)), TargetStyle(72, 'Velika noč', 'Easter', 'Ostern', TargetGroup.holiday, Color(0xFFB6E86E)), TargetStyle(73, 'Valentinovo', 'Valentine\'s Day', 'Valentinstag', TargetGroup.holiday, Color(0xFFE2112F)), TargetStyle(74, 'Noč čarovnic', 'Halloween', 'Halloween', TargetGroup.holiday, Color(0xFF7A2CFF)), TargetStyle(75, 'Pust', 'Carnival', 'Fasching', TargetGroup.holiday, Color(0xFFFF2F6D)), TargetStyle(76, 'Martinovo', 'St Martin\'s Day', 'Martinstag', TargetGroup.holiday, Color(0xFF7A1E4A)), TargetStyle(77, 'Praznik dela', 'Labour Day', 'Tag der Arbeit', TargetGroup.holiday, Color(0xFFE2231A)), TargetStyle(78, 'Kresna noč', 'Midsummer night', 'Johannisnacht', TargetGroup.holiday, Color(0xFFFF3D00)), TargetStyle(79, 'Dan državnosti', 'Statehood Day', 'Staatsfeiertag', TargetGroup.holiday, Color(0xFF1C4FA0)), ]; /// 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 all = [ fallback, TargetStyle(42, 'ISSF ecru', 'ISSF ecru', 'ISSF Ecru', TargetGroup.design, Color(0xFFE8D9B0)), 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; }