Files
afterwork/lib/presentation/screens/home/home_screen.dart

130 lines
4.5 KiB
Dart

import 'package:flutter/material.dart';
import 'package:afterwork/presentation/screens/event/event_screen.dart';
import 'package:afterwork/presentation/screens/profile/profile_screen.dart';
import 'package:afterwork/presentation/screens/social/social_screen.dart';
import 'package:afterwork/presentation/screens/establishments/establishments_screen.dart';
import 'package:afterwork/presentation/screens/home/home_content.dart';
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(
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: TabBarView(
controller: _tabController,
children: const [
HomeContentScreen(), // Contenu de l'accueil
EventScreen(), // Écran des événements
EstablishmentsScreen(), // Écran des établissements
SocialScreen(), // Écran social
ProfileScreen(), // Écran du profil
],
),
backgroundColor: Colors.black, // Arrière-plan de l'écran en noir
);
}
}