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.
 
 
 
 
 
 

66 lines
1.6 KiB

import 'package:flutter/material.dart';
class MobileBottomNavigation extends StatelessWidget {
final int selectedIndex;
final Function(int) onItemTapped;
const MobileBottomNavigation({
super.key,
required this.selectedIndex,
required this.onItemTapped,
});
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
padding: const EdgeInsets.symmetric(vertical: 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
_buildBottomNavItem(
icon: Icons.table_restaurant,
label: 'Tables',
index: 0,
),
_buildBottomNavItem(
icon: Icons.receipt_long_outlined,
label: 'Commandes',
index: 1,
),
],
),
);
}
Widget _buildBottomNavItem({
required IconData icon,
required String label,
required int index,
}) {
final isSelected = selectedIndex == index;
return GestureDetector(
onTap: () => onItemTapped(index),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
icon,
color: isSelected ? Colors.green.shade700 : Colors.grey.shade600,
size: 24,
),
const SizedBox(height: 4),
Text(
label,
style: TextStyle(
color: isSelected ? Colors.green.shade700 : Colors.grey.shade600,
fontSize: 12,
fontWeight: isSelected ? FontWeight.w600 : FontWeight.normal,
),
),
],
),
);
}
}