diff --git a/lib/services/yahrtzeits_manager.dart b/lib/services/yahrtzeits_manager.dart index ff18d1e..8af0827 100644 --- a/lib/services/yahrtzeits_manager.dart +++ b/lib/services/yahrtzeits_manager.dart @@ -152,6 +152,17 @@ class YahrtzeitsManager { return _yahrtzeits; } + Future> getAllGroups() async { + await syncWithCalendar(); // Ensure the Yahrtzeits are up-to-date + Set uniqueGroups = {}; + for (var yahrtzeit in _yahrtzeits) { + if (yahrtzeit.group != null && yahrtzeit.group!.isNotEmpty) { + uniqueGroups.add(yahrtzeit.group!); + } + } + return uniqueGroups.toList(); + } + Future> getUpcomingYahrtzeits({int days = 1000}) async { final allYahrtzeits = await getAllYahrtzeits(); final now = tz.TZDateTime.now(tz.local); diff --git a/lib/settings/settings.dart b/lib/settings/settings.dart index 07dfa69..7f6d9c8 100644 --- a/lib/settings/settings.dart +++ b/lib/settings/settings.dart @@ -1,4 +1,3 @@ - import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../localizations/app_localizations.dart'; @@ -63,7 +62,8 @@ class _SettingsPageState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text(AppLocalizations.of(context)!.translate('settings'), style: TextStyle(color: Colors.white)), + title: Text(AppLocalizations.of(context)!.translate('settings'), + style: TextStyle(color: Colors.white)), backgroundColor: Color.fromARGB(255, 50, 4, 129), centerTitle: true, ), @@ -85,13 +85,15 @@ class _SettingsPageState extends State { ], onChanged: (Locale? newValue) { if (newValue != null) { - Provider.of(context, listen: false).setLocale(newValue); + Provider.of(context, listen: false) + .setLocale(newValue); } }, ), ), ListTile( - title: Text(AppLocalizations.of(context)!.translate('jewish_language')), + title: Text( + AppLocalizations.of(context)!.translate('jewish_language')), trailing: DropdownButton( value: _jewishLanguage, items: [ @@ -119,7 +121,7 @@ class _SettingsPageState extends State { ), ), ListTile( - title: Text(AppLocalizations.of(context)!.translate('sync_settings')), + title: Text('Sync: ${widget.syncSettings ? 'on' : 'off'}'), trailing: Switch( value: widget.syncSettings, onChanged: (value) { @@ -152,7 +154,7 @@ class _SettingsPageState extends State { ), ), ListTile( - title: Text(AppLocalizations.of(context)!.translate('notifications')), + title: Text('Notifications: ${widget.notifications ? 'on' : 'off'}'), trailing: Switch( value: widget.notifications, onChanged: (value) { @@ -185,17 +187,20 @@ class _SettingsPageState extends State { ), ), ListTile( - title: Text(AppLocalizations.of(context)!.translate('calendar_settings')), + title: Text( + AppLocalizations.of(context)!.translate('calendar_settings')), trailing: DropdownButton( value: _calendar, items: [ DropdownMenuItem( value: 'google', - child: Text(AppLocalizations.of(context)!.translate('Google Calendar')), + child: Text(AppLocalizations.of(context)! + .translate('Google Calendar')), ), DropdownMenuItem( value: 'device', - child: Text(AppLocalizations.of(context)!.translate('Device Calendar')), + child: Text(AppLocalizations.of(context)! + .translate('Device Calendar')), ), ], onChanged: (value) { @@ -212,4 +217,4 @@ class _SettingsPageState extends State { ), ); } -} \ No newline at end of file +}