Add profile in parameters, initialized page map, group, count.

This commit is contained in:
Van Leemput Dayron
2025-10-01 12:21:00 +02:00
parent 3f7ca54a70
commit ad9393a925
9 changed files with 377 additions and 42 deletions

View File

@@ -0,0 +1,13 @@
import 'package:flutter/material.dart';
class CountContent extends StatelessWidget {
const CountContent({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Count Page')),
body: const Center(child: Text('This is the Count Page')),
);
}
}

View File

@@ -0,0 +1,13 @@
import 'package:flutter/material.dart';
class GroupContent extends StatelessWidget {
const GroupContent({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Group Page')),
body: const Center(child: Text('This is the Group Page')),
);
}
}

View File

@@ -0,0 +1,24 @@
import 'package:flutter/material.dart';
class MapContent extends StatelessWidget {
const MapContent({super.key});
@override
Widget build(BuildContext context) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.map, size: 80, color: Colors.green),
SizedBox(height: 20),
Text(
'Page de la Carte',
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
),
SizedBox(height: 10),
Text('Ici sera intégrée Google Maps'),
],
),
);
}
}

View File

@@ -1,32 +1,242 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../providers/user_provider.dart';
class ProfileContent extends StatelessWidget {
const ProfileContent({super.key});
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.all(16),
child: Center(
child: Column(
return Consumer<UserProvider>(
builder: (context, userProvider, child) {
final user = userProvider.currentUser;
if (user == null) {
return Center(child: Text('Aucun utilisateur connecté'));
}
return Column(
children: [
CircleAvatar(
radius: 50,
backgroundColor: Colors.blue,
child: Icon(Icons.person, size: 50, color: Colors.white),
// Section titre
Padding(
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Row(
children: [
Text(
'Profil utilisateur',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.grey[600],
),
),
],
),
),
SizedBox(height: 20),
Text(
'Nom d\'utilisateur',
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
// Card du profil
Card(
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Padding(
padding: EdgeInsets.all(16),
child: Column(
children: [
// Photo de profil
CircleAvatar(
radius: 40,
backgroundColor: Theme.of(context).colorScheme.primary,
child: Text(
user.prenom[0].toUpperCase() +
user.nom[0].toUpperCase(),
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),
SizedBox(height: 16),
// Nom complet
Text(
user.fullName,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 8),
// Email
Text(
user.email,
style: TextStyle(fontSize: 14, color: Colors.grey[600]),
),
],
),
),
),
// Actions du profil
ListTile(
leading: Icon(Icons.edit),
title: Text('Modifier le profil'),
trailing: Icon(Icons.arrow_forward_ios),
onTap: () {
_showEditProfileDialog(context, user);
},
),
ListTile(
leading: Icon(Icons.lock),
title: Text('Changer le mot de passe'),
trailing: Icon(Icons.arrow_forward_ios),
onTap: () {
_showChangePasswordDialog(context);
},
),
Divider(),
ListTile(
leading: Icon(Icons.delete, color: Colors.red),
title: Text('Supprimer le compte'),
trailing: Icon(Icons.arrow_forward_ios),
onTap: () {
_showDeleteAccountDialog(context);
},
),
SizedBox(height: 10),
Text('email@example.com'),
SizedBox(height: 30),
ElevatedButton(onPressed: () {}, child: Text('Modifier le profil')),
],
),
),
);
},
);
}
void _showEditProfileDialog(BuildContext context, user) {
final nomController = TextEditingController(text: user.nom);
final prenomController = TextEditingController(text: user.prenom);
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text('Modifier le profil'),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
TextField(
controller: prenomController,
decoration: InputDecoration(labelText: 'Prénom'),
),
SizedBox(height: 16),
TextField(
controller: nomController,
decoration: InputDecoration(labelText: 'Nom'),
),
],
),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: Text('Annuler'),
),
TextButton(
onPressed: () {
// TODO: Implémenter la mise à jour
Navigator.of(context).pop();
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text('Profil mis à jour !')));
},
child: Text('Sauvegarder'),
),
],
);
},
);
}
void _showChangePasswordDialog(BuildContext context) {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text('Changer le mot de passe'),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
TextField(
obscureText: true,
decoration: InputDecoration(labelText: 'Mot de passe actuel'),
),
SizedBox(height: 16),
TextField(
obscureText: true,
decoration: InputDecoration(labelText: 'Nouveau mot de passe'),
),
SizedBox(height: 16),
TextField(
obscureText: true,
decoration: InputDecoration(
labelText: 'Confirmer le mot de passe',
),
),
],
),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: Text('Annuler'),
),
TextButton(
onPressed: () {
// TODO: Implémenter le changement de mot de passe
Navigator.of(context).pop();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Mot de passe changé !')),
);
},
child: Text('Changer'),
),
],
);
},
);
}
void _showDeleteAccountDialog(BuildContext context) {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text('Supprimer le compte'),
content: Text(
'Êtes-vous sûr de vouloir supprimer votre compte ? Cette action est irréversible.',
),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: Text('Annuler'),
),
TextButton(
onPressed: () {
Navigator.of(context).pop();
// TODO: Implémenter la suppression
Provider.of<UserProvider>(context, listen: false).logout();
Navigator.pushNamedAndRemoveUntil(
context,
'/login',
(route) => false,
);
},
style: TextButton.styleFrom(foregroundColor: Colors.red),
child: Text('Supprimer'),
),
],
);
},
);
}
}

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'settings_theme_content.dart';
import '../profile/profile_content.dart';
class SettingsContent extends StatelessWidget {
const SettingsContent({super.key});
@@ -15,6 +16,22 @@ class SettingsContent extends StatelessWidget {
),
SizedBox(height: 20),
// Section Profil intégrée
ProfileContent(),
SizedBox(height: 20),
// Autres paramètres
Text(
'Préférences',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.grey[600],
),
),
SizedBox(height: 8),
ListTile(
leading: Icon(Icons.palette),
title: Text('Thème'),
@@ -28,13 +45,6 @@ class SettingsContent extends StatelessWidget {
},
),
ListTile(
leading: Icon(Icons.person),
title: Text('Profil'),
trailing: Icon(Icons.arrow_forward_ios),
onTap: () {},
),
ListTile(
leading: Icon(Icons.notifications),
title: Text('Notifications'),