feat: implement AI export service and establish project navigation and theming infrastructure + acces internet
Build & Release Android APK / build-apk (push) Successful in 23m34s
Build & Release Android APK / build-apk (push) Successful in 23m34s
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import '../../core/theme/theme_provider.dart';
|
||||
import 'dart:convert';
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import '../../core/constants/app_constants.dart';
|
||||
import '../../core/theme/app_theme.dart';
|
||||
import '../../core/theme/theme_provider.dart';
|
||||
import '../../core/widgets/glass_container.dart';
|
||||
import '../../services/wallet_identity_service.dart';
|
||||
import '../garage/weapon_list_screen.dart';
|
||||
|
||||
@@ -165,76 +165,203 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
void _showThemeDialog() {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('Apparence'),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
_buildThemeOption(ThemeMode.system, 'Automatique', Icons.brightness_auto),
|
||||
_buildThemeOption(ThemeMode.light, 'Clair', Icons.light_mode),
|
||||
_buildThemeOption(ThemeMode.dark, 'Sombre', Icons.dark_mode),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: const Text('Fermer'),
|
||||
),
|
||||
],
|
||||
builder: (dialogCtx) => Consumer<ThemeProvider>(
|
||||
builder: (context, themeProvider, child) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final primary = themeProvider.primaryColor;
|
||||
|
||||
return AlertDialog(
|
||||
backgroundColor: isDark ? AppTheme.darkSurface : AppTheme.lightSurface,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
|
||||
title: Text(
|
||||
'Personnalisation & Thème',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w800,
|
||||
color: isDark ? AppTheme.darkTextPrimary : AppTheme.lightTextPrimary,
|
||||
),
|
||||
),
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'MODE D\'AFFICHAGE',
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: primary,
|
||||
letterSpacing: 1.0,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
_buildThemeOption(themeProvider, ThemeMode.system, 'Automatique (Système)', Icons.brightness_auto),
|
||||
_buildThemeOption(themeProvider, ThemeMode.light, 'Clair', Icons.light_mode_outlined),
|
||||
_buildThemeOption(themeProvider, ThemeMode.dark, 'Sombre (Stand de Tir)', Icons.dark_mode_outlined),
|
||||
const Divider(height: 24),
|
||||
Text(
|
||||
'COULEUR D\'ACCENTUATION',
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: primary,
|
||||
letterSpacing: 1.0,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
children: AppAccentColor.allAccents.map((accent) {
|
||||
final isSelected = themeProvider.currentAccent.id == accent.id;
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
themeProvider.setAccent(accent);
|
||||
},
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 7),
|
||||
decoration: BoxDecoration(
|
||||
color: accent.color.withValues(alpha: isSelected ? 0.22 : 0.08),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(
|
||||
color: isSelected ? accent.color : Colors.transparent,
|
||||
width: 1.5,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
width: 14,
|
||||
height: 14,
|
||||
decoration: BoxDecoration(
|
||||
color: accent.color,
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
if (isSelected)
|
||||
BoxShadow(
|
||||
color: accent.color.withValues(alpha: 0.6),
|
||||
blurRadius: 6,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
accent.name,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: isSelected ? FontWeight.w800 : FontWeight.w500,
|
||||
color: isSelected ? accent.color : (isDark ? AppTheme.darkTextPrimary : AppTheme.lightTextPrimary),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(dialogCtx),
|
||||
child: Text('Fermer', style: TextStyle(color: primary, fontWeight: FontWeight.bold)),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildThemeOption(ThemeMode mode, String label, IconData icon) {
|
||||
final themeProvider = context.watch<ThemeProvider>();
|
||||
Widget _buildThemeOption(
|
||||
ThemeProvider themeProvider,
|
||||
ThemeMode mode,
|
||||
String label,
|
||||
IconData icon,
|
||||
) {
|
||||
final isSelected = themeProvider.themeMode == mode;
|
||||
|
||||
final primary = themeProvider.primaryColor;
|
||||
final isDark = themeProvider.themeMode == ThemeMode.dark ||
|
||||
(themeProvider.themeMode == ThemeMode.system &&
|
||||
WidgetsBinding.instance.platformDispatcher.platformBrightness == Brightness.dark);
|
||||
|
||||
return ListTile(
|
||||
leading: Icon(icon, color: isSelected ? AppTheme.primaryColor : null),
|
||||
title: Text(label, style: TextStyle(
|
||||
fontWeight: isSelected ? FontWeight.bold : FontWeight.normal,
|
||||
color: isSelected ? AppTheme.primaryColor : null,
|
||||
)),
|
||||
trailing: isSelected ? const Icon(Icons.check, color: AppTheme.primaryColor) : null,
|
||||
dense: true,
|
||||
contentPadding: EdgeInsets.zero,
|
||||
leading: Icon(icon, color: isSelected ? primary : (isDark ? AppTheme.darkTextSecondary : AppTheme.lightTextSecondary), size: 20),
|
||||
title: Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: isSelected ? FontWeight.w800 : FontWeight.w500,
|
||||
color: isSelected ? primary : (isDark ? AppTheme.darkTextPrimary : AppTheme.lightTextPrimary),
|
||||
),
|
||||
),
|
||||
trailing: isSelected ? Icon(Icons.check_circle, color: primary, size: 20) : null,
|
||||
onTap: () {
|
||||
themeProvider.setThemeMode(mode);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void _showIdentityDialog() {
|
||||
if (_identityPhrase == null) return;
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final primary = Theme.of(context).colorScheme.primary;
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('Votre Identité Unique', textAlign: TextAlign.center),
|
||||
backgroundColor: isDark ? AppTheme.darkSurface : AppTheme.lightSurface,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
|
||||
title: Text(
|
||||
'Votre Identité Unique',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w800,
|
||||
color: isDark ? AppTheme.darkTextPrimary : AppTheme.lightTextPrimary,
|
||||
),
|
||||
),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(Icons.security, size: 48, color: AppTheme.primaryColor),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(14),
|
||||
decoration: BoxDecoration(
|
||||
color: primary.withValues(alpha: 0.15),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(Icons.security, size: 36, color: primary),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const Text(
|
||||
Text(
|
||||
'Cette phrase de 15 mots vous identifie de manière unique. Ne la partagez qu\'en cas de besoin.',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 14, color: Colors.grey),
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: isDark ? AppTheme.darkTextSecondary : AppTheme.lightTextSecondary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 20),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.withAlpha(20),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: AppTheme.primaryColor.withAlpha(100)),
|
||||
color: primary.withValues(alpha: isDark ? 0.15 : 0.08),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: primary.withValues(alpha: 0.35)),
|
||||
),
|
||||
child: Text(
|
||||
_identityPhrase!,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w700,
|
||||
letterSpacing: 0.5,
|
||||
height: 1.5,
|
||||
color: isDark ? AppTheme.darkTextPrimary : AppTheme.lightTextPrimary,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
@@ -244,11 +371,16 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: const Text('Fermer'),
|
||||
child: Text('Fermer', style: TextStyle(color: isDark ? AppTheme.darkTextSecondary : AppTheme.lightTextSecondary)),
|
||||
),
|
||||
ElevatedButton.icon(
|
||||
icon: const Icon(Icons.copy, size: 18),
|
||||
label: const Text('Copier'),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: primary,
|
||||
foregroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
),
|
||||
onPressed: () {
|
||||
_copyToClipboard();
|
||||
Navigator.pop(context);
|
||||
@@ -260,10 +392,15 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
}
|
||||
|
||||
void _showOptInDisclaimer(bool value) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final primary = Theme.of(context).colorScheme.primary;
|
||||
|
||||
if (_isBanned) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
backgroundColor: isDark ? AppTheme.darkSurface : AppTheme.lightSurface,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
|
||||
title: const Row(
|
||||
children: [
|
||||
Icon(Icons.block, color: AppTheme.errorColor),
|
||||
@@ -299,14 +436,23 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => AlertDialog(
|
||||
backgroundColor: isDark ? AppTheme.darkSurface : AppTheme.lightSurface,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
|
||||
title: const Text('Participer à l\'entraînement IA', textAlign: TextAlign.center),
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Center(
|
||||
child: Icon(Icons.psychology, size: 48, color: AppTheme.primaryColor),
|
||||
Center(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: primary.withValues(alpha: 0.15),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(Icons.psychology, size: 40, color: primary),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const Text(
|
||||
@@ -369,7 +515,11 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
child: const Text('Refuser', style: TextStyle(color: Colors.grey)),
|
||||
),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(backgroundColor: AppTheme.primaryColor),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: primary,
|
||||
foregroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
),
|
||||
onPressed: () {
|
||||
_walletService.setUploadEnabled(true);
|
||||
setState(() {
|
||||
@@ -383,7 +533,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
),
|
||||
);
|
||||
},
|
||||
child: const Text('J\'accepte les règles', style: TextStyle(color: Colors.white)),
|
||||
child: const Text('J\'accepte les règles'),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -391,10 +541,15 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
}
|
||||
|
||||
void _showEditServerUrlDialog() {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final primary = Theme.of(context).colorScheme.primary;
|
||||
final urlController = TextEditingController(text: _serverUrl);
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
backgroundColor: isDark ? AppTheme.darkSurface : AppTheme.lightSurface,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
|
||||
title: const Text('Adresse du Serveur IA'),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -425,7 +580,11 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
child: const Text('Annuler'),
|
||||
),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(backgroundColor: AppTheme.primaryColor),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: primary,
|
||||
foregroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
),
|
||||
onPressed: () async {
|
||||
final newUrl = urlController.text.trim();
|
||||
if (newUrl.isNotEmpty) {
|
||||
@@ -446,24 +605,26 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
),
|
||||
);
|
||||
},
|
||||
child: const Text('Enregistrer', style: TextStyle(color: Colors.white)),
|
||||
child: const Text('Enregistrer'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Rapport de bug autonome : on collecte une description + les infos
|
||||
// techniques, et on copie un rapport prêt à coller dans un email de support.
|
||||
void _showReportBugDialog() {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final primary = Theme.of(context).colorScheme.primary;
|
||||
final descController = TextEditingController();
|
||||
const supportEmail = 'monadressemaildesupport@nomdelapplication.com';
|
||||
const appVersion = '1.0.0';
|
||||
const appVersion = '1.0.3';
|
||||
final platform = Theme.of(context).platform.name;
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
backgroundColor: isDark ? AppTheme.darkSurface : AppTheme.lightSurface,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
|
||||
title: const Text('Signaler un bug'),
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
@@ -499,6 +660,11 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
ElevatedButton.icon(
|
||||
icon: const Icon(Icons.copy, size: 18),
|
||||
label: const Text('Copier le rapport'),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: primary,
|
||||
foregroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
),
|
||||
onPressed: () {
|
||||
final desc = descController.text.trim();
|
||||
final report = StringBuffer()
|
||||
@@ -528,14 +694,17 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final primary = Theme.of(context).colorScheme.primary;
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Paramètres'),
|
||||
),
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.all(AppConstants.defaultPadding),
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 40),
|
||||
children: [
|
||||
_buildSectionHeader('Identité'),
|
||||
_buildSectionHeader('IDENTITÉ & COMPTE', primary),
|
||||
_buildSettingsTile(
|
||||
context: context,
|
||||
icon: Icons.fingerprint,
|
||||
@@ -543,25 +712,128 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
subtitle: _identityPhrase != null ? 'Phrase de 15 mots générée' : 'Génération en cours...',
|
||||
onTap: _showIdentityDialog,
|
||||
),
|
||||
|
||||
const SizedBox(height: 20),
|
||||
_buildSectionHeader('PERSONNALISATION & THÈME', primary),
|
||||
Consumer<ThemeProvider>(
|
||||
builder: (context, themeProvider, child) {
|
||||
return _buildSettingsTile(
|
||||
context: context,
|
||||
icon: Icons.color_lens_outlined,
|
||||
title: 'Apparence',
|
||||
subtitle: themeProvider.themeModeName,
|
||||
onTap: _showThemeDialog,
|
||||
return GlassContainer(
|
||||
borderRadius: 16,
|
||||
blur: 12,
|
||||
margin: const EdgeInsets.only(bottom: 10),
|
||||
padding: const EdgeInsets.all(16),
|
||||
glowColor: primary,
|
||||
borderColor: isDark ? primary.withValues(alpha: 0.2) : primary.withValues(alpha: 0.12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: _showThemeDialog,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: primary.withValues(alpha: isDark ? 0.2 : 0.12),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Icon(Icons.palette_outlined, color: primary, size: 22),
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Apparence',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: isDark ? AppTheme.darkTextPrimary : AppTheme.lightTextPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
'${themeProvider.themeModeName} • ${themeProvider.currentAccent.name}',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: isDark ? AppTheme.darkTextSecondary : AppTheme.lightTextSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.chevron_right,
|
||||
color: isDark ? AppTheme.darkTextMuted : AppTheme.lightTextMuted,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
const Divider(height: 1),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
'Couleur d\'accent active :',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: isDark ? AppTheme.darkTextSecondary : AppTheme.lightTextSecondary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
children: AppAccentColor.allAccents.map((accent) {
|
||||
final isSelected = themeProvider.currentAccent.id == accent.id;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 10),
|
||||
child: GestureDetector(
|
||||
onTap: () => themeProvider.setAccent(accent),
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
width: 36,
|
||||
height: 36,
|
||||
decoration: BoxDecoration(
|
||||
color: accent.color,
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
color: isSelected ? Colors.white : Colors.transparent,
|
||||
width: 2.5,
|
||||
),
|
||||
boxShadow: [
|
||||
if (isSelected)
|
||||
BoxShadow(
|
||||
color: accent.color.withValues(alpha: 0.65),
|
||||
blurRadius: 10,
|
||||
spreadRadius: 1,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: isSelected
|
||||
? const Icon(Icons.check, color: Colors.white, size: 18)
|
||||
: null,
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
_buildSectionHeader('Gestion'),
|
||||
const SizedBox(height: 20),
|
||||
_buildSectionHeader('ARMURERIE & MATÉRIEL', primary),
|
||||
_buildSettingsTile(
|
||||
context: context,
|
||||
icon: Icons.shield_outlined,
|
||||
title: 'Mon Armurerie',
|
||||
subtitle: 'Gérer mes armes et équipements',
|
||||
subtitle: 'Gérer mes armes, calibres et optiques',
|
||||
onTap: () async {
|
||||
await Navigator.push(
|
||||
context,
|
||||
@@ -570,14 +842,14 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
},
|
||||
),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
_buildSectionHeader('Programme d\'Entraînement IA'),
|
||||
const SizedBox(height: 20),
|
||||
_buildSectionHeader('PROGRAMME D\'ENTRAÎNEMENT IA', primary),
|
||||
if (_isBanned) ...[
|
||||
Card(
|
||||
elevation: 0,
|
||||
color: AppTheme.errorColor.withValues(alpha: 0.12),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
side: BorderSide(color: AppTheme.errorColor.withValues(alpha: 0.6), width: 1.5),
|
||||
),
|
||||
child: Padding(
|
||||
@@ -631,7 +903,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
foregroundColor: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
),
|
||||
onPressed: _isCheckingStatus ? null : _refreshAccountStatus,
|
||||
@@ -642,21 +914,38 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
),
|
||||
),
|
||||
] else ...[
|
||||
Card(
|
||||
elevation: 0,
|
||||
color: Colors.transparent,
|
||||
margin: const EdgeInsets.only(bottom: 8.0),
|
||||
GlassContainer(
|
||||
borderRadius: 16,
|
||||
blur: 10,
|
||||
margin: const EdgeInsets.only(bottom: 10),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 4),
|
||||
child: SwitchListTile(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 4.0),
|
||||
title: const Text('Participer à l\'entraînement IA', style: TextStyle(fontWeight: FontWeight.w500)),
|
||||
subtitle: const Text('Aidez-nous à améliorer la détection (soumis aux règles strictes)', style: TextStyle(fontSize: 12)),
|
||||
secondary: const Icon(Icons.psychology, color: AppTheme.textPrimary),
|
||||
value: _isUploadEnabled,
|
||||
activeThumbColor: AppTheme.primaryColor,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
side: BorderSide(color: Colors.grey.withAlpha(50), width: 1),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 4.0),
|
||||
title: Text(
|
||||
'Participer à l\'entraînement IA',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 14,
|
||||
color: isDark ? AppTheme.darkTextPrimary : AppTheme.lightTextPrimary,
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
'Aidez-nous à améliorer la détection automatique',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: isDark ? AppTheme.darkTextSecondary : AppTheme.lightTextSecondary,
|
||||
),
|
||||
),
|
||||
secondary: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: primary.withValues(alpha: isDark ? 0.2 : 0.12),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Icon(Icons.psychology, color: primary, size: 22),
|
||||
),
|
||||
value: _isUploadEnabled,
|
||||
activeThumbColor: primary,
|
||||
onChanged: _showOptInDisclaimer,
|
||||
),
|
||||
),
|
||||
@@ -692,20 +981,20 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
),
|
||||
],
|
||||
|
||||
const SizedBox(height: 24),
|
||||
_buildSectionHeader('À propos'),
|
||||
const SizedBox(height: 20),
|
||||
_buildSectionHeader('À PROPOS', primary),
|
||||
_buildSettingsTile(
|
||||
context: context,
|
||||
icon: Icons.info_outline,
|
||||
title: 'Version de l\'application',
|
||||
subtitle: '1.0.0',
|
||||
subtitle: '1.0.3 (Design Tactical & Precision)',
|
||||
onTap: () {},
|
||||
),
|
||||
_buildSettingsTile(
|
||||
context: context,
|
||||
icon: Icons.bug_report_outlined,
|
||||
title: 'Signaler un bug',
|
||||
subtitle: 'Aidez-nous à corriger les problèmes',
|
||||
subtitle: 'Aidez-nous à corriger les anomalies',
|
||||
onTap: _showReportBugDialog,
|
||||
),
|
||||
_buildSettingsTile(
|
||||
@@ -719,15 +1008,16 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSectionHeader(String title) {
|
||||
Widget _buildSectionHeader(String title, Color primary) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 4.0),
|
||||
padding: const EdgeInsets.fromLTRB(4, 8, 4, 10),
|
||||
child: Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppTheme.primaryColor,
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w800,
|
||||
color: primary,
|
||||
letterSpacing: 1.0,
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -740,21 +1030,57 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
String? subtitle,
|
||||
required VoidCallback onTap,
|
||||
}) {
|
||||
return Card(
|
||||
elevation: 0,
|
||||
color: Colors.transparent,
|
||||
margin: const EdgeInsets.only(bottom: 8.0),
|
||||
child: ListTile(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 4.0),
|
||||
leading: Icon(icon, color: AppTheme.textPrimary),
|
||||
title: Text(title, style: const TextStyle(fontWeight: FontWeight.w500)),
|
||||
subtitle: subtitle != null ? Text(subtitle, style: const TextStyle(fontSize: 12)) : null,
|
||||
trailing: const Icon(Icons.chevron_right, color: Colors.grey),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
side: BorderSide(color: Colors.grey.withAlpha(50), width: 1),
|
||||
),
|
||||
onTap: onTap,
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final primary = Theme.of(context).colorScheme.primary;
|
||||
|
||||
return GlassContainer(
|
||||
borderRadius: 16,
|
||||
blur: 10,
|
||||
margin: const EdgeInsets.only(bottom: 10),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
|
||||
onTap: onTap,
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(9),
|
||||
decoration: BoxDecoration(
|
||||
color: primary.withValues(alpha: isDark ? 0.2 : 0.12),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Icon(icon, color: primary, size: 20),
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: isDark ? AppTheme.darkTextPrimary : AppTheme.lightTextPrimary,
|
||||
),
|
||||
),
|
||||
if (subtitle != null) ...[
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
subtitle,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: isDark ? AppTheme.darkTextSecondary : AppTheme.lightTextSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.chevron_right,
|
||||
color: isDark ? AppTheme.darkTextMuted : AppTheme.lightTextMuted,
|
||||
size: 20,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user