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: [ 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)); }, ), ], ), ); } }