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

@@ -1,7 +1,9 @@
import 'package:flutter/material.dart';
import '../components/home/home_content.dart';
import '../components/settings/settings_content.dart';
import '../components/profile/profile_content.dart';
import '../components/map/map_content.dart';
import '../components/group/group_content.dart';
import '../components/count/count_content.dart';
class HomePage extends StatefulWidget {
const HomePage({super.key});
@@ -13,21 +15,28 @@ class HomePage extends StatefulWidget {
class _HomePageState extends State<HomePage> {
int _currentIndex = 0;
// Liste des composants à afficher
final List<Widget> _pages = [
HomeContent(),
SettingsContent(),
ProfileContent(),
];
// Titres correspondants
final List<String> _titles = ['Accueil', 'Paramètres', 'Profil'];
@override
Widget build(BuildContext context) {
// Définir les pages directement dans le build pour éviter les erreurs
final List<Widget> pages = [
HomeContent(), // 0
SettingsContent(), // 1
MapContent(), // 2
GroupContent(), // 3
CountContent(), // 4
];
final List<String> titles = [
'Accueil', // 0
'Paramètres', // 1
'Carte', // 2
'Mes groupes', // 3
'Comptes', // 4
];
return Scaffold(
appBar: AppBar(
title: Text(_titles[_currentIndex]),
title: Text(titles[_currentIndex]), // Debug
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
foregroundColor: Colors.white,
),
@@ -49,6 +58,7 @@ class _HomePageState extends State<HomePage> {
title: Text("Accueil"),
selected: _currentIndex == 0,
onTap: () {
print('Clicked Accueil - Setting index to 0'); // Debug
setState(() {
_currentIndex = 0;
});
@@ -60,6 +70,7 @@ class _HomePageState extends State<HomePage> {
title: Text("Paramètres"),
selected: _currentIndex == 1,
onTap: () {
print('Clicked Paramètres - Setting index to 1'); // Debug
setState(() {
_currentIndex = 1;
});
@@ -67,16 +78,41 @@ class _HomePageState extends State<HomePage> {
},
),
ListTile(
leading: Icon(Icons.person),
title: Text("Profil"),
leading: Icon(Icons.map),
title: Text("Carte"),
selected: _currentIndex == 2,
onTap: () {
print('Clicked Carte - Setting index to 2'); // Debug
setState(() {
_currentIndex = 2;
});
Navigator.pop(context);
},
),
ListTile(
leading: Icon(Icons.group),
title: Text("Mes groupes"),
selected: _currentIndex == 3,
onTap: () {
print('Clicked Groupes - Setting index to 3'); // Debug
setState(() {
_currentIndex = 3;
});
Navigator.pop(context);
},
),
ListTile(
leading: Icon(Icons.account_balance_wallet),
title: Text("Comptes"),
selected: _currentIndex == 4,
onTap: () {
print('Clicked Comptes - Setting index to 4'); // Debug
setState(() {
_currentIndex = 4;
});
Navigator.pop(context);
},
),
Divider(),
ListTile(
leading: Icon(Icons.logout, color: Colors.red),
@@ -93,7 +129,7 @@ class _HomePageState extends State<HomePage> {
],
),
),
body: _pages[_currentIndex],
body: pages[_currentIndex],
);
}
}