Pending Post Screen
Introduction
The Pending Post Screen (LMFeedPendingPostsScreen) serves as an interface for managing and displaying posts that are pending publication.
1. LMFeedPendingPostsScreen Widget
File Location:
pending_posts_screen.dart
Class Declaration
class LMFeedPendingPostsScreen extends StatefulWidget {
/// Builder for app bar.
final LMFeedAppBarBuilder? appBar;
/// Builder for post item.
final LMFeedPostWidgetBuilder? postBuilder;
/// Builder for floating action button (e.g., new post button).
final LMFeedContextButtonBuilder? floatingActionButtonBuilder;
/// Builder for empty feed view.
final LMFeedContextWidgetBuilder? noItemsFoundIndicatorBuilder;
/// Builder for first page loader when no posts are available.
final LMFeedContextWidgetBuilder? firstPageProgressIndicatorBuilder;
/// Builder for pagination loader when more posts are being loaded.
final LMFeedContextWidgetBuilder? moreItemsProgressIndicatorBuilder;
const LMFeedPendingPostsScreen({
super.key,
this.appBar,
this.postBuilder,
this.floatingActionButtonBuilder,
this.noItemsFoundIndicatorBuilder,
this.firstPageProgressIndicatorBuilder,
this.moreItemsProgressIndicatorBuilder,
});
State<LMFeedPendingPostsScreen> createState() => _LMFeedPendingPostsScreenState();
}
Key Parameters
appBar(LMFeedAppBarBuilder?, optional): Builder for app bar.postBuilder(LMFeedPostWidgetBuilder?, optional): Builder for post item.floatingActionButtonBuilder(LMFeedContextButtonBuilder?, optional): Builder for floating action button (e.g., new post button).noItemsFoundIndicatorBuilder(LMFeedContextWidgetBuilder?, optional): Builder for empty feed view.firstPageProgressIndicatorBuilder(LMFeedContextWidgetBuilder?, optional): Builder for first page loader when no posts are available.
For the complete source code, refer to the GitHub link.
2. LMFeedPendingPostBuilderDelegate
File Location:
builder.dart
Class Declaration
class LMFeedPendingPostBuilderDelegate extends LMFeedWidgetBuilderDelegate {
const LMFeedPendingPostBuilderDelegate();
}
The LMFeedPendingPostBuilderDelegate allows developers to customize the post items, empty states, and loaders specifically for the pending post screen.
Methods in LMFeedPendingPostBuilderDelegate
postWidgetBuilder
Definition: Builds the widget for posts in the pending post screen.
Purpose: Customizes the style and layout of posts.Usage Example:
Widget postWidgetBuilder(
BuildContext context, LMFeedPostWidget post, LMPostViewData postViewData,
{LMFeedWidgetSource source = LMFeedWidgetSource.universalFeed}) {
return post.copyWith();
}noItemsFoundIndicatorBuilder
Definition: Builds the widget for the empty state in the pending post screen.
Purpose: Customizes the appearance and behavior of the empty state.Usage Example:
Widget noItemsFoundIndicatorBuilder(BuildContext context,
{LMFeedButton? createPostButton, bool isSelfPost = true, Widget? child}) {
return child;
}firstPageProgressIndicatorBuilder
Definition: Builds the loader widget for the pending post screen.
Purpose: Provides a way to customize the loader.Usage Example:
Widget firstPageProgressIndicatorBuilder(BuildContext context,
{Widget? child}) {
return child;
}
Remaining Methods
Explore the complete list of methods here.
3. LMFeedPendingPostSetting
File Location:
settings.dart
class LMFeedPendingPostSetting {
const LMFeedPendingPostSetting();
}
- Purpose: Provides configuration settings for the Pending Post Screen. No additional fields or methods are currently defined.
4. LMFeedPendingPostStyle
File Location:
style.dart
class LMFeedPendingPostStyle {
const LMFeedPendingPostStyle();
}
- Purpose: Defines styling options for the Pending Post Screen. No fields or methods are currently defined.
5. LMFeedPendingPostConfig
File Location:
config.dart
Class Declaration
class LMFeedPendingPostConfig {
final LMFeedPendingPostBuilderDelegate builder;
final LMFeedPendingPostSetting setting;
final LMFeedPendingPostStyle style;
const LMFeedPendingPostConfig({
this.builder = const LMFeedPendingPostBuilderDelegate(),
this.setting = const LMFeedPendingPostSetting(),
this.style = const LMFeedPendingPostStyle(),
});
}
Usage Example: Injecting Custom Configuration
Create a Custom Builder:
class CustomPendingPostBuilder extends LMFeedPendingPostBuilderDelegate {
Widget postWidgetBuilder(
BuildContext context, LMFeedPostWidget post, LMPostViewData postViewData,
{LMFeedWidgetSource source = LMFeedWidgetSource.universalFeed}) {
return post.copyWith();
}
}Pass Custom Style or Setting along with Builder:
final customStyle = LMFeedPendingPostStyle();
final customSetting = LMFeedPendingPostSetting();Inject the Custom Builder, Style, or Setting into the Config:
final pendingPostConfig = LMFeedPendingPostConfig(
builder: CustomPendingPostBuilder(),
setting: customSetting,
style: customStyle,
);Initialize with Custom Config:
LMFeedCore.instance.initialize(
config: LMFeedConfig(
pendingPostConfig: pendingPostConfig,
),
);
6. Summary
The Pending Post Screen provides a user interface for managing pending posts. Developers can customize components like post items, empty states, and loaders using the LMFeedPendingPostBuilderDelegate. Configuration options are encapsulated in LMFeedPendingPostConfig, enabling seamless integration and customization tailored to specific design and functional requirements.