98 lines
3.2 KiB
Dart
98 lines
3.2 KiB
Dart
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> _launchCustomPrivacyPolicy() async {
|
|
final Uri url = Uri.parse('https://xeewy.be/travelmate/policies');
|
|
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: [
|
|
// Keep only the buttons
|
|
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: 12),
|
|
// Bouton Nos politiques de confidentialité
|
|
SizedBox(
|
|
width: double.infinity,
|
|
child: ElevatedButton.icon(
|
|
onPressed: _launchCustomPrivacyPolicy,
|
|
icon: const Icon(Icons.policy),
|
|
label: const Text('Nos politiques de confidentialités'),
|
|
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),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|