feat: implement base architecture and core repositories for weapon tracking and target analysis functionality
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
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 '../../services/wallet_identity_service.dart';
|
||||
import '../garage/weapon_list_screen.dart';
|
||||
|
||||
class SettingsScreen extends StatefulWidget {
|
||||
const SettingsScreen({super.key});
|
||||
@@ -81,6 +84,49 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
void _showThemeDialog() {
|
||||
final themeProvider = context.read<ThemeProvider>();
|
||||
|
||||
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'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildThemeOption(ThemeMode mode, String label, IconData icon) {
|
||||
final themeProvider = context.watch<ThemeProvider>();
|
||||
final isSelected = themeProvider.themeMode == mode;
|
||||
|
||||
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,
|
||||
onTap: () {
|
||||
themeProvider.setThemeMode(mode);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void _showIdentityDialog() {
|
||||
if (_identityPhrase == null) return;
|
||||
|
||||
@@ -218,14 +264,29 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
subtitle: _identityPhrase != null ? 'Phrase de 15 mots générée' : 'Génération en cours...',
|
||||
onTap: _showIdentityDialog,
|
||||
),
|
||||
Consumer<ThemeProvider>(
|
||||
builder: (context, themeProvider, child) {
|
||||
return _buildSettingsTile(
|
||||
context: context,
|
||||
icon: Icons.color_lens_outlined,
|
||||
title: 'Apparence',
|
||||
subtitle: themeProvider.themeModeName,
|
||||
onTap: _showThemeDialog,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
_buildSectionHeader('Gestion'),
|
||||
_buildSettingsTile(
|
||||
context: context,
|
||||
icon: Icons.color_lens_outlined,
|
||||
title: 'Apparence',
|
||||
subtitle: 'Thème clair/sombre (à venir)',
|
||||
onTap: () {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Fonctionnalité en développement')),
|
||||
icon: Icons.shield_outlined,
|
||||
title: 'Mon Armurerie',
|
||||
subtitle: 'Gérer mes armes et équipements',
|
||||
onTap: () async {
|
||||
await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (_) => const WeaponListScreen()),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user