Skip to content

Commit 316e5c4

Browse files
committed
more doc updates
1 parent 69e0d6a commit 316e5c4

File tree

3 files changed

+66
-31
lines changed

3 files changed

+66
-31
lines changed

packages/stream_feed_flutter_core/lib/src/bloc/feed_bloc.dart

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import 'package:stream_feed_flutter_core/src/extensions.dart';
99
/// {@macro feedBloc}
1010
/// {@macro genericParameters}
1111
class GenericFeedBloc<A, Ob, T, Or> {
12+
/// {@macro feedBloc}
1213
GenericFeedBloc({required this.client, this.analyticsClient});
1314

1415
/// The underlying client instance
@@ -68,7 +69,15 @@ class GenericFeedBloc<A, Ob, T, Or> {
6869

6970
/* ACTIVITIES */
7071

71-
/// Add an activity to the feed.
72+
/// {@template onAddActivity}
73+
/// Add an activity to the feed in a reactive way
74+
///
75+
/// For example a tweet
76+
/// ```dart
77+
/// FeedProvider.of(context).bloc.onAddActivity()
78+
/// ```
79+
/// {@endtemplate}
80+
7281
Future<Activity> onAddActivity({
7382
required String feedGroup,
7483
Map<String, String>? data,
@@ -109,6 +118,14 @@ class GenericFeedBloc<A, Ob, T, Or> {
109118
return addedActivity;
110119
}
111120

121+
/// {@template onRemoveActivity}
122+
/// Remove an Activity from the feed in a reactive way
123+
///
124+
/// For example delete a tweet
125+
/// ```dart
126+
/// FeedProvider.of(context).bloc.onRemoveActivity()
127+
/// ```
128+
/// {@endtemplate}
112129
Future<void> onRemoveActivity({
113130
required String feedGroup,
114131
required String activityId,
@@ -119,9 +136,17 @@ class GenericFeedBloc<A, Ob, T, Or> {
119136
_activities.removeWhere((element) => element.id == activityId);
120137
activitiesController.add(feedGroup, _activities);
121138
}
139+
122140
/* CHILD REACTIONS */
123141

124-
/// Add child reaction
142+
/// {@template onAddChildReaction}
143+
/// Add child reaction to the feed in a reactive way
144+
///
145+
/// For example to add a like to a comment
146+
/// ```dart
147+
/// FeedProvider.of(context).bloc.onAddReaction()
148+
/// ```
149+
/// {@endtemplate}
125150
Future<Reaction> onAddChildReaction({
126151
required String kind,
127152
required Reaction reaction,
@@ -157,7 +182,14 @@ class GenericFeedBloc<A, Ob, T, Or> {
157182
return childReaction;
158183
}
159184

160-
/// Remove child reactions
185+
/// {@template onRemoveChildReaction}
186+
/// Remove child reactions from the feed in a reactive way
187+
///
188+
/// For example to unlike a comment
189+
/// ```dart
190+
/// FeedProvider.of(context).bloc.onRemoveChildReaction()
191+
/// ```
192+
/// {@endtemplate}
161193
Future<void> onRemoveChildReaction({
162194
required String kind,
163195
required GenericEnrichedActivity activity,
@@ -191,7 +223,14 @@ class GenericFeedBloc<A, Ob, T, Or> {
191223
..update(activity.id!, _reactions.updateIn(updatedReaction, indexPath));
192224
}
193225

194-
/// Remove reaction from the feed.
226+
/// {@template onRemoveReaction}
227+
/// Remove reaction from the feed in a reactive way
228+
///
229+
/// For example to delete a comment under a tweet
230+
/// ```dart
231+
/// FeedProvider.of(context).bloc.onRemoveReaction()
232+
/// ```
233+
/// {@endtemplate}
195234
Future<void> onRemoveReaction({
196235
required String kind,
197236
required GenericEnrichedActivity<A, Ob, T, Or> activity,
@@ -296,7 +335,12 @@ class GenericFeedBloc<A, Ob, T, Or> {
296335
: print('warning: analytics: not enabled'); //TODO:logger
297336
}
298337

299-
/// Query reactions
338+
/// {@template queryReactions}
339+
/// Query the reactions stream (like, retweet, claps).
340+
///
341+
/// Checkout our convenient core widget
342+
/// [ReactionListCore] for displaying reactions easily
343+
/// {@endtemplate}
300344
Future<void> queryReactions(
301345
LookupAttribute lookupAttr,
302346
String lookupValue, {
@@ -337,6 +381,12 @@ class GenericFeedBloc<A, Ob, T, Or> {
337381
}
338382
}
339383

384+
/// {@template queryEnrichedActivities}
385+
/// Query the activities stream
386+
///
387+
/// Checkout our convenient core widget [FlatFeedCore]
388+
/// to display activities easily
389+
/// {@endtemplate}
340390
Future<void> queryEnrichedActivities({
341391
required String feedGroup,
342392
int? limit,

packages/stream_feed_flutter_core/lib/src/bloc/provider.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ import 'package:stream_feed_flutter_core/src/bloc/feed_bloc.dart';
77
/// {@macro feedProvider}
88
/// {@macro genericParameters}
99
class GenericFeedProvider<A, Ob, T, Or> extends InheritedWidget {
10+
/// {@macro feedProvider}
1011
const GenericFeedProvider({
1112
Key? key,
1213
required this.bloc,
1314
required Widget child,
1415
}) : super(key: key, child: child);
1516

17+
/// Obtains the nearest widget of type [GenericFeedProvider<A, Ob, T, Or>]
1618
factory GenericFeedProvider.of(BuildContext context) {
1719
final result = context.dependOnInheritedWidgetOfExactType<
1820
GenericFeedProvider<A, Ob, T, Or>>();

packages/stream_feed_flutter_core/lib/src/typedefs.dart

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ typedef ReactionsBuilder = Widget Function(
3939
/// ## Usage
4040
///
4141
/// ```dart
42-
/// class FlatActivityListPage extends StatelessWidget {
42+
/// class ActivityListView extends StatelessWidget {
4343
/// @override
4444
/// Widget build(BuildContext context) {
4545
/// return Scaffold(
@@ -73,7 +73,7 @@ typedef FlatFeedCore = GenericFlatFeedCore<User, String, String, String>;
7373
/// ## Usage
7474
///
7575
/// ```dart
76-
/// class FlatActivityListPage extends StatelessWidget {
76+
/// class ReactionListView extends StatelessWidget {
7777
/// @override
7878
/// Widget build(BuildContext context) {
7979
/// return Scaffold(
@@ -134,31 +134,14 @@ typedef FeedProvider = GenericFeedProvider<User, String, String, String>;
134134
/// more advanced use case use [GenericFeedBloc] instead
135135
///
136136
/// ## Usage
137-
/// - query the activities stream. Checkout our core widget [FlatFeedCore]
138-
/// to display activities
139-
/// - query the reactions stream (like, retweet, claps). Checkout our core widget
140-
/// [ReactionListCore] for displaying reactions
141-
/// - add activities (a tweet for example) in a reactive way
142-
/// ```dart
143-
/// FeedProvider.of(context).bloc.onAddActivity()
144-
/// ```
145-
/// - remove activities (delete a tweet) in a reactive way
146-
/// ```dart
147-
/// FeedProvider.of(context).bloc.onRemoveActivity()
148-
/// ```
137+
/// - {@macro queryEnrichedActivities}
138+
/// - {@macro queryReactions}
139+
/// - {@macro onAddActivity}
140+
/// - {@macro deleteActivity}
149141
/// - {@macro onAddReaction}
150-
/// - remove reacitons (delete a comment under a tweet) in a reactive way
151-
/// ```dart
152-
/// FeedProvider.of(context).bloc.onRemoveReaction()
153-
/// ```
154-
/// - add child reactions (like to a comment) in a reactive way
155-
/// ```dart
156-
/// FeedProvider.of(context).bloc.onAddReaction()
157-
/// ```
158-
/// - remove child reacitons (unlike a comment) in a reactive way
159-
/// ```dart
160-
/// FeedProvider.of(context).bloc.onRemoveChildReaction()
161-
/// ```
142+
/// - {@macro onRemoveReaction}
143+
/// - {@macro onAddChildReaction}
144+
/// - {@macro onRemoveChildReaction}
162145
/// {@endtemplate}
163146
///
164147
/// {@template genericParameters}

0 commit comments

Comments
 (0)