Refactor: Implement multi-item inventory for Pad Tracker and dynamic navigation

This commit is contained in:
2026-01-02 18:10:50 -06:00
parent 56683f5407
commit 8772b56f36
44 changed files with 3515 additions and 781 deletions

View File

@@ -0,0 +1,63 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../models/user_profile.dart'; // Import UserProfile
import '../../providers/user_provider.dart';
class NotificationSettingsScreen extends ConsumerWidget {
const NotificationSettingsScreen({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final userProfile = ref.watch(userProfileProvider);
if (userProfile == null) {
return Scaffold(
appBar: AppBar(title: const Text('Notifications')),
body: const Center(child: CircularProgressIndicator()),
);
}
return Scaffold(
appBar: AppBar(
title: const Text('Notifications'),
),
body: ListView(
padding: const EdgeInsets.all(16.0),
children: [
SwitchListTile(
title: const Text('Period Estimate'),
subtitle: const Text('Get notified when your period is predicted to start soon.'),
value: userProfile.notifyPeriodEstimate,
onChanged: (value) async {
await ref
.read(userProfileProvider.notifier)
.updateProfile(userProfile.copyWith(notifyPeriodEstimate: value));
},
),
const Divider(),
SwitchListTile(
title: const Text('Period Start'),
subtitle: const Text('Get notified when a period starts (or husband needs to know).'),
value: userProfile.notifyPeriodStart,
onChanged: (value) async {
await ref
.read(userProfileProvider.notifier)
.updateProfile(userProfile.copyWith(notifyPeriodStart: value));
},
),
const Divider(),
SwitchListTile(
title: const Text('Low Supply Alert'),
subtitle: const Text('Get notified when pad inventory is running low.'),
value: userProfile.notifyLowSupply,
onChanged: (value) async {
await ref
.read(userProfileProvider.notifier)
.updateProfile(userProfile.copyWith(notifyLowSupply: value));
},
),
],
),
);
}
}