From f86bce48778023263bcf132541906bb87995206a Mon Sep 17 00:00:00 2001 From: b3ni15 Date: Wed, 18 Mar 2026 22:11:42 +0100 Subject: [PATCH] Enhance demo mode to load demo data into providers without API calls --- refilc/lib/api/providers/sync.dart | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/refilc/lib/api/providers/sync.dart b/refilc/lib/api/providers/sync.dart index d60e930e..251912b5 100644 --- a/refilc/lib/api/providers/sync.dart +++ b/refilc/lib/api/providers/sync.dart @@ -37,8 +37,18 @@ Future syncAll(BuildContext context) async { UserProvider user = Provider.of(context, listen: false); - // Demo mode: skip all API calls + // Demo mode: load demo data into providers without API calls if (user.isDemo) { + await Provider.of(context, listen: false).fetch(); + await Provider.of(context, listen: false) + .fetch(week: Week.current()); + await Provider.of(context, listen: false).fetch(); + await Provider.of(context, listen: false) + .fetch(from: DateTime.now().subtract(const Duration(days: 30))); + await Provider.of(context, listen: false).fetchAll(); + await Provider.of(context, listen: false).fetch(); + await Provider.of(context, listen: false).fetch(); + await Provider.of(context, listen: false).fetch(); lock = false; return Future.value(); }