1
1
// import 'package:flutter/material.dart';
2
+ import 'package:firebase_auth/firebase_auth.dart' ;
2
3
import 'package:flutter/material.dart' ;
3
4
import 'package:flutter_side_menu/flutter_side_menu.dart' ;
4
5
import 'package:flutter_svg/svg.dart' ;
6
+ import 'package:instagram_clone/backend/providers/user_providers.dart' ;
7
+ import 'package:instagram_clone/model/user.dart' ;
8
+ import 'package:instagram_clone/screens/add_post.dart' ;
9
+ import 'package:instagram_clone/screens/feed_screen.dart' ;
10
+ import 'package:instagram_clone/screens/profile.dart' ;
11
+ import 'package:instagram_clone/screens/search_screen.dart' ;
12
+ import 'package:instagram_clone/screens/suggestion_user.dart' ;
5
13
import 'package:instagram_clone/utils/colors.dart' ;
14
+ import 'package:instagram_clone/widgets/post_feed.dart' ;
15
+ import 'package:provider/provider.dart' ;
6
16
7
17
class WebScreenLayout extends StatefulWidget {
8
18
const WebScreenLayout ({super .key});
@@ -12,11 +22,28 @@ class WebScreenLayout extends StatefulWidget {
12
22
}
13
23
14
24
class _WebScreenLayoutState extends State <WebScreenLayout > {
25
+ final SideMenuController _controller = SideMenuController ();
26
+ int _currentIndex = 0 ;
27
+
28
+ final List <Widget > pages = [
29
+ const PostFeed (),
30
+ const SearchScreen (),
31
+ Container (color: Colors .yellow),
32
+ Container (
33
+ color: Colors .purple,
34
+ ),
35
+ Container (
36
+ color: Colors .green,
37
+ ),
38
+ const AddPost (),
39
+ ProfileScreen (
40
+ uid: FirebaseAuth .instance.currentUser! .uid,
41
+ ),
42
+ ];
43
+
15
44
@override
16
45
Widget build (BuildContext context) {
17
- final SideMenuController _controller = SideMenuController ();
18
- int _currentIndex = 0 ;
19
-
46
+ UserDetails userDetails = Provider .of <UserProvider >(context).getUser;
20
47
return Scaffold (
21
48
body: Row (
22
49
children: [
@@ -56,7 +83,9 @@ class _WebScreenLayoutState extends State<WebScreenLayout> {
56
83
),
57
84
selectedIcon: const Icon (Icons .home),
58
85
selectedTitleStyle: const TextStyle (
59
- fontWeight: FontWeight .bold, color: primaryColor),
86
+ fontSize: 18 ,
87
+ fontWeight: FontWeight .bold,
88
+ color: primaryColor),
60
89
// badgeContent: const Text(
61
90
// '23',
62
91
// style: TextStyle(
@@ -72,7 +101,9 @@ class _WebScreenLayoutState extends State<WebScreenLayout> {
72
101
title: 'Search' ,
73
102
hoverColor: Colors .white38,
74
103
selectedTitleStyle: const TextStyle (
75
- fontWeight: FontWeight .bold, color: primaryColor),
104
+ fontSize: 18 ,
105
+ fontWeight: FontWeight .bold,
106
+ color: primaryColor),
76
107
icon: const Icon (
77
108
Icons .search_outlined,
78
109
color: secondaryColor,
@@ -92,7 +123,9 @@ class _WebScreenLayoutState extends State<WebScreenLayout> {
92
123
hoverColor: Colors .white38,
93
124
itemHeight: 40 ,
94
125
selectedTitleStyle: const TextStyle (
95
- fontWeight: FontWeight .bold, color: primaryColor),
126
+ fontSize: 18 ,
127
+ fontWeight: FontWeight .bold,
128
+ color: primaryColor),
96
129
icon: Padding (
97
130
padding: const EdgeInsets .all (8 ),
98
131
child: SvgPicture .asset (
@@ -121,7 +154,9 @@ class _WebScreenLayoutState extends State<WebScreenLayout> {
121
154
title: 'Messages' ,
122
155
hoverColor: Colors .white38,
123
156
selectedTitleStyle: const TextStyle (
124
- fontWeight: FontWeight .bold, color: primaryColor),
157
+ fontSize: 18 ,
158
+ fontWeight: FontWeight .bold,
159
+ color: primaryColor),
125
160
icon: const Icon (Icons .chat_bubble_outline),
126
161
selectedIcon: const Icon (Icons .chat_bubble),
127
162
titleStyle:
@@ -134,7 +169,9 @@ class _WebScreenLayoutState extends State<WebScreenLayout> {
134
169
title: 'Notifications' ,
135
170
hoverColor: Colors .white38,
136
171
selectedTitleStyle: const TextStyle (
137
- fontWeight: FontWeight .bold, color: primaryColor),
172
+ fontSize: 18 ,
173
+ fontWeight: FontWeight .bold,
174
+ color: primaryColor),
138
175
icon: const Icon (Icons .favorite_border),
139
176
selectedIcon: const Icon (Icons .favorite),
140
177
titleStyle:
@@ -147,48 +184,52 @@ class _WebScreenLayoutState extends State<WebScreenLayout> {
147
184
title: 'Create' ,
148
185
hoverColor: Colors .white38,
149
186
selectedTitleStyle: const TextStyle (
150
- fontWeight: FontWeight .bold, color: primaryColor),
187
+ fontSize: 18 ,
188
+ fontWeight: FontWeight .bold,
189
+ color: primaryColor),
151
190
icon: const Icon (Icons .add_box_outlined),
152
191
selectedIcon: const Icon (Icons .add_box_sharp),
153
192
titleStyle:
154
193
const TextStyle (color: secondaryColor, fontSize: 18 ),
155
194
),
195
+ SideMenuItemDataTile (
196
+ margin: const EdgeInsetsDirectional .only (top: 10 ),
197
+ isSelected: _currentIndex == 6 ,
198
+ onTap: () => setState (() => _currentIndex = 6 ),
199
+ title: 'Profile' ,
200
+ hoverColor: Colors .white38,
201
+ selectedTitleStyle: const TextStyle (
202
+ fontSize: 18 ,
203
+ fontWeight: FontWeight .bold,
204
+ color: primaryColor),
205
+ icon: const Icon (Icons .person_2_outlined),
206
+ selectedIcon: const Icon (Icons .person_2),
207
+ titleStyle:
208
+ const TextStyle (color: secondaryColor, fontSize: 18 ),
209
+ ),
156
210
],
157
- footer: const ListTile (
158
- leading: CircleAvatar (),
159
- title: Text ("username" ),
160
- subtitle: Text ("name" ),
211
+ footer: ListTile (
212
+ leading: CircleAvatar (
213
+ backgroundImage: NetworkImage (userDetails.profileUrl),
214
+ ),
215
+ title: Text (userDetails.username),
216
+ subtitle: Text (userDetails.bio),
161
217
),
162
218
);
163
219
},
164
220
),
165
221
),
166
222
Expanded (
167
223
child: Container (
168
- color: Colors .white,
169
- child: Column (
170
- crossAxisAlignment: CrossAxisAlignment .center,
171
- mainAxisAlignment: MainAxisAlignment .center,
172
- children: [
173
- Text (
174
- 'body' ,
175
- style: Theme .of (context).textTheme.displaySmall,
176
- ),
177
- ElevatedButton (
178
- onPressed: () {
179
- _controller.toggle ();
180
- },
181
- child: const Text ('change side menu state' ),
182
- )
183
- ],
184
- ),
224
+ color: mobileBackgroundColor,
225
+ child: pages[_currentIndex],
185
226
),
186
227
),
187
228
SideMenu (
188
- maxWidth: 300 ,
229
+ maxWidth: 380 ,
189
230
position: SideMenuPosition .right,
190
231
builder: (data) => const SideMenuData (
191
- customChild: Text ( 'custom view' ),
232
+ customChild: SuggestionScreen ( ),
192
233
),
193
234
),
194
235
],
0 commit comments