Report Screen
Introduction
The Report Screen (LMFeedReportScreen
) provides an interface for users to report inappropriate content, such as posts, comments, or replies.
1. LMFeedReportScreen Widget
File Location:
report_screen.dart
Class Declaration
class LMFeedReportScreen extends StatefulWidget {
/// The ID of the entity (post, comment, or reply) being reported.
final String entityId;
/// The ID of the user who created the entity being reported.
final String entityCreatorId;
/// The type of the entity being reported (e.g., post, comment, reply).
final int entityType;
/// Builder for report chips.
final Widget Function(BuildContext, LMDeleteReasonViewData)? reportChipBuilder;
/// Builder for report content.
final Widget Function(BuildContext, LMReportContentWidget)? reportContentBuilder;
/// A screen widget for reporting inappropriate content.
const LMFeedReportScreen({
Key? key,
required this.entityId,
required this.entityCreatorId,
required this.entityType,
this.reportChipBuilder,
this.reportContentBuilder,
}) : super(key: key);
State<LMFeedReportScreen> createState() => _LMFeedReportScreenState();
}
Key Parameters
entityId
(String
, required): The ID of the entity (post, comment, or reply) being reported.entityCreatorId
(String
, required): The ID of the user who created the entity being reported.entityType
(int
, required): The type of entity being reported (e.g., post, comment).reportChipBuilder
(Widget Function(BuildContext, LMDeleteReasonViewData)?
): Builder for report chips.reportContentBuilder
(Widget Function(BuildContext, LMReportContentWidget)?
): Builder for report content.
For the complete source code, refer to the GitHub link.
2. LMFeedReportBuilderDelegate
File Location:
builder.dart
Class Declaration
class LMFeedReportBuilderDelegate extends LMFeedWidgetBuilderDelegate {
const LMFeedReportBuilderDelegate();
}
The LMFeedReportBuilderDelegate
allows developers to customize the report chips and report content specifically for the report screen.
Methods in LMFeedReportBuilderDelegate
reportChipBuilder
Definition: Builds the widget for report chips in the report screen.
Purpose: Customizes the style and layout of report chips.Usage Example:
Widget reportChipBuilder(BuildContext context, LMDeleteReasonViewData data) {
// Return a custom widget for displaying report chips
return Chip(
label: Text(data.reason),
);
}reportContentBuilder
Definition: Builds the widget for report content in the report screen.
Purpose: Customizes the appearance and behavior of report content.Usage Example:
Widget reportContentBuilder(BuildContext context, LMReportContentWidget content) {
// Return a custom widget for displaying report content
return ListTile(
title: Text(content.title),
subtitle: Text(content.description),
);
}loaderWidget
Definition: Builds the loader widget for the report 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. LMFeedReportSetting
File Location:
settings.dart
class LMFeedReportSetting {
const LMFeedReportSetting();
}
- Purpose: Provides configuration settings for the Report Screen. No additional fields or methods are currently defined.
4. LMFeedReportStyle
File Location:
style.dart
class LMFeedReportStyle {
const LMFeedReportStyle();
}
- Purpose: Defines styling options for the Report Screen. No fields or methods are currently defined.
5. LMFeedReportConfig
File Location:
config.dart
Class Declaration
class LMFeedReportConfig {
final LMFeedReportBuilderDelegate builder;
final LMFeedReportSetting setting;
final LMFeedReportStyle style;
const LMFeedReportConfig({
this.builder = const LMFeedReportBuilderDelegate(),
this.setting = const LMFeedReportSetting(),
this.style = const LMFeedReportStyle(),
});
}
Usage Example: Injecting Custom Configuration
Create a Custom Builder:
class CustomReportBuilder extends LMFeedReportBuilderDelegate {
Widget reportChipBuilder(BuildContext context, LMDeleteReasonViewData data) {
return Chip(
label: Text(data.reason),
);
}
}Pass Custom Style or Setting along with Builder:
final customStyle = LMFeedReportStyle();
final customSetting = LMFeedReportSetting();Inject the Custom Builder, Style, or Setting into the Config:
final reportConfig = LMFeedReportConfig(
builder: CustomReportBuilder(),
setting: customSetting,
style: customStyle,
);Initialize with Custom Config:
LMFeedCore.instance.initialize(
config: LMFeedConfig(
reportConfig: reportConfig,
),
);
6. Summary
The Report Screen provides a user interface for reporting inappropriate content. Developers can customize components like report chips and report content using the LMFeedReportBuilderDelegate
. Configuration options are encapsulated in LMFeedReportConfig
, enabling seamless integration and customization tailored to specific design and functional requirements.