Activity Screen
Introduction
The Activity Screen (LMFeedActivityScreen
) serves as the main interface for displaying a user's activity feed. It supports customizations for the post, comment, and app bar components through builders, styles, and configurations.
1. LMFeedActivityScreen Widget
File Location:
activity_screen.dart
Class Declaration
class LMFeedActivityScreen extends StatefulWidget {
/// uuid of the user whose activity feed is to be displayed.
final String uuid;
/// Builder for the post widget.
final LMFeedPostWidgetBuilder? postBuilder;
/// Builder for the comment widget.
final LMFeedPostCommentBuilder? commentBuilder;
/// Builder for app bar.
final LMFeedAppBarBuilder? appBarBuilder;
/// A screen that displays the activity feed.
const LMFeedActivityScreen({
super.key,
required this.uuid,
this.postBuilder,
this.commentBuilder,
this.appBarBuilder,
});
State<LMFeedActivityScreen> createState() => _LMFeedActivityScreenState();
}
Key Parameters
uuid
(String
, required): UUID of the user whose activity feed is to be displayed.postBuilder
(LMFeedPostWidgetBuilder?
, optional): Builder for the post widget.commentBuilder
(LMFeedPostCommentBuilder?
, optional): Builder for the comment widget.appBarBuilder
(LMFeedAppBarBuilder?
, optional): Builder for the app bar.
For the complete source code, refer to the GitHub link.
2. LMFeedActivityBuilderDelegate
File Location:
configurations/builder.dart
Class Declaration
class LMFeedActivityBuilderDelegate extends LMFeedWidgetBuilderDelegate {
const LMFeedActivityBuilderDelegate();
}
The LMFeedActivityBuilderDelegate
allows developers to customize the post, comment, and app bar widgets specifically for the activity screen.
Methods in LMFeedActivityBuilderDelegate
postWidget
Definition: Builds the widget for posts in the activity feed.
Purpose: Customizes the style and layout of posts.Usage Example:
Widget postWidget(BuildContext context) {
// Return a custom widget for displaying posts
return CustomPostWidget();
}commentWidget
Definition: Builds the widget for comments in the activity feed.
Purpose: Customizes the appearance and behavior of comments.Usage Example:
Widget commentWidget(BuildContext context) {
// Return a custom widget for displaying comments
return CustomCommentWidget();
}appBarWidget
Definition: Builds the app bar for the activity feed.
Purpose: Provides a way to customize the app bar.Usage Example:
Widget appBarWidget(BuildContext context) {
// Return a custom app bar widget for the activity screen
return CustomAppBar();
}
Remaining Methods
Explore the complete list of methods here.
3. LMFeedActivitySetting
File Location:
configurations/settings.dart
class LMFeedActivitySetting {
const LMFeedActivitySetting();
}
- Purpose: Provides configuration settings for the Activity Screen. No additional fields or methods are currently defined.
4. LMFeedActivityStyle
File Location:
configurations/style.dart
class LMFeedActivityStyle {
const LMFeedActivityStyle();
}
- Purpose: Defines styling options for the Activity Screen. No fields or methods are currently defined.
5. LMFeedActivityConfig
File Location:
configurations/config.dart
Class Declaration
class LMFeedActivityConfig {
final LMFeedActivityBuilderDelegate builder;
final LMFeedActivitySetting setting;
final LMFeedActivityStyle style;
const LMFeedActivityConfig({
this.builder = const LMFeedActivityBuilderDelegate(),
this.setting = const LMFeedActivitySetting(),
this.style = const LMFeedActivityStyle(),
});
}
Usage Example: Injecting Custom Configuration
Create a Custom Builder:
class CustomActivityBuilder extends LMFeedActivityBuilderDelegate {
Widget postWidget(BuildContext context) {
return Text('Custom Post Widget');
}
}Pass Custom Style or Setting along with Builder:
final customStyle = LMFeedActivityStyle();
final customSetting = LMFeedActivitySetting();Inject the Custom Builder, Style, or Setting into the Config:
final activityConfig = LMFeedActivityConfig(
builder: CustomActivityBuilder(),
setting: customSetting(),
style: customStyle(),
);Initialize with Custom Config:
LMFeedCore.instance.initialize(
config: LMFeedConfig(
activityConfig: activityConfig,
),
);
6. Summary
The Activity Screen provides a user interface for displaying activity feeds. Developers can customize components like posts, comments, and app bars using the LMFeedActivityBuilderDelegate
. Configuration options are encapsulated in LMFeedActivityConfig
, which allows for seamless integration of customizations tailored to specific design and functional requirements.