User Created Post List
Introduction
The LMFeedUserCreatedPostListView
widget is designed to display a list of posts created by a specific user. It provides customization options through builder functions to alter the appearance and behavior of post items, loading indicators, and error handling. The widget utilizes paging controllers and BLoC architecture to manage state efficiently, ensuring smooth pagination and data loading.
Properties
uuid
(String
) - required
The UUID of the user for which the post list is to be displayed. This property is required to fetch the appropriate posts.
postWidgetBuilder
(LMFeedPostWidgetBuilder?)
A builder function to customize how individual posts are displayed in the list.
noItemsFoundIndicatorBuilder
(LMFeedContextWidgetBuilder?)
A builder function to render a widget when no posts are available for the user.
firstPageProgressIndicatorBuilder
(LMFeedContextWidgetBuilder?)
A builder function to display a loading indicator while the first page of posts is being fetched.
newPageProgressIndicatorBuilder
(LMFeedContextWidgetBuilder?)
A builder function to display a loading indicator when additional pages are being fetched during pagination.
noMoreItemsIndicatorBuilder
(LMFeedContextWidgetBuilder?)
A builder function to render a widget when no more posts are available to load.
firstPageErrorIndicatorBuilder
(LMFeedContextWidgetBuilder?)
A builder function to display an error message if fetching the first page fails.
newPageErrorIndicatorBuilder
(LMFeedContextWidgetBuilder?)
A builder function to display an error message if fetching additional pages fails.
Usage
Below is an example of how to use the LMFeedUserCreatedPostListView
widget to display a list of posts created by a user with a custom post builder and error indicators.
Example Code
LMFeedUserCreatedPostListView(
uuid: "USER_ID", // replace it with actual user id
postBuilder: (context, postWidget, post) {
// wrapped the actual post widget with padding and card
return Padding(
padding: const EdgeInsets.all(8.0),
child: Card(
child: postWidget,
),
);
},
noItemsFoundIndicatorBuilder: (context) => Center(
child: Text("No posts available."),
),
firstPageProgressIndicatorBuilder: (context) => Center(
child: CircularProgressIndicator(),
),
newPageErrorIndicatorBuilder: (context) => Center(
child: Text("Failed to load more posts."),
),
);