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
+35 -15
View File
@@ -34,20 +34,23 @@ class AppSettings extends ChangeNotifier with WidgetsBindingObserver {
/// Hit colours, each tuned for the dark and the light theme. The chosen
/// one is the accent of the whole interface.
// Round the colour wheel, then the neutrals: two rows of 8 in the picker.
// No red: a red hit would vanish in the red edge of a selected one.
static const Map<String, (Color dark, Color light)> bulletColors = {
'Blue': (Color(0xFF4B8EF5), Color(0xFF2D6BD8)),
'Green': (Color(0xFF3CC764), Color(0xFF1E9A4C)),
'Yellow': (Color(0xFFF2C12E), Color(0xFFC08E00)),
'Purple': (Color(0xFFB45EE3), Color(0xFF8E3FBF)),
'Cyan': (Color(0xFF22C7E0), Color(0xFF12B4CE)),
'Teal': (Color(0xFF17B3A3), Color(0xFF0E9384)),
'Indigo': (Color(0xFF6E6CF2), Color(0xFF4F46E5)),
'Pink': (Color(0xFFF0457A), Color(0xFFD63366)),
'Lime': (Color(0xFFC9DC3C), Color(0xFF85A00E)),
'Mint': (Color(0xFF5EE6B0), Color(0xFF1FAE7A)),
'Orange': (Color(0xFFFF8A1F), Color(0xFFE06F00)),
'Violet': (Color(0xFF8E62F7), Color(0xFF7C3AED)),
'Amber': (Color(0xFFFFB020), Color(0xFFD18A00)),
'Yellow': (Color(0xFFF2C12E), Color(0xFFC08E00)),
'Lime': (Color(0xFFC9DC3C), Color(0xFF85A00E)),
'Green': (Color(0xFF3CC764), Color(0xFF1E9A4C)),
'Mint': (Color(0xFF5EE6B0), Color(0xFF1FAE7A)),
'Teal': (Color(0xFF17B3A3), Color(0xFF0E9384)),
'Cyan': (Color(0xFF22C7E0), Color(0xFF12B4CE)),
'Blue': (Color(0xFF4B8EF5), Color(0xFF2D6BD8)),
'Indigo': (Color(0xFF6E6CF2), Color(0xFF4F46E5)),
'Violet': (Color(0xFF8E62F7), Color(0xFF7C3AED)),
'Purple': (Color(0xFFB45EE3), Color(0xFF8E3FBF)),
'Magenta': (Color(0xFFE04BD8), Color(0xFFB8269F)),
'Pink': (Color(0xFFF0457A), Color(0xFFD63366)),
'Brown': (Color(0xFFB07A55), Color(0xFF8A5536)),
'Grey': (Color(0xFFA3AAB2), Color(0xFF6F757C)),
};
@@ -93,7 +96,10 @@ class AppSettings extends ChangeNotifier with WidgetsBindingObserver {
DateTime get today => debugToday ?? DateTime.now();
HolidayTheme? get holiday => HolidayTheme.on(today);
/// Preview only: show the everyday look even on a holiday.
bool debugNoHoliday = false;
HolidayTheme? get holiday => debugNoHoliday ? null : HolidayTheme.on(today);
/// True while a holiday decides the target.
bool get targetLocked => holiday != null;
@@ -120,7 +126,16 @@ class AppSettings extends ChangeNotifier with WidgetsBindingObserver {
}
/// The holiday's screen background (the everyday one is painted, see AppBackground).
String get background => holiday?.background(isDark) ?? '';
/// Screen background of the whole app: the holiday's, else the everyday one.
String get background => holiday?.background(isDark) ?? HolidayTheme.everydayBackground(isDark);
/// Background of the target screens (result, check hits, edit): the shown
/// target's own – the holiday target's during a holiday – with the window
/// lines the target sits between (target-backgrounds/v3).
String get targetBackground {
final h = holiday;
return (h == null ? _target : TargetStyle.byId(h.targetId)).background(isDark);
}
// A new day may start or end a holiday
@override
@@ -165,6 +180,9 @@ class AppSettings extends ChangeNotifier with WidgetsBindingObserver {
}
/// The target shown: the holiday's while one is on, otherwise the user's.
/// The user's own pick, whatever the holiday.
TargetStyle get ownTarget => _target;
TargetStyle get target {
final h = holiday;
return h == null ? _target : TargetStyle.byId(h.targetId);
@@ -257,9 +275,11 @@ class AppSettings extends ChangeNotifier with WidgetsBindingObserver {
await _prefs.setInt('targetStyle', style.id);
}
/// Debug: show the look of [day] (null = today).
void previewDay(DateTime? day) {
/// Preview: show the look of [day] (null = today); [noHoliday] shows the
/// everyday look whatever the day. Not saved: a restart is back to today.
void previewDay(DateTime? day, {bool noHoliday = false}) {
debugToday = day;
debugNoHoliday = noHoliday;
notifyListeners();
}