Settings sync between the dashboard and the app

- Dashboard (settingsync.py): the plugins' settings go into a synced
  settings.db, one row per setting (the row id is the setting's key, so the
  phone and the dashboard edit the same row; the later change wins) plus each
  field as the plugin declares it. Fields marked "local" (addresses, paths on
  one machine) and the plugins' on / off stay out. Values set on another
  device are checked as the Settings page does before they're saved; a
  refused one is written back with the dashboard's value.
- App 1.1.7: a Settings page (the gear on every tab) built from those fields,
  synced both ways. Food targets, the cycle, the work day and the body profile
  read the synced values; with a dashboard that doesn't sync settings yet,
  they still come from its Health summaries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Bashy 2026-10-26 16:30:00 +02:00
parent 98b110dd56
commit 820aca7d92
25 changed files with 606 additions and 41 deletions

View file

@ -47,7 +47,7 @@ class _OverviewPageState extends State<OverviewPage> {
final last = nights.isNotEmpty && nights.last.day == now;
final steps = sm.day(iso(now))?['steps'] as num?;
final week = [for (var k = 1; k <= 7; k++) sm.day(iso(plus(now, -k)))?['steps'] as num?].whereType<num>().toList();
final cv = CycleView(widget.sync.store, const CycleSettings());
final cv = CycleView(widget.sync.store, CycleSettings.of(widget.sync.store));
var (head, sub) = cycleStatus(cv);
if (cv.status == Status.wait) head = cv.daysToNext == 0 ? 'today' : 'in ${cv.daysToNext} ${cv.daysToNext == 1 ? 'day' : 'days'}';
if (cv.status == Status.period) head = 'day ${cv.cycleDay}';