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:
parent
98b110dd56
commit
820aca7d92
25 changed files with 606 additions and 41 deletions
|
|
@ -17,9 +17,9 @@ IconData kindIcon(Node n) => n.kind == 'task'
|
|||
: Icons.business;
|
||||
|
||||
class CustomersPage extends StatefulWidget {
|
||||
const CustomersPage({super.key, required this.sync, this.s = const WorkSettings()});
|
||||
const CustomersPage({super.key, required this.sync});
|
||||
final SyncService sync;
|
||||
final WorkSettings s;
|
||||
WorkSettings get s => WorkSettings.of(sync.store); // the dashboard's, synced
|
||||
@override
|
||||
State<CustomersPage> createState() => _CustomersPageState();
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@ class _CustomersPageState extends State<CustomersPage> {
|
|||
void _edit({String? id, String kind = 'client', String? parent}) => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (_) => NodeEditor(sync: widget.sync, s: widget.s, nodeId: id, kind: kind, parent: parent),
|
||||
builder: (_) => NodeEditor(sync: widget.sync, nodeId: id, kind: kind, parent: parent),
|
||||
),
|
||||
);
|
||||
|
||||
|
|
@ -112,9 +112,9 @@ class _CustomersPageState extends State<CustomersPage> {
|
|||
|
||||
/// One node's editor (new when [nodeId] is null: a [kind] under [parent]).
|
||||
class NodeEditor extends StatefulWidget {
|
||||
const NodeEditor({super.key, required this.sync, this.s = const WorkSettings(), this.nodeId, this.kind = 'client', this.parent});
|
||||
const NodeEditor({super.key, required this.sync, this.nodeId, this.kind = 'client', this.parent});
|
||||
final SyncService sync;
|
||||
final WorkSettings s;
|
||||
WorkSettings get s => WorkSettings.of(sync.store); // the dashboard's, synced
|
||||
final String? nodeId, kind, parent;
|
||||
@override
|
||||
State<NodeEditor> createState() => _NodeEditorState();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue