CSInfiniteScrollComponent class
CSInfiniteScrollComponent is a widget that allows you to create a list of items that can be scrolled infinitely.
How to use:
return Scaffold(
appBar: AppBar(
title: Text('CodeScript Components'),
),
body: Center(
child: CSInfiniteScrollComponent(
context: context,
isLoading: false,
loadMore: () async {
await Future.delayed(Duration(seconds: 2));
},
paginationModel: CSPaginationModel(
data: items,
total: 1,
page: 1,
lastPage: 4,
limit: 1,
hasPrevPage: false,
hasNextPage: false),
onRefresh: () async {},
itemBuilder: (context, index) {
return Container(
height: 100,
color: Colors.grey,
child: Center(
child: Text('Item $index'),
),
);
},
),
),
);
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- CSInfiniteScrollComponent
Constructors
-
CSInfiniteScrollComponent({Key? key, required BuildContext context, required bool isLoading, required Function loadMore, required CSPaginationModel paginationModel, Widget emptyImage = const SizedBox(), required Future<
void> onRefresh(), required Widget itemBuilder(BuildContext, int), String noMoreText = 'No more items', Widget? emptyText, Color progressIndicatorColor = Colors.blue, ScrollController? scrollController}) - Creates an CSInfiniteScrollComponent.
Properties
- context → BuildContext
-
The BuildContext of the parent widget.
final
- emptyImage → Widget
-
A widget that is displayed when the list is empty.
final
- emptyText → Widget?
-
A widget that is displayed when there are no more items to load.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isLoading → bool
-
A boolean that determines if the list is loading.
final
- itemBuilder → Widget Function(BuildContext, int)
-
A function that is called to build the list items.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- loadMore → Function
-
A function that is called when the list is scrolled to the bottom.
final
- noMoreText → String
-
A string that is displayed when there are no more items to load.
final
-
onRefresh
→ Future<
void> Function() -
A function that is called when the list is refreshed.
final
- paginationModel → CSPaginationModel
-
A CSPaginationModel that contains the data to be displayed.
final
- progressIndicatorColor → Color
-
The color of the progress indicator.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollController → ScrollController
-
A ScrollController that controls the scrolling of the list.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< CSInfiniteScrollComponent> -
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