commit
This commit is contained in:
parent
b20000ce13
commit
eea0be9934
@ -1,7 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:itrimobe/pages/menu.dart';
|
||||
import 'layouts/main_layout.dart';
|
||||
import 'pages/tables.dart';
|
||||
import 'pages/categorie.dart'; // Import de votre page de catégories
|
||||
import 'pages/categorie.dart';
|
||||
import 'pages/commandes_screen.dart';
|
||||
import 'pages/login_screen.dart';
|
||||
|
||||
@ -16,7 +17,7 @@ class MyApp extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Restaurant App',
|
||||
debugShowCheckedModeBanner: false, // ← ICI pour enlever le "DEBUG"
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.green,
|
||||
visualDensity: VisualDensity.adaptivePlatformDensity,
|
||||
@ -36,7 +37,29 @@ class MyApp extends StatelessWidget {
|
||||
currentRoute: '/commandes',
|
||||
child: OrdersManagementScreen(),
|
||||
),
|
||||
// MODIFICATION : Route simple pour le menu
|
||||
'/menu': (context) => const MainLayout(
|
||||
currentRoute: '/menu',
|
||||
child: MenuPage(), // Pas de paramètres requis maintenant
|
||||
),
|
||||
},
|
||||
// onGenerateRoute pour gérer les paramètres optionnels
|
||||
onGenerateRoute: (settings) {
|
||||
if (settings.name == '/menu-with-table') {
|
||||
final args = settings.arguments as Map<String, dynamic>?;
|
||||
|
||||
return MaterialPageRoute(
|
||||
builder: (context) => MainLayout(
|
||||
currentRoute: '/menu',
|
||||
child: MenuPage(
|
||||
tableId: args?['tableId'] ?? 0,
|
||||
personne: args?['personne'] ?? 1,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -37,8 +37,8 @@ class _CategoriesPageState extends State<CategoriesPage> {
|
||||
final jsonBody = json.decode(response.body);
|
||||
final dynamic rawData = jsonBody['data']['categories']; // ✅ ici !
|
||||
|
||||
print('✅ Données récupérées :');
|
||||
print(rawData);
|
||||
// print('✅ Données récupérées :');
|
||||
// print(rawData);
|
||||
|
||||
if (rawData is List) {
|
||||
setState(() {
|
||||
@ -58,8 +58,8 @@ class _CategoriesPageState extends State<CategoriesPage> {
|
||||
isLoading = false;
|
||||
});
|
||||
if (kDebugMode) {
|
||||
print('Erreur HTTP: ${response.statusCode}');
|
||||
print('Contenu de la réponse: ${response.body}');
|
||||
// print('Erreur HTTP: ${response.statusCode}');
|
||||
// print('Contenu de la réponse: ${response.body}');
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
@ -13,8 +13,6 @@ class AppBottomNavigation extends StatelessWidget {
|
||||
this.isDesktop = false,
|
||||
});
|
||||
|
||||
BuildContext? get context => null;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (isDesktop) return const SizedBox.shrink();
|
||||
@ -24,7 +22,7 @@ class AppBottomNavigation extends StatelessWidget {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
// Tables Tab
|
||||
// Tables Tab - Index 0
|
||||
GestureDetector(
|
||||
onTap: () => onItemTapped(0),
|
||||
child: Container(
|
||||
@ -68,7 +66,7 @@ class AppBottomNavigation extends StatelessWidget {
|
||||
|
||||
const SizedBox(width: 20),
|
||||
|
||||
// Commandes Tab
|
||||
// Commandes Tab - Index 1
|
||||
GestureDetector(
|
||||
onTap: () => onItemTapped(1),
|
||||
child: Container(
|
||||
@ -112,15 +110,14 @@ class AppBottomNavigation extends StatelessWidget {
|
||||
|
||||
const SizedBox(width: 20),
|
||||
|
||||
// Catégories Tab (Corrigé)
|
||||
// Catégories Tab - Index 2
|
||||
GestureDetector(
|
||||
onTap: () => onItemTapped(2), // Index 2 pour catégories
|
||||
onTap: () => onItemTapped(2),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
selectedIndex ==
|
||||
2 // Index 2 pour catégories
|
||||
selectedIndex == 2
|
||||
? Colors.green.shade700
|
||||
: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
@ -129,8 +126,7 @@ class AppBottomNavigation extends StatelessWidget {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
Icons
|
||||
.category_outlined, // Icône plus appropriée pour catégories
|
||||
Icons.category_outlined,
|
||||
color:
|
||||
selectedIndex == 2
|
||||
? Colors.white
|
||||
@ -156,6 +152,49 @@ class AppBottomNavigation extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(width: 20),
|
||||
|
||||
GestureDetector(
|
||||
onTap: () => onItemTapped(3),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
selectedIndex == 3
|
||||
? Colors.green.shade700
|
||||
: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.restaurant_menu,
|
||||
color:
|
||||
selectedIndex == 3
|
||||
? Colors.white
|
||||
: Colors.grey.shade600,
|
||||
size: 16,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
'Menu',
|
||||
style: TextStyle(
|
||||
color:
|
||||
selectedIndex == 3
|
||||
? Colors.white
|
||||
: Colors.grey.shade600,
|
||||
fontWeight:
|
||||
selectedIndex == 3
|
||||
? FontWeight.w500
|
||||
: FontWeight.normal,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const Spacer(),
|
||||
|
||||
// User Profile Section
|
||||
@ -165,7 +204,7 @@ class AppBottomNavigation extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildUserProfile(context) {
|
||||
Widget _buildUserProfile(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
const SizedBox(width: 6),
|
||||
@ -173,7 +212,7 @@ class AppBottomNavigation extends StatelessWidget {
|
||||
icon: const Icon(Icons.logout),
|
||||
onPressed: () {
|
||||
Navigator.pushReplacement(
|
||||
context!,
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => const LoginScreen()),
|
||||
);
|
||||
},
|
||||
@ -181,4 +220,4 @@ class AppBottomNavigation extends StatelessWidget {
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user