You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

174 lines
5.5 KiB

8 months ago
import 'package:flutter/material.dart';
class AppBottomNavigation extends StatelessWidget {
8 months ago
final int? selectedIndex;
8 months ago
final Function(int) onItemTapped;
final bool isDesktop;
const AppBottomNavigation({
super.key,
required this.selectedIndex,
required this.onItemTapped,
this.isDesktop = false,
});
@override
Widget build(BuildContext context) {
if (isDesktop) return const SizedBox.shrink();
return Container(
color: Colors.white,
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
child: Row(
children: [
// Tables Tab
GestureDetector(
onTap: () => onItemTapped(0),
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
decoration: BoxDecoration(
color:
selectedIndex == 0
? Colors.green.shade700
: Colors.transparent,
borderRadius: BorderRadius.circular(20),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.table_restaurant,
color:
selectedIndex == 0
? Colors.white
: Colors.grey.shade600,
size: 16,
),
const SizedBox(width: 6),
Text(
'Tables',
style: TextStyle(
color:
selectedIndex == 0
? Colors.white
: Colors.grey.shade600,
fontWeight:
selectedIndex == 0
? FontWeight.w500
: FontWeight.normal,
),
),
],
),
),
),
const SizedBox(width: 20),
// Commandes Tab
GestureDetector(
onTap: () => onItemTapped(1),
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
decoration: BoxDecoration(
color:
selectedIndex == 1
? Colors.green.shade700
: Colors.transparent,
borderRadius: BorderRadius.circular(20),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.receipt_long_outlined,
color:
selectedIndex == 1
? Colors.white
: Colors.grey.shade600,
size: 16,
),
const SizedBox(width: 6),
Text(
'Commandes',
style: TextStyle(
color:
selectedIndex == 1
? Colors.white
: Colors.grey.shade600,
fontWeight:
selectedIndex == 1
? FontWeight.w500
: FontWeight.normal,
),
),
],
),
),
),
8 months ago
const SizedBox(width: 20),
8 months ago
// Catégories Tab (Corrigé)
8 months ago
GestureDetector(
8 months ago
onTap: () => onItemTapped(2), // Index 2 pour catégories
8 months ago
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
decoration: BoxDecoration(
color:
8 months ago
selectedIndex == 2 // Index 2 pour catégories
8 months ago
? Colors.green.shade700
: Colors.transparent,
borderRadius: BorderRadius.circular(20),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
8 months ago
Icons.category_outlined, // Icône plus appropriée pour catégories
8 months ago
color:
8 months ago
selectedIndex == 2
8 months ago
? Colors.white
: Colors.grey.shade600,
size: 16,
),
const SizedBox(width: 6),
Text(
8 months ago
'Catégories',
8 months ago
style: TextStyle(
color:
8 months ago
selectedIndex == 2
8 months ago
? Colors.white
: Colors.grey.shade600,
fontWeight:
8 months ago
selectedIndex == 2
8 months ago
? FontWeight.w500
: FontWeight.normal,
),
),
],
),
),
),
8 months ago
const Spacer(),
// User Profile Section
_buildUserProfile(),
],
),
);
}
Widget _buildUserProfile() {
return Row(
children: [
Icon(Icons.person_outline, color: Colors.grey.shade600, size: 16),
const SizedBox(width: 6),
Text('Chef Pierre', style: TextStyle(color: Colors.grey.shade600)),
const SizedBox(width: 8),
Icon(Icons.expand_more, color: Colors.grey.shade600, size: 16),
],
);
}
8 months ago
}