AbstractListBuilder<B extends StateStreamableSource<S>, S extends AbstractListState> class

A generic widget for building lists that support state management, pagination, and refresh functionalities.

B - The type of BLoC or Cubit that manages the state of this list. S - The type of state that this BLoC or Cubit provides, extending AbstractListState.

Inheritance

Constructors

AbstractListBuilder.new({Key? key, int columns = 1, double? cacheExtent, double mainAxisSpacing = 0.0, double crossAxisSpacing = 0.0, double childAspectRatio = 1.0, double? mainAxisExtent, EdgeInsetsGeometry? padding, Axis scrollDirection = Axis.vertical, ScrollPhysics? physics, ScrollController? controller, bool enableRefresh = true, bool enableLoadMore = true, bool showCachedDataWarningIcon = true, Widget errorBuilder(BuildContext context, void onInit(), S state)?, Widget noDataBuilder(BuildContext context, void onInit(), S state)?, Widget loaderBuilder(BuildContext context, S state)?, Widget? header, Widget headerBuilder(BuildContext context, S state)?, AbstractScrollBehaviour headerScrollBehaviour = AbstractScrollBehaviour.fixed, bool isLoading(BuildContext context, S state)?, bool isError(BuildContext context, S state)?, int itemCount(BuildContext context, S state)?, Widget separatorBuilder(BuildContext context, S state, int index)?, double heightBuilder(BuildContext context, S state)?, Widget itemBuilder(BuildContext context, S state, int index)?, Widget builder(BuildContext context, S state)?, void listener(BuildContext context, S state)?, void onLoaded(BuildContext context, S state)?, void onLoadedCached(BuildContext context, S state)?, void onError(BuildContext context, S state)?, Widget? footer, Widget footerBuilder(BuildContext context, S state)?, AbstractScrollBehaviour footerScrollBehaviour = AbstractScrollBehaviour.fixed, Widget additionalBuilder(BuildContext context, S state, Widget child)?, void onInit(BuildContext context)?, bool skipInitialOnInit = false, void onRefresh(BuildContext context)?, void onLoadMore(BuildContext context)?, B? providerValue, B provider(BuildContext context)?, List<SingleChildWidget>? providers})
Main constructor for AbstractListBuilder.

Properties

additionalBuilder Widget Function(BuildContext context, S state, Widget child)?
Additional widget builder function for extra customization.
final
builder Widget Function(BuildContext context, S state)?
Function to build the overall content of the list.
final
cacheExtent double?
Cache extent for the scrollable list.
final
childAspectRatio double
The aspect ratio of the children in a grid layout.
final
columns int
Number of columns for grid layouts.
final
controller ScrollController?
Optional scroll controller to control the scroll view.
final
crossAxisSpacing double
Spacing between items in the cross axis (for grids).
final
enableLoadMore bool
Indicates if load more functionality is enabled.
final
enableRefresh bool
Indicates if pull-to-refresh functionality is enabled.
final
errorBuilder Widget Function(BuildContext context, void onInit(), S state)?
Builder function for error state.
final
Optional footer widget.
final
footerBuilder Widget Function(BuildContext context, S state)?
Optional builder function for the footer widget.
final
footerScrollBehaviour AbstractScrollBehaviour
Behavior of the footer scrolling (fixed or scrollable).
final
hashCode int
The hash code for this object.
no setterinherited
Optional header widget.
final
headerBuilder Widget Function(BuildContext context, S state)?
Optional builder function for the header widget.
final
headerScrollBehaviour AbstractScrollBehaviour
Behavior of the header scrolling (fixed or scrollable).
final
heightBuilder double Function(BuildContext context, S state)?
Function to dynamically set item height.
final
isError bool Function(BuildContext context, S state)?
Function to check if an error occurred.
final
isLoading bool Function(BuildContext context, S state)?
Function to check if loading is occurring.
final
itemBuilder Widget Function(BuildContext context, S state, int index)?
Function to build each item in the list.
final
itemCount int Function(BuildContext context, S state)?
Function to get the item count for the list.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
listener → void Function(BuildContext context, S state)?
Listener for changes in the state.
final
loaderBuilder Widget Function(BuildContext context, S state)?
Builder function for loading state.
final
mainAxisExtent double?
The main axis extent for grid items.
final
mainAxisSpacing double
Spacing between items in the main axis (for grids).
final
noDataBuilder Widget Function(BuildContext context, void onInit(), S state)?
Builder function for no data state.
final
onError → void Function(BuildContext context, S state)?
Callback when an error occurs during data loading.
final
onInit → void Function(BuildContext context)?
Callback for initial execution logic.
final
onLoaded → void Function(BuildContext context, S state)?
Callback when data is successfully loaded from the network.
final
onLoadedCached → void Function(BuildContext context, S state)?
Callback when cached data is successfully loaded.
final
onLoadMore → void Function(BuildContext context)?
Callback for loading more data logic.
final
onRefresh → void Function(BuildContext context)?
Callback for pull-to-refresh logic.
final
padding EdgeInsetsGeometry?
Padding for the entire list.
final
physics ScrollPhysics?
Physics to apply to the scroll view.
final
provider → B Function(BuildContext context)?
A function to create a BLoC or Cubit instance.
final
providers List<SingleChildWidget>?
A list of providers to be created using MultiBlocProvider.
final
providerValue → B?
An optional instance of the BLoC or Cubit.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollDirection Axis
The direction of the scrollable list, either vertical or horizontal.
final
separatorBuilder Widget Function(BuildContext context, S state, int index)?
Function to build separator items between list items.
final
showCachedDataWarningIcon bool
Whether to show a warning icon when displaying cached data.
final
skipInitialOnInit bool
Indicates whether to skip the initial call to onInit function.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited