refactoring
This commit is contained in:
@@ -7,274 +7,388 @@ class ProfileScreen extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Profil'),
|
||||
backgroundColor: Colors.black,
|
||||
title: const Text('Profil',
|
||||
style: TextStyle(
|
||||
color: Color(0xFF1DBF73), // Définit la couleur verte du texte
|
||||
),
|
||||
),
|
||||
backgroundColor: const Color(0xFF1E1E2C),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.settings),
|
||||
icon: const Icon(Icons.settings, color: Colors.white),
|
||||
onPressed: () {
|
||||
// Naviguer vers la page des paramètres
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
body: CustomScrollView(
|
||||
slivers: [
|
||||
SliverList(
|
||||
delegate: SliverChildListDelegate([
|
||||
// Informations de l'Utilisateur
|
||||
_buildUserInfoSection(context),
|
||||
const Divider(),
|
||||
// Options de Modification
|
||||
_buildEditOptions(context),
|
||||
const Divider(),
|
||||
// Statistiques Personnelles
|
||||
_buildStatisticsSection(context),
|
||||
const Divider(),
|
||||
// Historique
|
||||
_buildHistorySection(context),
|
||||
const Divider(),
|
||||
// Préférences et Paramètres
|
||||
_buildPreferencesSection(context),
|
||||
const Divider(),
|
||||
// Autres Fonctions
|
||||
_buildSupportSection(context),
|
||||
const Divider(),
|
||||
// Suppression de Compte
|
||||
_buildAccountDeletionSection(context),
|
||||
]),
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
children: [
|
||||
_buildUserInfoCard(),
|
||||
const SizedBox(height: 20),
|
||||
_buildEditOptionsCard(),
|
||||
const SizedBox(height: 20),
|
||||
_buildStatisticsSectionCard(),
|
||||
const SizedBox(height: 20),
|
||||
_buildExpandableSectionCard(
|
||||
title: 'Historique',
|
||||
icon: Icons.history,
|
||||
children: [
|
||||
_buildAnimatedListTile(
|
||||
icon: Icons.event_note,
|
||||
label: 'Historique des Événements',
|
||||
onTap: () {
|
||||
// Naviguer vers l'historique des événements
|
||||
},
|
||||
),
|
||||
_buildAnimatedListTile(
|
||||
icon: Icons.history,
|
||||
label: 'Historique des Publications',
|
||||
onTap: () {
|
||||
// Naviguer vers l'historique des publications
|
||||
},
|
||||
),
|
||||
_buildAnimatedListTile(
|
||||
icon: Icons.bookmark,
|
||||
label: 'Historique de Réservations',
|
||||
onTap: () {
|
||||
// Naviguer vers l'historique des réservations
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
_buildExpandableSectionCard(
|
||||
title: 'Préférences et Paramètres',
|
||||
icon: Icons.settings,
|
||||
children: [
|
||||
_buildAnimatedListTile(
|
||||
icon: Icons.privacy_tip,
|
||||
label: 'Paramètres de confidentialité',
|
||||
onTap: () {
|
||||
// Naviguer vers les paramètres de confidentialité
|
||||
},
|
||||
),
|
||||
_buildAnimatedListTile(
|
||||
icon: Icons.notifications,
|
||||
label: 'Notifications',
|
||||
onTap: () {
|
||||
// Naviguer vers les paramètres de notification
|
||||
},
|
||||
),
|
||||
_buildAnimatedListTile(
|
||||
icon: Icons.language,
|
||||
label: 'Langue de l\'application',
|
||||
onTap: () {
|
||||
// Naviguer vers les paramètres de langue
|
||||
},
|
||||
),
|
||||
_buildAnimatedListTile(
|
||||
icon: Icons.format_paint,
|
||||
label: 'Thème de l\'application',
|
||||
onTap: () {
|
||||
// Naviguer vers les paramètres de thème
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
_buildSupportSectionCard(),
|
||||
const SizedBox(height: 20),
|
||||
_buildAccountDeletionCard(context),
|
||||
],
|
||||
),
|
||||
backgroundColor: const Color(0xFF1E1E2C),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildUserInfoCard() {
|
||||
return Card(
|
||||
color: const Color(0xFF292B37),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
children: [
|
||||
const CircleAvatar(
|
||||
radius: 50,
|
||||
backgroundImage: AssetImage('lib/assets/images/profile_picture.png'),
|
||||
backgroundColor: Colors.transparent,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
const Text(
|
||||
'GBANE Dahoud',
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
letterSpacing: 1.2,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
'pseudo',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.grey[400],
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
'gbanedahoud@lions.dev',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.grey[600],
|
||||
decoration: TextDecoration.underline,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildEditOptionsCard() {
|
||||
return Card(
|
||||
color: const Color(0xFF292B37),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
child: Column(
|
||||
children: [
|
||||
_buildAnimatedListTile(
|
||||
icon: Icons.edit,
|
||||
label: 'Éditer le profil',
|
||||
onTap: () {
|
||||
// Naviguer vers la page d'édition de profil
|
||||
},
|
||||
),
|
||||
_buildAnimatedListTile(
|
||||
icon: Icons.camera_alt,
|
||||
label: 'Changer la photo de profil',
|
||||
onTap: () {
|
||||
// Naviguer vers la page de changement de photo de profil
|
||||
},
|
||||
),
|
||||
_buildAnimatedListTile(
|
||||
icon: Icons.lock,
|
||||
label: 'Changer le mot de passe',
|
||||
onTap: () {
|
||||
// Naviguer vers la page de changement de mot de passe
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildUserInfoSection(BuildContext context) {
|
||||
return const Column(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 50,
|
||||
backgroundImage: AssetImage('lib/assets/images/profile_picture.png'), //Photo de profil
|
||||
Widget _buildStatisticsSectionCard() {
|
||||
return Card(
|
||||
color: const Color(0xFF292B37),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'Statistiques Personnelles',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
_buildStatTile(
|
||||
icon: Icons.event,
|
||||
label: 'Événements Participés',
|
||||
value: '12',
|
||||
),
|
||||
_buildStatTile(
|
||||
icon: Icons.place,
|
||||
label: 'Établissements Visités',
|
||||
value: '8',
|
||||
),
|
||||
_buildStatTile(
|
||||
icon: Icons.post_add,
|
||||
label: 'Publications',
|
||||
value: '24',
|
||||
),
|
||||
_buildStatTile(
|
||||
icon: Icons.group,
|
||||
label: 'Amis/Followers',
|
||||
value: '150',
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
Text(
|
||||
'GBANE Dahoud',
|
||||
style: TextStyle(fontSize: 22, fontWeight: FontWeight.bold, color: Colors.white),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
Text(
|
||||
'pseudo',
|
||||
style: TextStyle(fontSize: 16, color: Colors.grey),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
Text(
|
||||
'gbanedahoud@lions.dev',
|
||||
style: TextStyle(fontSize: 14, color: Colors.grey),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildEditOptions(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.edit, color: Colors.blueAccent),
|
||||
title: const Text('Éditer le profil'),
|
||||
onTap: () {
|
||||
// Naviguer vers la page d'édition de profil
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.camera_alt, color: Colors.blueAccent),
|
||||
title: const Text('Changer la photo de profil'),
|
||||
onTap: () {
|
||||
// Naviguer vers la page de changement de photo de profil
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.lock, color: Colors.blueAccent),
|
||||
title: const Text('Changer le mot de passe'),
|
||||
onTap: () {
|
||||
// Naviguer vers la page de changement de mot de passe
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatisticsSection(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: Text(
|
||||
'Statistiques Personnelles',
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: Colors.white),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.event, color: Colors.blueAccent),
|
||||
title: const Text('Événements Participés'),
|
||||
trailing: const Text('12'), // Exemple de valeur
|
||||
onTap: () {
|
||||
// Naviguer vers la page des événements participés
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.place, color: Colors.blueAccent),
|
||||
title: const Text('Établissements Visités'),
|
||||
trailing: const Text('8'), // Exemple de valeur
|
||||
onTap: () {
|
||||
// Naviguer vers la page des établissements visités
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.post_add, color: Colors.blueAccent),
|
||||
title: const Text('Publications'),
|
||||
trailing: const Text('24'), // Exemple de valeur
|
||||
onTap: () {
|
||||
// Naviguer vers la page des publications
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.group, color: Colors.blueAccent),
|
||||
title: const Text('Amis/Followers'),
|
||||
trailing: const Text('150'), // Exemple de valeur
|
||||
onTap: () {
|
||||
// Naviguer vers la page des amis ou followers
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildHistorySection(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: Text(
|
||||
'Historique',
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: Colors.white),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.event_note, color: Colors.blueAccent),
|
||||
title: const Text('Historique des Événements'),
|
||||
onTap: () {
|
||||
// Naviguer vers l'historique des événements
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.history, color: Colors.blueAccent),
|
||||
title: const Text('Historique des Publications'),
|
||||
onTap: () {
|
||||
// Naviguer vers l'historique des publications
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.bookmark, color: Colors.blueAccent),
|
||||
title: const Text('Historique de Réservations'),
|
||||
onTap: () {
|
||||
// Naviguer vers l'historique des réservations
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPreferencesSection(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: Text(
|
||||
'Préférences et Paramètres',
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: Colors.white),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.privacy_tip, color: Colors.blueAccent),
|
||||
title: const Text('Paramètres de confidentialité'),
|
||||
onTap: () {
|
||||
// Naviguer vers les paramètres de confidentialité
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.notifications, color: Colors.blueAccent),
|
||||
title: const Text('Notifications'),
|
||||
onTap: () {
|
||||
// Naviguer vers les paramètres de notification
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.language, color: Colors.blueAccent),
|
||||
title: const Text('Langue de l\'application'),
|
||||
onTap: () {
|
||||
// Naviguer vers les paramètres de langue
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.format_paint, color: Colors.blueAccent),
|
||||
title: const Text('Thème de l\'application'),
|
||||
onTap: () {
|
||||
// Naviguer vers les paramètres de thème
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSupportSection(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: Text(
|
||||
'Support et Assistance',
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: Colors.white),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.help, color: Colors.blueAccent),
|
||||
title: const Text('Support et Assistance'),
|
||||
onTap: () {
|
||||
// Naviguer vers la page de support
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.article, color: Colors.blueAccent),
|
||||
title: const Text('Conditions d\'utilisation'),
|
||||
onTap: () {
|
||||
// Naviguer vers les conditions d'utilisation
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.privacy_tip, color: Colors.blueAccent),
|
||||
title: const Text('Politique de confidentialité'),
|
||||
onTap: () {
|
||||
// Naviguer vers la politique de confidentialité
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildAccountDeletionSection(BuildContext context) {
|
||||
return ListTile(
|
||||
leading: const Icon(Icons.delete, color: Colors.redAccent),
|
||||
title: const Text(
|
||||
'Supprimer le compte',
|
||||
style: TextStyle(color: Colors.redAccent),
|
||||
),
|
||||
onTap: () {
|
||||
// Implémenter la logique de suppression de compte
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildExpandableSectionCard({
|
||||
required String title,
|
||||
required IconData icon,
|
||||
required List<Widget> children,
|
||||
}) {
|
||||
return Card(
|
||||
color: const Color(0xFF292B37),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
child: ExpansionTile(
|
||||
title: Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
leading: Icon(icon, color: const Color(0xFF1DBF73)),
|
||||
iconColor: const Color(0xFF1DBF73),
|
||||
collapsedIconColor: const Color(0xFF1DBF73),
|
||||
children: children,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSupportSectionCard() {
|
||||
return Card(
|
||||
color: const Color(0xFF292B37),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
child: Column(
|
||||
children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: Text(
|
||||
'Support et Assistance',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
_buildAnimatedListTile(
|
||||
icon: Icons.help,
|
||||
label: 'Support et Assistance',
|
||||
onTap: () {
|
||||
// Naviguer vers la page de support
|
||||
},
|
||||
),
|
||||
_buildAnimatedListTile(
|
||||
icon: Icons.article,
|
||||
label: 'Conditions d\'utilisation',
|
||||
onTap: () {
|
||||
// Naviguer vers les conditions d'utilisation
|
||||
},
|
||||
),
|
||||
_buildAnimatedListTile(
|
||||
icon: Icons.privacy_tip,
|
||||
label: 'Politique de confidentialité',
|
||||
onTap: () {
|
||||
// Naviguer vers la politique de confidentialité
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildAccountDeletionCard(BuildContext context) {
|
||||
return Card(
|
||||
color: const Color(0xFF292B37),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
child: ListTile(
|
||||
leading: const Icon(Icons.delete, color: Colors.redAccent),
|
||||
title: const Text(
|
||||
'Supprimer le compte',
|
||||
style: TextStyle(color: Colors.redAccent, fontWeight: FontWeight.bold),
|
||||
),
|
||||
onTap: () {
|
||||
_showDeleteConfirmationDialog(context);
|
||||
},
|
||||
hoverColor: Colors.red.withOpacity(0.1),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _showDeleteConfirmationDialog(BuildContext context) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
backgroundColor: const Color(0xFF1E1E2C),
|
||||
title: const Text(
|
||||
'Confirmer la suppression',
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
content: const Text(
|
||||
'Êtes-vous sûr de vouloir supprimer votre compte ? Cette action est irréversible.',
|
||||
style: TextStyle(color: Colors.white70),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(); // Fermer le popup
|
||||
},
|
||||
child: const Text(
|
||||
'Annuler',
|
||||
style: TextStyle(color: Color(0xFF1DBF73)),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
// Logique de suppression du compte ici
|
||||
Navigator.of(context).pop(); // Fermer le popup après la suppression
|
||||
},
|
||||
child: const Text(
|
||||
'Supprimer',
|
||||
style: TextStyle(color: Colors.redAccent),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildAnimatedListTile({
|
||||
required IconData icon,
|
||||
required String label,
|
||||
required VoidCallback onTap,
|
||||
}) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
splashColor: Colors.blueAccent.withOpacity(0.2),
|
||||
child: ListTile(
|
||||
leading: Icon(icon, color: const Color(0xFF1DBF73)),
|
||||
title: Text(
|
||||
label,
|
||||
style: const TextStyle(color: Colors.white, fontWeight: FontWeight.w600),
|
||||
),
|
||||
hoverColor: Colors.blue.withOpacity(0.1),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatTile({
|
||||
required IconData icon,
|
||||
required String label,
|
||||
required String value,
|
||||
}) {
|
||||
return ListTile(
|
||||
leading: Icon(icon, color: const Color(0xFF1DBF73)),
|
||||
title: Text(label, style: const TextStyle(color: Colors.white)),
|
||||
trailing: Text(
|
||||
value,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
hoverColor: Colors.blue.withOpacity(0.1),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user