Integration fonctionnalités V1 ( resas + gestion machines

This commit is contained in:
bastien
2026-07-03 19:02:48 +02:00
parent 20f383dd62
commit bf191d6396
46 changed files with 4691 additions and 654 deletions
@@ -4,6 +4,7 @@ import 'package:go_router/go_router.dart';
import '../../../core/auth/auth_provider.dart';
import '../../../core/router/app_router.dart';
import '../../../core/theme/app_colors.dart';
/// Écran profil utilisateur et déconnexion.
class ProfileScreen extends ConsumerWidget {
@@ -11,63 +12,73 @@ class ProfileScreen extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final authState = ref.watch(authProvider);
final user = authState.user;
final user = ref.watch(authProvider).user;
return Scaffold(
appBar: AppBar(title: const Text('Mon profil')),
body: ListView(
padding: const EdgeInsets.all(16),
children: [
Card(
child: Padding(
padding: const EdgeInsets.all(24),
child: Column(
children: [
CircleAvatar(
radius: 40,
child: Text(
user != null && user.firstName.isNotEmpty
? user.firstName.substring(0, 1).toUpperCase()
: '?',
style: const TextStyle(fontSize: 32),
return ListView(
padding: const EdgeInsets.all(16),
children: [
Card(
child: Padding(
padding: const EdgeInsets.all(20),
child: Row(
children: [
CircleAvatar(
radius: 28,
backgroundColor: AppColors.primary.withValues(alpha: 0.1),
child: Text(
user != null && user.firstName.isNotEmpty
? user.firstName.substring(0, 1).toUpperCase()
: '?',
style: const TextStyle(
fontSize: 22,
fontWeight: FontWeight.w600,
color: AppColors.primary,
),
),
const SizedBox(height: 16),
Text(
user?.fullName ?? 'Utilisateur',
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(width: 16),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(user?.fullName ?? 'Utilisateur', style: Theme.of(context).textTheme.titleMedium),
if (user?.email != null)
Text(user!.email, style: Theme.of(context).textTheme.bodyMedium),
],
),
if (user?.email != null) ...[
const SizedBox(height: 4),
Text(user!.email),
],
],
),
],
),
),
),
const SizedBox(height: 8),
Card(
child: Column(
children: [
ListTile(
leading: const Icon(Icons.language_outlined, color: AppColors.textSecondary),
title: const Text('Langue'),
trailing: Text(user?.locale ?? 'fr'),
),
),
const Divider(height: 1),
ListTile(
leading: const Icon(Icons.notifications_outlined, color: AppColors.textSecondary),
title: const Text('Notifications'),
trailing: const Icon(Icons.chevron_right, color: AppColors.textSecondary),
onTap: () {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Préférences — à implémenter')),
);
},
),
],
),
const SizedBox(height: 16),
ListTile(
leading: const Icon(Icons.language),
title: const Text('Langue'),
subtitle: Text(user?.locale ?? 'fr'),
),
ListTile(
leading: const Icon(Icons.notifications_outlined),
title: const Text('Notifications'),
onTap: () {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Préférences — à implémenter')),
);
},
),
const Divider(),
ListTile(
leading: Icon(Icons.logout, color: Theme.of(context).colorScheme.error),
title: Text(
'Se déconnecter',
style: TextStyle(color: Theme.of(context).colorScheme.error),
),
),
const SizedBox(height: 8),
Card(
child: ListTile(
leading: const Icon(Icons.logout, color: AppColors.error),
title: const Text('Se déconnecter', style: TextStyle(color: AppColors.error)),
onTap: () async {
await ref.read(authProvider.notifier).logout();
if (context.mounted) {
@@ -75,8 +86,8 @@ class ProfileScreen extends ConsumerWidget {
}
},
),
],
),
),
],
);
}
}