CustomPaginatedListView<T> class
A customizable paginated list view widget with pull-to-refresh, infinite scrolling, and customizable loading and empty states.
This widget is generic and can be used with any data type <T>.
It handles the common boilerplate for displaying lists of data that
are loaded in pages.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- CustomPaginatedListView
Constructors
-
CustomPaginatedListView({Key? key, required int? itemCount, required NullableIndexedWidgetBuilder? itemBuilder, ScrollPhysics physics = const AlwaysScrollableScrollPhysics(), Widget? child, EdgeInsets? padding, dynamic onMaxScrollExtent()?, void onBackInitialScroll()?, Future<
void> onLoadMore()?, bool isLastPage = false, bool wantLoadMore = true, Color? noDataColor, Color? loadColor, bool load = false, Future<void> onRefresh()?, String noDataText = 'No data found', bool reverse = false, double? noDataHeight, bool shrinkWrap = false, EdgeInsets? loaderPadding}) -
CustomPaginatedListView constructor.
const
Properties
- child → Widget?
-
A single child to be displayed. If itemBuilder is provided, this will be ignored.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isLastPage → bool
-
A boolean that indicates if the last page of data has been reached.
This is used to stop triggering onLoadMore and to show the 'All caught up!' message.
final
- itemBuilder → NullableIndexedWidgetBuilder?
-
A builder function that creates the widgets for each item in the list.
final
- itemCount → int?
-
The total number of items in the list.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- load → bool
-
A boolean that indicates if the list is currently in a loading state.
If true, a CustomLoader will be displayed.
final
- loadColor → Color?
-
The color of the initial loading indicator.
final
- loaderPadding → EdgeInsets?
-
The amount of space by which to inset the loader at the bottom of the list.
final
- noDataColor → Color?
-
The color of the noDataText.
final
- noDataHeight → double?
-
The height of the container that is displayed when there is no data.
If not provided, a default height is calculated based on shrinkWrap.
final
- noDataText → String
-
Text to be displayed when the list is empty.
final
- onBackInitialScroll → void Function()?
-
A callback that is triggered when the user scrolls back to the beginning of the list.
A callback function that is triggered when the user scrolls back to the initial scroll position.
final
-
onLoadMore
→ Future<
void> Function()? -
A callback function that is triggered when the user scrolls to the end of the list,
used for loading more data. It should return a
Future<void>.final - onMaxScrollExtent → dynamic Function()?
-
A callback function that is triggered when the user scrolls to the maximum extent.
final
-
onRefresh
→ Future<
void> Function()? -
A callback function that is triggered when the user pulls to refresh the list.
final
- padding → EdgeInsets?
-
The amount of space by which to inset the children.
final
- physics → ScrollPhysics
-
How the scroll view should respond to user input.
final
- reverse → bool
-
Whether the list should scroll in reverse.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shrinkWrap → bool
-
Whether the extent of the scroll view in the
mainAxisshould be determined by the contents being viewed.final - wantLoadMore → bool
-
A boolean that indicates if the load more functionality should be enabled.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< CustomPaginatedListView< T> > -
Creates the mutable state for this widget at a given location in the tree.
override
-
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