@@ -2,6 +2,7 @@ import 'package:animations/animations.dart';
2
2
import 'package:flutter/cupertino.dart' ;
3
3
import 'package:flutter/foundation.dart' ;
4
4
import 'package:flutter/material.dart' ;
5
+ import 'package:stream_feed_flutter/src/default/default.dart' ;
5
6
import 'package:stream_feed_flutter/src/utils/typedefs.dart' ;
6
7
import 'package:stream_feed_flutter/src/widgets/activity/activity.dart' ;
7
8
import 'package:stream_feed_flutter/src/widgets/dialogs/comment.dart' ;
@@ -47,7 +48,7 @@ class FlatFeedListView extends StatelessWidget {
47
48
this .ranking,
48
49
this .handleJsonKey = 'handle' ,
49
50
this .nameJsonKey = 'name' ,
50
- this .onProgressWidget = const ProgressStateWidget (),
51
+ this .onProgressWidget = const LoadingStateWidget (),
51
52
this .onErrorWidget = const ErrorStateWidget (),
52
53
this .onEmptyWidget =
53
54
const EmptyStateWidget (message: 'No activities to display' ),
@@ -133,52 +134,61 @@ class FlatFeedListView extends StatelessWidget {
133
134
session: session,
134
135
filter: filter,
135
136
ranking: ranking,
136
- onProgressWidget: onProgressWidget,
137
- onErrorWidget: onErrorWidget,
137
+ loadingBuilder: (context) => onProgressWidget,
138
+ errorBuilder: (context, error) => onErrorWidget,
139
+ emptyBuilder: (context) => onEmptyWidget,
138
140
//TODO: activity type Flat?
139
- feedBuilder: (context, activities, idx) {
140
- return ActivityWidget (
141
- activity: activities[idx],
142
- feedGroup: feedGroup,
143
- onHashtagTap: onHashtagTap,
144
- onMentionTap: onMentionTap,
145
- onUserTap: onUserTap,
146
- nameJsonKey: nameJsonKey,
147
- handleJsonKey: handleJsonKey,
148
- activityHeaderBuilder: activityHeaderBuilder,
149
- activityFooterBuilder: activityFooterBuilder,
150
- activityContentBuilder: activityContentBuilder,
151
- onActivityTap: (context, activity) {
152
- // onActivityTap != null
153
- // ? onActivityTap?.call(context, activity)
154
- // TODO: provide a way to load via url / ModalRoute.of(context).settings with ActivityCore (todo)
155
- _pageRouteBuilder (
156
- activity: activity,
157
- context: context,
158
- transitionType: transitionType,
159
- currentNavigator: Navigator .of (context),
160
- page: Scaffold (
161
- appBar: AppBar (
162
- // TODO: Parameterize me
163
- title: const Text ('Post' ),
164
- ),
165
- body: CommentView (
166
- feedGroup: feedGroup,
167
- nameJsonKey: nameJsonKey,
168
- handleJsonKey: handleJsonKey,
141
+ feedBuilder: (
142
+ context,
143
+ activities,
144
+ ) {
145
+ return ListView .builder (
146
+ itemCount: activities.length,
147
+ physics: scrollPhysics,
148
+ itemBuilder: (context, index) {
149
+ return ActivityWidget (
150
+ activity: activities[index],
151
+ feedGroup: feedGroup,
152
+ onHashtagTap: onHashtagTap,
153
+ onMentionTap: onMentionTap,
154
+ onUserTap: onUserTap,
155
+ nameJsonKey: nameJsonKey,
156
+ handleJsonKey: handleJsonKey,
157
+ activityHeaderBuilder: activityHeaderBuilder,
158
+ activityFooterBuilder: activityFooterBuilder,
159
+ activityContentBuilder: activityContentBuilder,
160
+ onActivityTap: (context, activity) {
161
+ // onActivityTap != null
162
+ // ? onActivityTap?.call(context, activity)
163
+ // TODO: provide a way to load via url / ModalRoute.of(context).settings with ActivityCore (todo)
164
+ _pageRouteBuilder (
169
165
activity: activity,
170
- enableCommentFieldButton: true ,
171
- enableReactions: true ,
172
- textEditingController:
173
- TextEditingController (), //TODO: move this into props for customisation like buildSpans
174
- ),
175
- ),
166
+ context: context,
167
+ transitionType: transitionType,
168
+ currentNavigator: Navigator .of (context),
169
+ page: Scaffold (
170
+ appBar: AppBar (
171
+ // TODO: Parameterize me
172
+ title: const Text ('Post' ),
173
+ ),
174
+ body: CommentView (
175
+ feedGroup: feedGroup,
176
+ nameJsonKey: nameJsonKey,
177
+ handleJsonKey: handleJsonKey,
178
+ activity: activity,
179
+ enableCommentFieldButton: true ,
180
+ enableReactions: true ,
181
+ textEditingController:
182
+ TextEditingController (), //TODO: move this into props for customisation like buildSpans
183
+ ),
184
+ ),
185
+ );
186
+ },
176
187
);
177
188
},
178
189
);
179
190
},
180
191
feedGroup: feedGroup,
181
- scrollPhysics: scrollPhysics,
182
192
);
183
193
}
184
194
0 commit comments