1import 'package:flutter/material.dart'; 2 3import 'create_post_screen.dart'; 4import 'feed_screen.dart'; 5import 'notifications_screen.dart'; 6import 'profile_screen.dart'; 7import 'search_screen.dart'; 8 9class MainShellScreen extends StatefulWidget { 10 const MainShellScreen({super.key}); 11 12 @override 13 State<MainShellScreen> createState() => _MainShellScreenState(); 14} 15 16class _MainShellScreenState extends State<MainShellScreen> { 17 int _selectedIndex = 0; 18 19 static const List<Widget> _screens = [ 20 FeedScreen(), 21 SearchScreen(), 22 CreatePostScreen(), 23 NotificationsScreen(), 24 ProfileScreen(), 25 ]; 26 27 void _onItemTapped(int index) { 28 setState(() { 29 _selectedIndex = index; 30 }); 31 } 32 33 @override 34 Widget build(BuildContext context) { 35 return Scaffold( 36 body: _screens[_selectedIndex], 37 bottomNavigationBar: Container( 38 decoration: const BoxDecoration( 39 color: Color(0xFF0B0F14), 40 border: Border(top: BorderSide(color: Color(0xFF0B0F14), width: 0.5)), 41 ), 42 child: SafeArea( 43 child: SizedBox( 44 height: 48, 45 child: Row( 46 mainAxisAlignment: MainAxisAlignment.spaceAround, 47 children: [ 48 _buildNavItem(0, Icons.home, 'Home'), 49 _buildNavItem(1, Icons.search, 'Search'), 50 _buildNavItem(2, Icons.add_box_outlined, 'Create'), 51 _buildNavItem(3, Icons.notifications_outlined, 'Notifications'), 52 _buildNavItem(4, Icons.person_outline, 'Me'), 53 ], 54 ), 55 ), 56 ), 57 ), 58 ); 59 } 60 61 Widget _buildNavItem(int index, IconData icon, String label) { 62 final isSelected = _selectedIndex == index; 63 final color = 64 isSelected 65 ? const Color(0xFFFF6B35) 66 : const Color(0xFFB6C2D2).withValues(alpha: 0.6); 67 68 return Expanded( 69 child: InkWell( 70 onTap: () => _onItemTapped(index), 71 splashColor: Colors.transparent, 72 highlightColor: Colors.transparent, 73 child: Icon(icon, size: 28, color: color), 74 ), 75 ); 76 } 77}