Add PoliciesContent component and integrate it into SettingsContent for privacy policy display

This commit is contained in:
Van Leemput Dayron
2025-11-06 12:01:12 +01:00
parent 75bdf591f3
commit 3b633f10e4
2 changed files with 202 additions and 7 deletions

View File

@@ -0,0 +1,172 @@
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
class PoliciesContent extends StatelessWidget {
const PoliciesContent({super.key});
Future<void> _launchGooglePrivacyPolicy() async {
final Uri url = Uri.parse('https://policies.google.com/privacy');
if (!await launchUrl(url)) {
throw Exception('Could not launch $url');
}
}
Future<void> _onBackPressed(BuildContext context) async {
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
}
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final isDark = theme.brightness == Brightness.dark;
return Scaffold(
backgroundColor: theme.scaffoldBackgroundColor,
appBar: AppBar(
backgroundColor: theme.appBarTheme.backgroundColor,
elevation: 0,
title: Text(
'Politiques de confidentialité',
style: TextStyle(
color: isDark ? Colors.white : Colors.black,
fontWeight: FontWeight.w600,
),
),
leading: IconButton(
icon: Icon(Icons.arrow_back, color: theme.iconTheme.color),
onPressed: () => _onBackPressed(context),
),
),
body: SingleChildScrollView(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Section Collecte d'informations
Text(
'Collecte d\'informations',
style: theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w600,
color: isDark ? Colors.white : Colors.black,
),
),
const SizedBox(height: 10),
Text(
'Nous collectons des informations que vous nous fournissez directement, comme votre nom, adresse e-mail et préférences de voyage.',
style: theme.textTheme.bodyLarge?.copyWith(
color: isDark ? Colors.grey[300] : Colors.grey[800],
),
),
const SizedBox(height: 20),
// Section Utilisation des données
Text(
'Utilisation des données',
style: theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w600,
color: isDark ? Colors.white : Colors.black,
),
),
const SizedBox(height: 10),
Text(
'Vos données sont utilisées pour améliorer votre expérience utilisateur et vous proposer des recommandations personnalisées.',
style: theme.textTheme.bodyLarge?.copyWith(
color: isDark ? Colors.grey[300] : Colors.grey[800],
),
),
const SizedBox(height: 20),
// Section Protection des données
Text(
'Protection des données',
style: theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w600,
color: isDark ? Colors.white : Colors.black,
),
),
const SizedBox(height: 10),
Text(
'Nous mettons en place des mesures de sécurité appropriées pour protéger vos informations personnelles.',
style: theme.textTheme.bodyLarge?.copyWith(
color: isDark ? Colors.grey[300] : Colors.grey[800],
),
),
const SizedBox(height: 20),
// Section Partage des données
Text(
'Partage des données',
style: theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w600,
color: isDark ? Colors.white : Colors.black,
),
),
const SizedBox(height: 10),
Text(
'Nous ne partageons pas vos informations personnelles avec des tiers sans votre consentement explicite.',
style: theme.textTheme.bodyLarge?.copyWith(
color: isDark ? Colors.grey[300] : Colors.grey[800],
),
),
const SizedBox(height: 20),
// Section Droits de l'utilisateur
Text(
'Vos droits',
style: theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w600,
color: isDark ? Colors.white : Colors.black,
),
),
const SizedBox(height: 10),
Text(
'Vous avez le droit d\'accéder, de corriger ou de supprimer vos données personnelles à tout moment. Veuillez nous contacter pour toute demande.',
style: theme.textTheme.bodyLarge?.copyWith(
color: isDark ? Colors.grey[300] : Colors.grey[800],
),
),
const SizedBox(height: 20),
// Section Contact
Text(
'Nous contacter',
style: theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w600,
color: isDark ? Colors.white : Colors.black,
),
),
const SizedBox(height: 10),
Text(
'Pour toute question concernant cette politique de confidentialité, veuillez nous contacter à support@travelmate.com',
style: theme.textTheme.bodyLarge?.copyWith(
color: isDark ? Colors.grey[300] : Colors.grey[800],
),
),
const SizedBox(height: 20),
// Bouton Google Privacy Policy
SizedBox(
width: double.infinity,
child: ElevatedButton.icon(
onPressed: _launchGooglePrivacyPolicy,
icon: const Icon(Icons.link),
label: const Text('Politique de confidentialité Google'),
style: ElevatedButton.styleFrom(
backgroundColor: theme.primaryColor,
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(vertical: 12),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
),
),
const SizedBox(height: 32),
],
),
),
);
}
}

View File

@@ -1,21 +1,20 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:travel_mate/components/settings/policies/policies_content.dart';
import 'settings_theme_content.dart'; import 'settings_theme_content.dart';
import 'profile/profile_content.dart'; import 'profile/profile_content.dart';
class SettingsContent extends StatelessWidget { class SettingsContent extends StatelessWidget {
const SettingsContent({super.key}); const SettingsContent({super.key});
Future<void> changePage(BuildContext context, Widget page) async {
Navigator.push(context, MaterialPageRoute(builder: (context) => page));
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListView( return ListView(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
children: [ children: [
const Text(
'Paramètres',
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
),
const SizedBox(height: 20),
// Section Profil intégrée // Section Profil intégrée
const ProfileContent(), const ProfileContent(),
@@ -65,7 +64,31 @@ class SettingsContent extends StatelessWidget {
leading: const Icon(Icons.privacy_tip), leading: const Icon(Icons.privacy_tip),
title: const Text('Confidentialité'), title: const Text('Confidentialité'),
trailing: const Icon(Icons.arrow_forward_ios), trailing: const Icon(Icons.arrow_forward_ios),
onTap: () {}, onTap: () {
changePage(context, const PoliciesContent());
},
),
const SizedBox(height: 30),
Center(
child: Column(
children: [
Text(
'Travel Mate © 2025',
style: TextStyle(fontSize: 16, color: Colors.grey[600]),
),
const SizedBox(height: 4),
Text(
'Version de l\'application',
style: TextStyle(fontSize: 16, color: Colors.grey[600]),
),
const SizedBox(height: 4),
Text(
'1.0.0',
style: TextStyle(fontSize: 14, color: Colors.grey[500]),
),
],
),
), ),
], ],
); );