mirror of
https://github.com/vleeuwenmenno/supplements.git
synced 2025-09-11 18:29:12 +02:00
feat: Implement snooze functionality for notifications
- Added snooze duration setting in SettingsScreen. - Created DebugNotificationsScreen to view pending notifications and logs. - Integrated notification logging with NotificationDebugStore. - Enhanced SimpleNotificationService to handle snooze actions and log notifications. - Removed ProfileSetupScreen as it is no longer needed. - Updated NotificationRouter to manage snooze actions without UI. - Refactored settings provider to include snooze duration management.
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../providers/settings_provider.dart';
|
||||
import 'profile_setup_screen.dart';
|
||||
import 'debug_notifications_screen.dart';
|
||||
import 'simple_sync_settings_screen.dart';
|
||||
|
||||
class SettingsScreen extends StatelessWidget {
|
||||
@@ -19,22 +20,25 @@ class SettingsScreen extends StatelessWidget {
|
||||
return ListView(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
children: [
|
||||
Card(
|
||||
child: ListTile(
|
||||
leading: const Icon(Icons.person),
|
||||
title: const Text('Profile'),
|
||||
subtitle: Text('Date of Birth: ${settingsProvider.dateOfBirth != null ? '${settingsProvider.dateOfBirth!.toLocal()}'.split(' ')[0] : 'Not set'}, Gender: ${settingsProvider.gender ?? 'Not set'}'),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const ProfileSetupScreen(),
|
||||
),
|
||||
);
|
||||
},
|
||||
// Debug section (only in debug builds)
|
||||
if (kDebugMode) ...[
|
||||
Card(
|
||||
child: ListTile(
|
||||
leading: const Icon(Icons.bug_report),
|
||||
title: const Text('Debug Notifications'),
|
||||
subtitle: const Text('View scheduled notifications and debug log'),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const DebugNotificationsScreen(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
],
|
||||
Card(
|
||||
child: ListTile(
|
||||
leading: const Icon(Icons.cloud_sync),
|
||||
@@ -100,7 +104,28 @@ class SettingsScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
// Reminders settings removed
|
||||
// Notifications
|
||||
Card(
|
||||
child: ListTile(
|
||||
leading: const Icon(Icons.snooze),
|
||||
title: const Text('Snooze duration'),
|
||||
subtitle: const Text('Delay for Snooze action'),
|
||||
trailing: DropdownButton<int>(
|
||||
value: settingsProvider.snoozeMinutes,
|
||||
items: const [
|
||||
DropdownMenuItem(value: 5, child: Text('5 min')),
|
||||
DropdownMenuItem(value: 10, child: Text('10 min')),
|
||||
DropdownMenuItem(value: 15, child: Text('15 min')),
|
||||
DropdownMenuItem(value: 20, child: Text('20 min')),
|
||||
],
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
settingsProvider.setSnoozeMinutes(value);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Card(
|
||||
child: Padding(
|
||||
|
Reference in New Issue
Block a user