Files
Tracker/lib/screens/settings/sharing_settings_screen.dart

99 lines
3.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../models/user_profile.dart';
import '../../providers/user_provider.dart';
class SharingSettingsScreen extends ConsumerWidget {
const SharingSettingsScreen({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final userProfile = ref.watch(userProfileProvider);
if (userProfile == null) {
return Scaffold(
appBar: AppBar(
title: const Text('Sharing Settings'),
),
body: const Center(child: CircularProgressIndicator()),
);
}
return Scaffold(
appBar: AppBar(
title: const Text('Sharing Settings'),
),
body: ListView(
padding: const EdgeInsets.all(16.0),
children: [
ListTile(
leading: const Icon(Icons.link),
title: const Text('Link with Husband'),
subtitle: Text(userProfile.partnerName != null ? 'Linked to ${userProfile.partnerName}' : 'Not linked'),
trailing: const Icon(Icons.chevron_right),
onTap: () {
// TODO: Navigate to Link Screen or Show Dialog
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Link feature coming soon!')));
},
),
const Divider(),
SwitchListTile(
title: const Text('Share Moods'),
value: userProfile.shareMoods,
onChanged: (value) {
ref
.read(userProfileProvider.notifier)
.updateProfile(userProfile.copyWith(shareMoods: value));
},
),
SwitchListTile(
title: const Text('Share Symptoms'),
value: userProfile.shareSymptoms,
onChanged: (value) {
ref
.read(userProfileProvider.notifier)
.updateProfile(userProfile.copyWith(shareSymptoms: value));
},
),
SwitchListTile(
title: const Text('Share Cravings'),
value: userProfile.shareCravings,
onChanged: (value) {
ref
.read(userProfileProvider.notifier)
.updateProfile(userProfile.copyWith(shareCravings: value));
},
),
SwitchListTile(
title: const Text('Share Energy Levels'),
value: userProfile.shareEnergyLevels,
onChanged: (value) {
ref
.read(userProfileProvider.notifier)
.updateProfile(userProfile.copyWith(shareEnergyLevels: value));
},
),
SwitchListTile(
title: const Text('Share Sleep Data'),
value: userProfile.shareSleep,
onChanged: (value) {
ref
.read(userProfileProvider.notifier)
.updateProfile(userProfile.copyWith(shareSleep: value));
},
),
SwitchListTile(
title: const Text('Share Intimacy Details'),
value: userProfile.shareIntimacy,
onChanged: (value) {
ref
.read(userProfileProvider.notifier)
.updateProfile(userProfile.copyWith(shareIntimacy: value));
},
),
],
),
);
}
}