Le menu de la page principale après s'être authentifié est ok
This commit is contained in:
@@ -1,17 +1,172 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class HomeScreen extends StatelessWidget {
|
||||
class HomeScreen extends StatefulWidget {
|
||||
const HomeScreen({super.key});
|
||||
|
||||
@override
|
||||
_HomeScreenState createState() => _HomeScreenState();
|
||||
}
|
||||
|
||||
class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateMixin {
|
||||
late TabController _tabController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_tabController = TabController(length: 5, vsync: this);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_tabController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _onMenuSelected(BuildContext context, String option) {
|
||||
// Implémente la logique pour chaque option ici
|
||||
switch (option) {
|
||||
case 'Publier':
|
||||
// Redirige vers la page de publication
|
||||
break;
|
||||
case 'Story':
|
||||
// Redirige vers la page de création de Story
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('AfterWork'),
|
||||
backgroundColor: Colors.black, // Fond noir pour l'AppBar
|
||||
elevation: 0, // Enlève l'ombre sous l'AppBar
|
||||
leading: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset(
|
||||
'lib/assets/images/logo.png', // Chemin correct de ton logo
|
||||
height: 40,
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
// Bouton +
|
||||
CircleAvatar(
|
||||
backgroundColor: Colors.white, // Cercle blanc
|
||||
radius: 18, // Réduit la taille du bouton
|
||||
child: PopupMenuButton<String>(
|
||||
onSelected: (value) => _onMenuSelected(context, value),
|
||||
itemBuilder: (context) => [
|
||||
const PopupMenuItem(
|
||||
value: 'Publier',
|
||||
child: Text('Publier'),
|
||||
),
|
||||
const PopupMenuItem(
|
||||
value: 'Story',
|
||||
child: Text('Story'),
|
||||
),
|
||||
],
|
||||
icon: const Icon(Icons.add, color: Colors.blueAccent, size: 20), // Icône bleue légèrement plus petite
|
||||
color: Colors.white, // Menu contextuel en blanc
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8), // Réduit l'espacement entre les boutons
|
||||
// Bouton Recherche
|
||||
CircleAvatar(
|
||||
backgroundColor: Colors.white,
|
||||
radius: 18, // Réduit la taille du bouton
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.search, color: Colors.blueAccent, size: 20), // Icône bleue légèrement plus petite
|
||||
onPressed: () {
|
||||
// Implémente la logique de recherche ici
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8), // Réduit l'espacement entre les boutons
|
||||
// Bouton Messagerie
|
||||
CircleAvatar(
|
||||
backgroundColor: Colors.white,
|
||||
radius: 18, // Réduit la taille du bouton
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.message, color: Colors.blueAccent, size: 20), // Icône bleue légèrement plus petite
|
||||
onPressed: () {
|
||||
// Implémente la logique de messagerie ici
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8), // Réduit l'espacement entre les boutons
|
||||
],
|
||||
bottom: TabBar(
|
||||
controller: _tabController,
|
||||
indicatorColor: Colors.blueAccent,
|
||||
tabs: const [
|
||||
Tab(icon: Icon(Icons.home), text: 'Accueil'),
|
||||
Tab(icon: Icon(Icons.event), text: 'Événements'),
|
||||
Tab(icon: Icon(Icons.location_city), text: 'Établissements'),
|
||||
Tab(icon: Icon(Icons.people), text: 'Social'),
|
||||
Tab(icon: Icon(Icons.person), text: 'Profil'),
|
||||
],
|
||||
),
|
||||
),
|
||||
body: const Center(
|
||||
child: Text('Bienvenue sur AfterWork!'),
|
||||
body: TabBarView(
|
||||
controller: _tabController,
|
||||
children: [
|
||||
_getSelectedScreen(0),
|
||||
_getSelectedScreen(1),
|
||||
_getSelectedScreen(2),
|
||||
_getSelectedScreen(3),
|
||||
_getSelectedScreen(4),
|
||||
],
|
||||
),
|
||||
backgroundColor: Colors.black, // Arrière-plan de l'écran en noir
|
||||
);
|
||||
}
|
||||
|
||||
// Cette méthode retourne le widget correspondant à l'index sélectionné
|
||||
Widget _getSelectedScreen(int index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return const Center(
|
||||
child: Text(
|
||||
'Accueil',
|
||||
style: TextStyle(color: Colors.white, fontSize: 24),
|
||||
),
|
||||
);
|
||||
case 1:
|
||||
return const Center(
|
||||
child: Text(
|
||||
'Événements',
|
||||
style: TextStyle(color: Colors.white, fontSize: 24),
|
||||
),
|
||||
);
|
||||
case 2:
|
||||
return const Center(
|
||||
child: Text(
|
||||
'Établissements',
|
||||
style: TextStyle(color: Colors.white, fontSize: 24),
|
||||
),
|
||||
);
|
||||
case 3:
|
||||
return const Center(
|
||||
child: Text(
|
||||
'Social',
|
||||
style: TextStyle(color: Colors.white, fontSize: 24),
|
||||
),
|
||||
);
|
||||
case 4:
|
||||
return const Center(
|
||||
child: Text(
|
||||
'Profil',
|
||||
style: TextStyle(color: Colors.white, fontSize: 24),
|
||||
),
|
||||
);
|
||||
default:
|
||||
return const Center(
|
||||
child: Text(
|
||||
'Accueil',
|
||||
style: TextStyle(color: Colors.white, fontSize: 24),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user