Feedroom List Screen
Introduction
The Feedroom List Screen (LMFeedRoomListScreen
) serves as an interface for displaying a list of feedrooms. It supports customization for the app bar, feedroom tiles, and various states like empty views or loading indicators through builders.
1. LMFeedRoomListScreen Widget
File Location:
feedroom_list_screen.dart
Class Declaration
class LMFeedRoomListScreen extends StatefulWidget {
/// Builder for individual feedroom tiles.
final Widget Function()? feedroomTileBuilder;
/// Builder for customizing the app bar.
final LMFeedAppBarBuilder? appBarBuilder;
/// Builder for the empty state view.
final LMFeedContextWidgetBuilder? noItemsFoundIndicatorBuilder;
/// Builder for the first-page loader when no items are present.
final LMFeedContextWidgetBuilder? firstPageProgressIndicatorBuilder;
/// Builder for the pagination loader when more items are being loaded.
final LMFeedContextWidgetBuilder? newPageProgressIndicatorBuilder;
/// Builder for the view when no more items are available.
final LMFeedContextWidgetBuilder? noMoreItemsIndicatorBuilder;
/// Builder for the error view displayed while loading a new page.
final LMFeedContextWidgetBuilder? newPageErrorIndicatorBuilder;
/// A screen widget for displaying a list of feedrooms.
const LMFeedRoomListScreen({
Key? key,
this.feedroomTileBuilder,
this.appBarBuilder,
this.noItemsFoundIndicatorBuilder,
this.firstPageProgressIndicatorBuilder,
this.newPageProgressIndicatorBuilder,
this.noMoreItemsIndicatorBuilder,
this.newPageErrorIndicatorBuilder,
}) : super(key: key);
State<LMFeedRoomListScreen> createState() => _LMFeedRoomListScreenState();
}
Key Parameters
feedroomTileBuilder
(Widget Function()?
): Builder for individual feedroom tiles.appBarBuilder
(LMFeedAppBarBuilder?
): Builder for customizing the app bar.noItemsFoundIndicatorBuilder
(LMFeedContextWidgetBuilder?
): Builder for the empty state view.firstPageProgressIndicatorBuilder
(LMFeedContextWidgetBuilder?
): Builder for the first-page loader when no items are present.newPageProgressIndicatorBuilder
(LMFeedContextWidgetBuilder?
): Builder for the pagination loader when more items are being loaded.
For the complete source code, refer to the GitHub link.
2. LMFeedRoomListBuilderDelegate
File Location:
builder.dart
Class Declaration
class LMFeedRoomListBuilderDelegate extends LMFeedWidgetBuilderDelegate {
const LMFeedRoomListBuilderDelegate();
}
The LMFeedRoomListBuilderDelegate
allows developers to customize the feedroom tiles, empty states, and loaders specifically for the feedroom list screen.
Remaining Methods
Explore the complete list of methods here.
3. LMFeedRoomListSetting
File Location:
settings.dart
class LMFeedRoomListSetting {
const LMFeedRoomListSetting();
}
- Purpose: Provides configuration settings for the Feedroom List Screen. No additional fields or methods are currently defined.
4. LMFeedRoomListStyle
File Location:
style.dart
class LMFeedRoomListStyle {
const LMFeedRoomListStyle();
}
- Purpose: Defines styling options for the Feedroom List Screen. No fields or methods are currently defined.
5. LMFeedRoomListConfig
File Location:
config.dart
Class Declaration
class LMFeedRoomListConfig {
final LMFeedRoomListBuilderDelegate builder;
final LMFeedRoomListSetting setting;
final LMFeedRoomListStyle style;
const LMFeedRoomListConfig({
this.builder = const LMFeedRoomListBuilderDelegate(),
this.setting = const LMFeedRoomListSetting(),
this.style = const LMFeedRoomListStyle(),
});
}
Usage Example: Injecting Custom Configuration
Create a Custom Builder:
class CustomFeedroomListBuilder extends LMFeedRoomListBuilderDelegate {
PreferredSizeWidget appBarBuilder(
BuildContext context,
LMFeedAppBar appBar,
) {
return appBar.copyWith();
}
}Pass Custom Style or Setting along with Builder:
final customStyle = LMFeedRoomListStyle();
final customSetting = LMFeedRoomListSetting();Inject the Custom Builder, Style, or Setting into the Config:
final feedroomListConfig = LMFeedRoomListConfig(
builder: CustomFeedroomListBuilder(),
setting: customSetting,
style: customStyle,
);Initialize with Custom Config:
LMFeedCore.instance.initialize(
config: LMFeedConfig(
feedroomListConfig: feedroomListConfig,
),
);
6. Summary
The Feedroom List Screen provides a user interface for displaying a list of feedrooms. Developers can customize components like tiles, app bars, and empty states using the LMFeedRoomListBuilderDelegate
. Configuration options are encapsulated in LMFeedRoomListConfig
, enabling seamless integration and customization tailored to specific design and functional requirements.