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
+61 -45
View File
@@ -151,11 +151,14 @@ class SettingsScreen extends StatelessWidget {
),
FutureBuilder<PackageInfo>(
future: _packageInfo,
// Debug builds: long press previews a holiday
builder: (context, snap) => SettingsTile(
icon: Icons.info_outline_rounded,
title: t('Version'),
value: snap.data?.version ?? '',
// Hidden (any build): long press previews a holiday
builder: (context, snap) => GestureDetector(
onLongPress: () => _previewHoliday(context),
child: SettingsTile(
icon: Icons.info_outline_rounded,
title: t('Version'),
value: snap.data?.version ?? '',
),
),
),
]),
@@ -168,7 +171,7 @@ class SettingsScreen extends StatelessWidget {
icon: Icons.celebration_outlined,
title: 'Holiday preview',
subtitle: 'Shows the app as on a day of the holiday',
value: s.debugToday == null ? 'Today' : (s.holiday?.name ?? 'Today'),
value: s.debugNoHoliday ? 'Default' : (s.debugToday == null ? 'Today' : (s.holiday?.name ?? 'Today')),
onTap: () => _previewHoliday(context),
),
]),
@@ -195,13 +198,24 @@ class SettingsScreen extends StatelessWidget {
children: [
SheetOption(
label: 'Today',
selected: s.debugToday == null,
subtitle: s.debugToday == null && !s.debugNoHoliday ? null : 'The real date',
selected: s.debugToday == null && !s.debugNoHoliday,
showDivider: false,
onTap: () {
s.previewDay(null);
Navigator.pop(sheet);
},
),
SheetOption(
label: 'Default (no holiday)',
subtitle: 'Everyday look, your own target and colour',
leading: TargetThumb(s.ownTarget, size: 32),
selected: s.debugNoHoliday,
onTap: () {
s.previewDay(null, noHoliday: true);
Navigator.pop(sheet);
},
),
for (final h in HolidayTheme.all)
Builder(builder: (_) {
// First day of the holiday this year
@@ -213,7 +227,7 @@ class SettingsScreen extends StatelessWidget {
label: h.name,
subtitle: '${DateFormat('d. M.').format(start)} – ${DateFormat('d. M.').format(end)}',
leading: TargetThumb(TargetStyle.byId(h.targetId), size: 32),
selected: s.holiday == h && s.debugToday != null,
selected: s.holiday == h && s.debugToday != null && !s.debugNoHoliday,
onTap: () {
s.previewDay(day);
Navigator.pop(sheet);
@@ -371,22 +385,32 @@ void showAppearanceSheet(BuildContext context) {
children: [
SheetTitle(s.t('Appearance'), trailing: TargetThumb(s.target, size: 52)),
Kicker(s.t('Bullet color'), padding: const EdgeInsets.only(bottom: 12)),
// During a holiday its colour gets its own line first (and is the
// one in use until another is picked)
if (s.holiday != null)
Padding(
padding: const EdgeInsets.only(bottom: 12),
child: GestureDetector(
onTap: s.useHolidayColor,
behavior: HitTestBehavior.opaque,
child: Row(
children: [
_ColorDot(s.holiday!.color, size: 32, selected: s.holidayColorActive),
const SizedBox(width: 10),
Text(s.holiday!.name, style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Palette.current.ink2)),
],
),
),
),
// Two rows of 8, round the colour wheel
LayoutBuilder(builder: (context, box) {
const perRow = 8;
final size = ((box.maxWidth - (perRow - 1) * 10) / perRow).clamp(28.0, 40.0);
final gap = (box.maxWidth - perRow * size) / (perRow - 1);
return Wrap(
spacing: 10,
spacing: gap - 0.01, // exactly 8 per row at any width
runSpacing: 12,
children: [
// During a holiday its colour comes first (and is the one in use)
if (s.holiday != null)
GestureDetector(
onTap: s.useHolidayColor,
child: Tooltip(
message: s.holiday!.name,
child: _ColorDot(s.holiday!.color, size: size, selected: s.holidayColorActive),
),
),
for (final name in AppSettings.bulletColors.keys)
GestureDetector(
onTap: () => s.setBulletColor(name),
@@ -408,13 +432,20 @@ void showAppearanceSheet(BuildContext context) {
);
}
/// Three target designs per row; the chosen one has an accent border and a check.
/// Three target designs per row; the chosen one has an accent border.
class _TargetGrid extends StatelessWidget {
final List<TargetStyle> styles;
const _TargetGrid({required this.styles});
// Listens itself: the sheet builds it as a const, so the sheet's own
// rebuild never reaches it and the check would stay on the old target
@override
Widget build(BuildContext context) {
Widget build(BuildContext context) => ListenableBuilder(
listenable: AppSettings.instance,
builder: (context, _) => _grid(),
);
Widget _grid() {
final s = AppSettings.instance;
final c = Palette.current;
return LayoutBuilder(builder: (context, box) {
@@ -430,31 +461,16 @@ class _TargetGrid extends StatelessWidget {
onTap: () => s.setTarget(style),
child: Column(
children: [
Stack(
children: [
Container(
height: w * 0.92,
width: w,
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: c.isDark ? c.card2 : c.tile,
borderRadius: BorderRadius.circular(14),
border: Border.all(color: style == s.target ? c.accent : Colors.transparent, width: 2),
),
child: Center(child: TargetThumb(style, size: w * 0.92 - 16)),
),
if (style == s.target)
Positioned(
top: 6,
right: 6,
child: Container(
width: 20,
height: 20,
decoration: BoxDecoration(color: c.accent, shape: BoxShape.circle),
child: Icon(Icons.check_rounded, size: 14, color: c.onAccent),
),
),
],
Container(
height: w * 0.92,
width: w,
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: c.isDark ? c.card2 : c.tile,
borderRadius: BorderRadius.circular(14),
border: Border.all(color: style == s.target ? c.accent : Colors.transparent, width: 2),
),
child: Center(child: TargetThumb(style, size: w * 0.92 - 16)),
),
const SizedBox(height: 6),
Text(