Refactoring
This commit is contained in:
@@ -7,47 +7,163 @@ class EventScreen extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('Créer un Événement'),
|
title: const Text('Événements'),
|
||||||
backgroundColor: Colors.blueAccent,
|
backgroundColor: const Color(0xFF1E1E2C),
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.add_circle_outline, size: 28, color: Color(0xFF1DBF73)),
|
||||||
|
onPressed: () {
|
||||||
|
// Logique pour ajouter un nouvel événement
|
||||||
|
},
|
||||||
),
|
),
|
||||||
body: Padding(
|
],
|
||||||
|
),
|
||||||
|
body: ListView.builder(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
itemCount: 10, // Remplacez par le nombre réel d'événements
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return Card(
|
||||||
|
color: const Color(0xFF2C2C3E),
|
||||||
|
margin: const EdgeInsets.symmetric(vertical: 10.0),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(15.0),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(12.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
const Row(
|
||||||
|
children: [
|
||||||
|
CircleAvatar(
|
||||||
|
backgroundImage: NetworkImage(
|
||||||
|
'https://example.com/profile_picture.png', // Remplacez par l'URL réelle de l'image de profil
|
||||||
|
),
|
||||||
|
radius: 25,
|
||||||
|
),
|
||||||
|
SizedBox(width: 10),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'Nom Prénom', // Remplacez par le nom réel
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'Posté le 24/08/2024', // Remplacez par la date réelle
|
||||||
|
style: TextStyle(color: Colors.white70, fontSize: 14),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
const Text(
|
const Text(
|
||||||
'Titre de l\'événement',
|
'Titre de l\'événement', // Remplacez par le titre réel
|
||||||
style: TextStyle(fontSize: 18, color: Colors.white),
|
style: TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 5),
|
||||||
TextField(
|
const Text(
|
||||||
decoration: InputDecoration(
|
'Description détaillée de l\'événement...', // Remplacez par la description réelle
|
||||||
hintText: 'Entrez le titre de l\'événement',
|
style: TextStyle(color: Colors.white70, fontSize: 14),
|
||||||
filled: true,
|
),
|
||||||
fillColor: Colors.white.withOpacity(0.1),
|
const SizedBox(height: 10),
|
||||||
border: OutlineInputBorder(
|
ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(10.0),
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
borderSide: BorderSide.none,
|
child: Image.network(
|
||||||
),
|
'https://example.com/event_image.png', // Remplacez par l'URL réelle de l'image de l'événement
|
||||||
hintStyle: const TextStyle(color: Colors.white70),
|
height: 180,
|
||||||
),
|
width: double.infinity,
|
||||||
style: const TextStyle(color: Colors.white),
|
fit: BoxFit.cover,
|
||||||
),
|
errorBuilder: (context, error, stackTrace) {
|
||||||
const SizedBox(height: 20),
|
return Image.asset(
|
||||||
ElevatedButton(
|
'lib/assets/images/placeholder.png', // Chemin vers une image de remplacement locale
|
||||||
onPressed: () {
|
height: 180,
|
||||||
// Logique pour créer l'événement
|
width: double.infinity,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
backgroundColor: Colors.blueAccent,
|
|
||||||
padding: const EdgeInsets.all(16.0),
|
|
||||||
),
|
),
|
||||||
child: const Text('Créer l\'événement'),
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Divider(color: Colors.white.withOpacity(0.2)), // Ligne de séparation discrète
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
_buildIconButton(
|
||||||
|
icon: Icons.thumb_up_alt_outlined,
|
||||||
|
label: 'Réagir',
|
||||||
|
count: 120, // Remplacez par le nombre réel de j'aimes
|
||||||
|
onPressed: () {
|
||||||
|
// Logique pour réagir à l'événement
|
||||||
|
},
|
||||||
|
),
|
||||||
|
_buildIconButton(
|
||||||
|
icon: Icons.comment_outlined,
|
||||||
|
label: 'Commenter',
|
||||||
|
count: 45, // Remplacez par le nombre réel de commentaires
|
||||||
|
onPressed: () {
|
||||||
|
// Logique pour commenter l'événement
|
||||||
|
},
|
||||||
|
),
|
||||||
|
_buildIconButton(
|
||||||
|
icon: Icons.share_outlined,
|
||||||
|
label: 'Partager',
|
||||||
|
count: 30, // Remplacez par le nombre réel de partages
|
||||||
|
onPressed: () {
|
||||||
|
// Logique pour partager l'événement
|
||||||
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
backgroundColor: Colors.black,
|
const SizedBox(height: 10),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
// Logique pour participer à l'événement
|
||||||
|
},
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: const Color(0xFF1DBF73),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(8.0),
|
||||||
|
),
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 12.0),
|
||||||
|
minimumSize: const Size(double.infinity, 40),
|
||||||
|
),
|
||||||
|
child: const Text('Participer', style: TextStyle(color: Colors.white)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
backgroundColor: const Color(0xFF1E1E2C),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildIconButton({
|
||||||
|
required IconData icon,
|
||||||
|
required String label,
|
||||||
|
required int count,
|
||||||
|
required VoidCallback onPressed,
|
||||||
|
}) {
|
||||||
|
return Container(
|
||||||
|
margin: const EdgeInsets.only(right: 8.0), // Espacement entre les boutons
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(icon, color: const Color(0xFF1DBF73), size: 20),
|
||||||
|
onPressed: onPressed,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'$label ($count)',
|
||||||
|
style: const TextStyle(color: Colors.white70, fontSize: 12),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user