Main coves client
1import 'package:flutter/material.dart';
2
3import '../../constants/app_colors.dart';
4import '../../widgets/icons/bluesky_icons.dart';
5import 'create_post_screen.dart';
6import 'feed_screen.dart';
7import 'notifications_screen.dart';
8import 'profile_screen.dart';
9import 'search_screen.dart';
10
11class MainShellScreen extends StatefulWidget {
12 const MainShellScreen({super.key});
13
14 @override
15 State<MainShellScreen> createState() => _MainShellScreenState();
16}
17
18class _MainShellScreenState extends State<MainShellScreen> {
19 int _selectedIndex = 0;
20
21 static const List<Widget> _screens = [
22 FeedScreen(),
23 SearchScreen(),
24 CreatePostScreen(),
25 NotificationsScreen(),
26 ProfileScreen(),
27 ];
28
29 void _onItemTapped(int index) {
30 setState(() {
31 _selectedIndex = index;
32 });
33 }
34
35 @override
36 Widget build(BuildContext context) {
37 return Scaffold(
38 body: _screens[_selectedIndex],
39 bottomNavigationBar: Container(
40 decoration: const BoxDecoration(
41 color: Color(0xFF0B0F14),
42 border: Border(top: BorderSide(color: Color(0xFF0B0F14), width: 0.5)),
43 ),
44 child: SafeArea(
45 child: SizedBox(
46 height: 48,
47 child: Row(
48 mainAxisAlignment: MainAxisAlignment.spaceAround,
49 children: [
50 _buildNavItem(0, 'home', 'Home'),
51 _buildNavItem(1, 'search', 'Search'),
52 _buildNavItem(2, 'plus', 'Create'),
53 _buildNavItem(3, 'bell', 'Notifications'),
54 _buildNavItem(4, 'person', 'Me'),
55 ],
56 ),
57 ),
58 ),
59 ),
60 );
61 }
62
63 Widget _buildNavItem(int index, String iconName, String label) {
64 final isSelected = _selectedIndex == index;
65 final color =
66 isSelected
67 ? AppColors.primary
68 : const Color(0xFFB6C2D2).withValues(alpha: 0.6);
69
70 // Use filled variant when selected, outline when not
71 Widget icon;
72 switch (iconName) {
73 case 'home':
74 icon = BlueSkyIcon.homeSimple(color: color);
75 break;
76 case 'search':
77 icon = BlueSkyIcon.search(color: color);
78 break;
79 case 'plus':
80 icon = BlueSkyIcon.plus(color: color);
81 break;
82 case 'bell':
83 icon =
84 isSelected
85 ? BlueSkyIcon.bellFilled(color: color)
86 : BlueSkyIcon.bellOutline(color: color);
87 break;
88 case 'person':
89 icon = BlueSkyIcon.personSimple(color: color);
90 break;
91 default:
92 icon = BlueSkyIcon.homeOutline(color: color);
93 }
94
95 return Expanded(
96 child: InkWell(
97 onTap: () => _onItemTapped(index),
98 splashColor: Colors.transparent,
99 highlightColor: Colors.transparent,
100 child: icon,
101 ),
102 );
103 }
104}