Main coves client
1import 'package:flutter/material.dart';
2
3import '../../constants/app_colors.dart';
4import '../../widgets/icons/bluesky_icons.dart';
5import 'communities_screen.dart';
6import 'create_post_screen.dart';
7import 'feed_screen.dart';
8import 'notifications_screen.dart';
9import 'profile_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 void _onItemTapped(int index) {
22 setState(() {
23 _selectedIndex = index;
24 });
25 }
26
27 void _onCommunitiesTap() {
28 setState(() {
29 _selectedIndex = 1; // Switch to communities tab
30 });
31 }
32
33 @override
34 Widget build(BuildContext context) {
35 return Scaffold(
36 body: IndexedStack(
37 index: _selectedIndex,
38 children: [
39 FeedScreen(onSearchTap: _onCommunitiesTap),
40 const CommunitiesScreen(),
41 const CreatePostScreen(),
42 const NotificationsScreen(),
43 const ProfileScreen(),
44 ],
45 ),
46 bottomNavigationBar: Container(
47 decoration: const BoxDecoration(
48 color: Color(0xFF0B0F14),
49 border: Border(top: BorderSide(color: Color(0xFF0B0F14), width: 0.5)),
50 ),
51 child: SafeArea(
52 child: SizedBox(
53 height: 48,
54 child: Row(
55 mainAxisAlignment: MainAxisAlignment.spaceAround,
56 children: [
57 _buildNavItem(0, 'home', 'Home'),
58 _buildNavItem(1, 'communities', 'Communities'),
59 _buildNavItem(2, 'plus', 'Create'),
60 _buildNavItem(3, 'bell', 'Notifications'),
61 _buildNavItem(4, 'person', 'Me'),
62 ],
63 ),
64 ),
65 ),
66 ),
67 );
68 }
69
70 Widget _buildNavItem(int index, String iconName, String label) {
71 final isSelected = _selectedIndex == index;
72 final color =
73 isSelected
74 ? AppColors.primary
75 : const Color(0xFFB6C2D2).withValues(alpha: 0.6);
76
77 // Use filled variant when selected, outline when not
78 Widget icon;
79 switch (iconName) {
80 case 'home':
81 icon = BlueSkyIcon.homeSimple(color: color);
82 break;
83 case 'communities':
84 icon = Icon(
85 isSelected ? Icons.workspaces : Icons.workspaces_outlined,
86 color: color,
87 size: 24,
88 );
89 break;
90 case 'plus':
91 icon = BlueSkyIcon.plus(color: color);
92 break;
93 case 'bell':
94 icon =
95 isSelected
96 ? BlueSkyIcon.bellFilled(color: color)
97 : BlueSkyIcon.bellOutline(color: color);
98 break;
99 case 'person':
100 icon = BlueSkyIcon.personSimple(color: color);
101 break;
102 default:
103 icon = BlueSkyIcon.homeOutline(color: color);
104 }
105
106 return Expanded(
107 child: InkWell(
108 onTap: () => _onItemTapped(index),
109 splashColor: Colors.transparent,
110 highlightColor: Colors.transparent,
111 child: icon,
112 ),
113 );
114 }
115}