@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
22import 'package:stream_feed_flutter_core/src/bloc/bloc.dart' ;
33import 'package:stream_feed_flutter_core/stream_feed_flutter_core.dart' ;
44
5+ /* BUILDERS */
56/// {@template enrichedFeedBuilder}
67/// A builder that allows building a ListView of EnrichedActivity based Widgets
78/// {@endtemplate}
@@ -17,13 +18,24 @@ typedef EnrichedFeedBuilder<A, Ob, T, Or> = Widget Function(
1718typedef ReactionsBuilder = Widget Function (
1819 BuildContext context, List <Reaction > reactions, int idx);
1920
20- /* Convenient typedefs for defining default type parameters
21+ /* CONVENIENT TYPEDEFS
22+ for defining default type parameters.
2123 Dart doesn't allow a type parameter to have a default value
22- so this is hack until it is supported
24+ so this is a hack until it is supported
2325*/
2426
25- /// {@template flatFeedCore}
2627///Convenient typedef for [GenericFlatFeedCore] with default parameters
28+ ///
29+ /// {@template flatFeedCore}
30+ /// [FlatFeedCore] is a core class that allows fetching a list of
31+ /// enriched activities (flat) while exposing UI builders.
32+ /// Make sure to have a [FeedProvider] ancestor in order to provide the
33+ /// information about the activities.
34+ /// Usually what you want is the convenient [FlatFeedCore] that already
35+ /// has the default parameters defined for you
36+ /// suitable to most use cases. But if you need a
37+ /// more advanced use case use [GenericFlatFeedCore] instead
38+ ///
2739/// ## Usage
2840///
2941/// ```dart
@@ -53,11 +65,102 @@ typedef ReactionsBuilder = Widget Function(
5365typedef FlatFeedCore = GenericFlatFeedCore <User , String , String , String >;
5466
5567///Convenient typedef for [GenericReactionListCore] with default parameters
68+ ///
69+ /// {@template reactionListCore}
70+ /// [ReactionListCore] is a core class that allows fetching a list of
71+ /// reactions while exposing UI builders.
72+ ///
73+ /// ## Usage
74+ ///
75+ /// ```dart
76+ /// class FlatActivityListPage extends StatelessWidget {
77+ /// @override
78+ /// Widget build(BuildContext context) {
79+ /// return Scaffold(
80+ /// body: ReactionListCore(
81+ /// onErrorWidget: Center(
82+ /// child: Text('An error has occurred'),
83+ /// ),
84+ /// onEmptyWidget: Center(
85+ /// child: Text('Nothing here...'),
86+ /// ),
87+ /// onProgressWidget: Center(
88+ /// child: CircularProgressIndicator(),
89+ /// ),
90+ /// feedBuilder: (context, reactions, idx) {
91+ /// return YourReactionWidget(reaction: reactions[idx]);
92+ /// }
93+ /// ),
94+ /// );
95+ /// }
96+ /// }
97+ /// ```
98+ ///
99+ /// Make sure to have a [FeedProvider] ancestor in order to provide the
100+ /// information about the reactions.
101+ ///
102+ /// Usually what you want is the convenient [ReactionListCore] that already
103+ /// has the default parameters defined for you
104+ /// suitable to most use cases. But if you need a
105+ /// more advanced use case use [GenericReactionListCore] instead
106+ /// {@endtemplate}
56107typedef ReactionListCore
57108 = GenericReactionListCore <User , String , String , String >;
58109
59- ///Convenient typedef for [GenericFeedProvider] with default parameters
110+ /// Convenient typedef for [GenericFeedProvider] with default parameters
111+ ///
112+ /// {@template feedProvider}
113+ /// Inherited widget providing the [FeedBloc] to the widget tree
114+ /// Usually what you need is the convenient [FeedProvider] that already
115+ /// has the default parameters defined for you
116+ /// suitable to most usecases. But if you need a
117+ /// more advanced use case use [GenericFeedProvider] instead
118+ /// {@endtemplate}
60119typedef FeedProvider = GenericFeedProvider <User , String , String , String >;
61120
62- ///Convenient typedef for [GenericFeedBloc] with default parameters
121+ /// Convenient typedef for [GenericFeedBloc] with default parameters
122+ ///
123+ /// {@template feedBloc}
124+ /// Widget dedicated to the state management of an app's Stream feed
125+ /// [FeedBloc] is used to manage a set of operations
126+ /// associated with [EnrichedActivity] s and [Reaction] s.
127+ ///
128+ /// [FeedBloc] can be access at anytime by using the factory [of] method
129+ /// using Flutter's [BuildContext] .
130+ ///
131+ /// Usually what you want is the convenient [FeedBloc] that already
132+ /// has the default parameters defined for you
133+ /// suitable to most use cases. But if you need a
134+ /// more advanced use case use [GenericFeedBloc] instead
135+ ///
136+ /// ## 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+ /// ```
149+ /// - add reactions (comment under a tweet) in a reactive way
150+ /// ```dart
151+ /// FeedProvider.of(context).bloc.onAddReaction()
152+ /// ```
153+ /// - remove reacitons (delete a comment under a tweet) in a reactive way
154+ /// ```dart
155+ /// FeedProvider.of(context).bloc.onRemoveReaction()
156+ /// ```
157+ /// - add child reactions (like to a comment) in a reactive way
158+ /// ```dart
159+ /// FeedProvider.of(context).bloc.onAddReaction()
160+ /// ```
161+ /// - remove child reacitons (unlike a comment) in a reactive way
162+ /// ```dart
163+ /// FeedProvider.of(context).bloc.onRemoveChildReaction()
164+ /// ```
165+ /// {@endtemplate}
63166typedef FeedBloc = GenericFeedBloc <User , String , String , String >;
0 commit comments