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
postWidget
Definition: Builds the widget for posts in the pending post screen.
Purpose: Customizes the style and layout of posts.Usage Example:
Widget postWidget(BuildContext context) {
// Return a custom widget for displaying posts
return CustomPostWidget();
}emptyStateWidget
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 emptyStateWidget(BuildContext context) {
// Return a custom widget for the empty state
return CustomEmptyStateWidget();
}loaderWidget
Definition: Builds the loader widget for the pending post screen.
Purpose: Provides a way to customize the loader.Usage Example:
Widget loaderWidget(BuildContext context) {
// Return a custom loader widget
return CustomLoader();
}
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 postWidget(BuildContext context) {
return Text('Custom Post Widget');
}
}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.