@@ -6,19 +6,19 @@ import 'main.dart'; //needed for currentuser id
6
6
7
7
class ActivityFeedPage extends StatefulWidget {
8
8
@override
9
- _ActivityFeedPageState createState () => new _ActivityFeedPageState ();
9
+ _ActivityFeedPageState createState () => _ActivityFeedPageState ();
10
10
}
11
11
12
12
class _ActivityFeedPageState extends State <ActivityFeedPage > with AutomaticKeepAliveClientMixin <ActivityFeedPage > {
13
13
@override
14
14
Widget build (BuildContext context) {
15
15
super .build (context); // reloads state when opened again
16
16
17
- return new Scaffold (
18
- appBar: new AppBar (
19
- title: new Text (
17
+ return Scaffold (
18
+ appBar: AppBar (
19
+ title: Text (
20
20
"Activity Feed" ,
21
- style: new TextStyle (color: Colors .black),
21
+ style: TextStyle (color: Colors .black),
22
22
),
23
23
backgroundColor: Colors .white,
24
24
),
@@ -27,17 +27,17 @@ class _ActivityFeedPageState extends State<ActivityFeedPage> with AutomaticKeepA
27
27
}
28
28
29
29
buildActivityFeed () {
30
- return new Container (
31
- child: new FutureBuilder (
30
+ return Container (
31
+ child: FutureBuilder (
32
32
future: getFeed (),
33
33
builder: (context, snapshot) {
34
34
if (! snapshot.hasData)
35
- return new Container (
35
+ return Container (
36
36
alignment: FractionalOffset .center,
37
37
padding: const EdgeInsets .only (top: 10.0 ),
38
- child: new CircularProgressIndicator ());
38
+ child: CircularProgressIndicator ());
39
39
else {
40
- return new ListView (children: snapshot.data);
40
+ return ListView (children: snapshot.data);
41
41
}
42
42
}),
43
43
);
@@ -53,7 +53,7 @@ class _ActivityFeedPageState extends State<ActivityFeedPage> with AutomaticKeepA
53
53
.getDocuments ();
54
54
55
55
for (var doc in snap.documents) {
56
- items.add (new ActivityFeedItem .fromDocument (doc));
56
+ items.add (ActivityFeedItem .fromDocument (doc));
57
57
}
58
58
return items;
59
59
}
@@ -68,7 +68,7 @@ class ActivityFeedItem extends StatelessWidget {
68
68
final String username;
69
69
final String userId;
70
70
final String
71
- type; // potetial types include liked photo, follow user, comment on photo
71
+ type; // types include liked photo, follow user, comment on photo
72
72
final String mediaUrl;
73
73
final String mediaId;
74
74
final String userProfileImg;
@@ -84,7 +84,7 @@ class ActivityFeedItem extends StatelessWidget {
84
84
this .commentData});
85
85
86
86
factory ActivityFeedItem .fromDocument (DocumentSnapshot document) {
87
- return new ActivityFeedItem (
87
+ return ActivityFeedItem (
88
88
username: document['username' ],
89
89
userId: document['userId' ],
90
90
type: document['type' ],
@@ -95,26 +95,26 @@ class ActivityFeedItem extends StatelessWidget {
95
95
);
96
96
}
97
97
98
- Widget mediaPreview = new Container ();
98
+ Widget mediaPreview = Container ();
99
99
String actionText;
100
100
101
101
void configureItem (BuildContext context) {
102
102
if (type == "like" || type == "comment" ) {
103
- mediaPreview = new GestureDetector (
103
+ mediaPreview = GestureDetector (
104
104
onTap: () {
105
105
openImage (context, mediaId);
106
106
},
107
- child: new Container (
107
+ child: Container (
108
108
height: 45.0 ,
109
109
width: 45.0 ,
110
- child: new AspectRatio (
110
+ child: AspectRatio (
111
111
aspectRatio: 487 / 451 ,
112
- child: new Container (
113
- decoration: new BoxDecoration (
114
- image: new DecorationImage (
112
+ child: Container (
113
+ decoration: BoxDecoration (
114
+ image: DecorationImage (
115
115
fit: BoxFit .fill,
116
116
alignment: FractionalOffset .topCenter,
117
- image: new NetworkImage (mediaUrl),
117
+ image: NetworkImage (mediaUrl),
118
118
)),
119
119
),
120
120
),
@@ -136,18 +136,18 @@ class ActivityFeedItem extends StatelessWidget {
136
136
@override
137
137
Widget build (BuildContext context) {
138
138
configureItem (context);
139
- return new Row (
139
+ return Row (
140
140
mainAxisSize: MainAxisSize .max,
141
141
children: < Widget > [
142
- new Padding (
142
+ Padding (
143
143
padding: const EdgeInsets .only (left: 20.0 , right: 15.0 ),
144
- child: new CircleAvatar (
144
+ child: CircleAvatar (
145
145
radius: 23.0 ,
146
- backgroundImage: new NetworkImage (userProfileImg),
146
+ backgroundImage: NetworkImage (userProfileImg),
147
147
),
148
148
),
149
149
Expanded (
150
- child: new Row (
150
+ child: Row (
151
151
mainAxisSize: MainAxisSize .min,
152
152
children: < Widget > [
153
153
GestureDetector (
@@ -170,11 +170,11 @@ class ActivityFeedItem extends StatelessWidget {
170
170
],
171
171
),
172
172
),
173
- new Container (
174
- child: new Align (
175
- child: new Padding (
173
+ Container (
174
+ child: Align (
175
+ child: Padding (
176
176
child: mediaPreview,
177
- padding: new EdgeInsets .all (15.0 ),
177
+ padding: EdgeInsets .all (15.0 ),
178
178
),
179
179
alignment: AlignmentDirectional .bottomEnd))
180
180
],
@@ -185,19 +185,19 @@ class ActivityFeedItem extends StatelessWidget {
185
185
openImage (BuildContext context, String imageId) {
186
186
print ("the image id is $imageId " );
187
187
Navigator .of (context)
188
- .push (new MaterialPageRoute <bool >(builder: (BuildContext context) {
189
- return new Center (
190
- child: new Scaffold (
191
- appBar: new AppBar (
192
- title: new Text ('Photo' ,
193
- style: new TextStyle (
188
+ .push (MaterialPageRoute <bool >(builder: (BuildContext context) {
189
+ return Center (
190
+ child: Scaffold (
191
+ appBar: AppBar (
192
+ title: Text ('Photo' ,
193
+ style: TextStyle (
194
194
color: Colors .black, fontWeight: FontWeight .bold)),
195
195
backgroundColor: Colors .white,
196
196
),
197
- body: new ListView (
197
+ body: ListView (
198
198
children: < Widget > [
199
- new Container (
200
- child: new ImagePostFromId (id: imageId),
199
+ Container (
200
+ child: ImagePostFromId (id: imageId),
201
201
),
202
202
],
203
203
)),
0 commit comments