1
+ import 'dart:ui' ;
2
+
3
+ import 'package:flutter/material.dart' ;
4
+ import 'package:flutter_photography/data/Sample.dart' ;
5
+ import 'package:flutter_photography/helper/Colorsys.dart' ;
6
+ import 'package:flutter_photography/models/Collocation.dart' ;
7
+ import 'package:flutter_photography/models/User.dart' ;
8
+
9
+ class SingleUser extends StatefulWidget {
10
+ final User user;
11
+
12
+ const SingleUser ({Key key, this .user}) : super (key: key);
13
+
14
+ @override
15
+ _SingleUserState createState () => _SingleUserState ();
16
+ }
17
+
18
+ class _SingleUserState extends State <SingleUser > {
19
+ @override
20
+ Widget build (BuildContext context) {
21
+ return Scaffold (
22
+ backgroundColor: Colorsys .lightGrey,
23
+ appBar: AppBar (
24
+ elevation: 0 ,
25
+ backgroundColor: Colors .white,
26
+ leading: BackButton (
27
+ onPressed: () {
28
+ Navigator .pop (context);
29
+ },
30
+ color: Colorsys .grey,
31
+ ),
32
+ actions: < Widget > [
33
+ IconButton (
34
+ icon: Icon (Icons .more_horiz, size: 25 , color: Colorsys .grey,),
35
+ )
36
+ ],
37
+ ),
38
+ body: SingleChildScrollView (
39
+ child: Column (
40
+ children: < Widget > [
41
+ Container (
42
+ width: double .infinity,
43
+ decoration: BoxDecoration (
44
+ borderRadius: BorderRadius .only (bottomLeft: Radius .circular (15 ), bottomRight: Radius .circular (15 )),
45
+ color: Colors .white
46
+ ),
47
+ child: Column (
48
+ children: < Widget > [
49
+ Hero (
50
+ transitionOnUserGestures: true ,
51
+ tag: widget.user.username,
52
+ child: CircleAvatar (
53
+ backgroundImage: AssetImage (widget.user.profilePicture),
54
+ maxRadius: 40 ,
55
+ ),
56
+ ),
57
+ SizedBox (height: 20 ,),
58
+ Text (widget.user.name, style: TextStyle (
59
+ fontSize: 20 ,
60
+ color: Colorsys .black,
61
+ fontWeight: FontWeight .bold
62
+ ),),
63
+ SizedBox (height: 5 ,),
64
+ Text (widget.user.username, style: TextStyle (
65
+ fontSize: 15 ,
66
+ color: Colorsys .grey
67
+ ),),
68
+ SizedBox (height: 20 ,),
69
+ Row (
70
+ mainAxisAlignment: MainAxisAlignment .center,
71
+ children: < Widget > [
72
+ makeFollowWidgets (
73
+ count: widget.user.followers,
74
+ name: "Followers"
75
+ ),
76
+ Container (
77
+ width: 2 ,
78
+ height: 15 ,
79
+ margin: EdgeInsets .symmetric (horizontal: 20 ),
80
+ color: Colorsys .lightGrey,
81
+ ),
82
+ makeFollowWidgets (
83
+ count: widget.user.following,
84
+ name: "Following"
85
+ ),
86
+ ],
87
+ ),
88
+ SizedBox (height: 20 ,),
89
+ makeActionButtons ()
90
+ ],
91
+ ),
92
+ ),
93
+ SizedBox (height: 30 ,),
94
+ Padding (
95
+ padding: EdgeInsets .all (20 ),
96
+ child: Column (
97
+ children: < Widget > [
98
+ Container (
99
+ decoration: BoxDecoration (
100
+ border: Border (bottom: BorderSide (
101
+ color: Colorsys .grey300,
102
+ ))
103
+ ),
104
+ child: Row (
105
+ crossAxisAlignment: CrossAxisAlignment .start,
106
+ children: < Widget > [
107
+ Column (
108
+ crossAxisAlignment: CrossAxisAlignment .start,
109
+ children: < Widget > [
110
+ Text ("Collotion" , style: TextStyle (
111
+ color: Colorsys .black,
112
+ fontWeight: FontWeight .bold,
113
+ fontSize: 15
114
+ ),),
115
+ Container (
116
+ width: 50 ,
117
+ padding: EdgeInsets .only (bottom: 10 ),
118
+ decoration: BoxDecoration (
119
+ border: Border (bottom: BorderSide (
120
+ color: Colorsys .orange,
121
+ width: 3
122
+ ))
123
+ ),
124
+ )
125
+ ],
126
+ ),
127
+ SizedBox (width: 20 ,),
128
+ Text ("Likes" , style: TextStyle (
129
+ color: Colorsys .grey,
130
+ fontWeight: FontWeight .w500,
131
+ fontSize: 15
132
+ ),)
133
+ ],
134
+ ),
135
+ ),
136
+ makeColloction (widget.user.collocation)
137
+ ],
138
+ ),
139
+ ),
140
+ ],
141
+ ),
142
+ ),
143
+ );
144
+ }
145
+
146
+ Widget makeColloction (List <Collocation > collocation) {
147
+ return Container (
148
+ child: Column (
149
+ children: < Widget > [
150
+ Container (
151
+ padding: EdgeInsets .only (top: 20 ),
152
+ height: 320 ,
153
+ child: ListView .builder (
154
+ shrinkWrap: true ,
155
+ scrollDirection: Axis .horizontal,
156
+ itemCount: collocation.length,
157
+ itemBuilder: (context, index) {
158
+ return AspectRatio (
159
+ aspectRatio: 1.2 / 1 ,
160
+ child: Column (
161
+ children: < Widget > [
162
+ Expanded (
163
+ child: Container (
164
+ margin: EdgeInsets .only (right: 20 ),
165
+ decoration: BoxDecoration (
166
+ image: DecorationImage (
167
+ image: AssetImage (collocation[index].thumbnail),
168
+ fit: BoxFit .cover
169
+ ),
170
+ borderRadius: BorderRadius .circular (20 ),
171
+ color: Colors .orange
172
+ ),
173
+ child: Stack (
174
+ alignment: AlignmentDirectional .bottomCenter,
175
+ children: < Widget > [
176
+ ClipRRect (
177
+ borderRadius: BorderRadius .circular (20 ),
178
+ child: BackdropFilter (
179
+ filter: ImageFilter .blur (sigmaX: 10 , sigmaY: 10 ),
180
+ child: Container (
181
+ height: 90 ,
182
+ padding: EdgeInsets .symmetric (horizontal: 20 ),
183
+ width: double .infinity,
184
+ decoration: BoxDecoration (
185
+ borderRadius: BorderRadius .circular (24 ),
186
+ ),
187
+ child: Column (
188
+ mainAxisAlignment: MainAxisAlignment .center,
189
+ crossAxisAlignment: CrossAxisAlignment .start,
190
+ children: < Widget > [
191
+ Text (collocation[index].name, style: TextStyle (
192
+ color: Colors .white,
193
+ fontWeight: FontWeight .w600,
194
+ fontSize: 15
195
+ ),),
196
+ SizedBox (height: 5 ,),
197
+ Text (collocation[index].tags.length.toString () + " photos" , style: TextStyle (
198
+ color: Colors .white,
199
+ fontWeight: FontWeight .w300
200
+ ),)
201
+ ],
202
+ )
203
+ ),
204
+ ),
205
+ ),
206
+ ]
207
+ )
208
+ ),
209
+ ),
210
+ SizedBox (height: 10 ,),
211
+ Container (
212
+ height: 32 ,
213
+ margin: EdgeInsets .only (right: 20 ),
214
+ child: ListView .builder (
215
+ scrollDirection: Axis .horizontal,
216
+ itemCount: collocation[index].tags.length,
217
+ itemBuilder: (context, tagIndex) => Container (
218
+ margin: EdgeInsets .only (right: 10 ),
219
+ padding: EdgeInsets .symmetric (horizontal: 25 , vertical: 5 ),
220
+ decoration: BoxDecoration (
221
+ borderRadius: BorderRadius .circular (5 ),
222
+ color: Colorsys .grey300
223
+ ),
224
+ child: Center (
225
+ child: Text (collocation[index].tags[tagIndex], style: TextStyle (
226
+ ),),
227
+ ),
228
+ ),
229
+ ),
230
+ )
231
+ ],
232
+ ),
233
+ );
234
+ },
235
+ ),
236
+ )
237
+ ],
238
+ ),
239
+ );
240
+ }
241
+
242
+ Widget makeFollowWidgets ({count, name}) {
243
+ return Row (
244
+ children: < Widget > [
245
+ Text (count.toString (),
246
+ style: TextStyle (
247
+ fontSize: 15 ,
248
+ fontWeight: FontWeight .bold,
249
+ color: Colorsys .black
250
+ ),
251
+ ),
252
+ SizedBox (width: 5 ,),
253
+ Text (name,
254
+ style: TextStyle (
255
+ fontSize: 15 ,
256
+ color: Colorsys .darkGray
257
+ ),
258
+ ),
259
+ ],
260
+ );
261
+ }
262
+
263
+ Widget makeActionButtons () {
264
+ return Transform .translate (
265
+ offset: Offset (0 , 20 ),
266
+ child: Container (
267
+ height: 65 ,
268
+ padding: EdgeInsets .all (10 ),
269
+ margin: EdgeInsets .symmetric (horizontal: 50 ),
270
+ decoration: BoxDecoration (
271
+ borderRadius: BorderRadius .circular (5 ),
272
+ color: Colors .white,
273
+ boxShadow: [
274
+ BoxShadow (
275
+ color: Colors .grey[300 ],
276
+ blurRadius: 20 ,
277
+ offset: Offset (0 , 10 )
278
+ )
279
+ ]
280
+ ),
281
+ child: Row (
282
+ children: < Widget > [
283
+ Expanded (
284
+ child: MaterialButton (
285
+ shape: RoundedRectangleBorder (
286
+ borderRadius: BorderRadius .circular (5.0 ),
287
+ ),
288
+ height: double .infinity,
289
+ elevation: 0 ,
290
+ onPressed: () {
291
+ },
292
+ color: Colorsys .orange,
293
+ child: Text ("Follow" , style: TextStyle (
294
+ color: Colors .white,
295
+ ),)
296
+ ),
297
+ ),
298
+ Expanded (
299
+ child: MaterialButton (
300
+ shape: RoundedRectangleBorder (
301
+ borderRadius: BorderRadius .circular (5.0 ),
302
+ ),
303
+ height: double .infinity,
304
+ elevation: 0 ,
305
+ onPressed: () {
306
+ },
307
+ color: Colors .transparent,
308
+ child: Text ("Message" , style: TextStyle (
309
+ color: Colorsys .black,
310
+ fontWeight: FontWeight .w400
311
+ ),)
312
+ ),
313
+ )
314
+ ],
315
+ ),
316
+ ),
317
+ );
318
+ }
319
+ }
0 commit comments