XScrollView<T> class

A reusable, paginated scroll view with first-load, refresh, and retry handling.

The widget owns only its presentation state. Fetch callbacks can call any repository or state-management solution and onItemsChanged can be used to mirror the accumulated items into external state.

Inheritance

Constructors

XScrollView({required XScrollItemBuilder<T> itemBuilder, Key? key, XScrollFetcher<T>? onInit, XScrollFetcher<T>? onLoadMore, ValueChanged<List<T>>? onItemsChanged, XScrollItemTap<T>? onItemTap, List<T> initialItems = const [], bool initialHasMore = true, int pageSize = 20, bool autoLoad = true, bool enableRefresh = true, Axis scrollDirection = Axis.vertical, double refreshTriggerExtent = 80, double paginationThreshold = 200, ScrollController? controller, EdgeInsetsGeometry? padding, ScrollPhysics? physics, SliverGridDelegate? gridDelegate, IndexedWidgetBuilder? separatorBuilder, Widget? header, Widget? footer, WidgetBuilder? loadingBuilder, WidgetBuilder? emptyBuilder, XScrollErrorBuilder? errorBuilder, WidgetBuilder? paginationLoadingBuilder, XScrollErrorBuilder? paginationErrorBuilder, XScrollRefreshIndicatorBuilder? refreshIndicatorBuilder, XScrollRefreshIndicatorBuilder? horizontalRefreshIndicatorBuilder, bool shrinkWrap = false, bool reverse = false, bool? primary, double? cacheExtent, ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual, String? restorationId, Clip clipBehavior = Clip.hardEdge})
const

Properties

autoLoad bool
Whether onInit runs automatically after the first frame.
final
cacheExtent double?
final
clipBehavior Clip
final
controller ScrollController?
final
emptyBuilder WidgetBuilder?
final
enableRefresh bool
Enables pull-to-refresh when onInit is provided.
final
errorBuilder XScrollErrorBuilder?
final
final
gridDelegate SliverGridDelegate?
When supplied, renders items with GridView instead of ListView.
final
hashCode int
The hash code for this object.
no setterinherited
final
horizontalRefreshIndicatorBuilder XScrollRefreshIndicatorBuilder?
Custom indicator used while pulling or refreshing a horizontal list.
final
initialHasMore bool
Initial pagination state, useful when only initialItems are supplied.
final
initialItems List<T>
Items shown before the first fetch completes.
final
itemBuilder XScrollItemBuilder<T>
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keyboardDismissBehavior ScrollViewKeyboardDismissBehavior
final
loadingBuilder WidgetBuilder?
final
onInit XScrollFetcher<T>?
Fetches the first page when the widget is mounted or refreshed.
final
onItemsChanged ValueChanged<List<T>>?
Reports the complete accumulated item list after a successful fetch.
final
onItemTap XScrollItemTap<T>?
final
onLoadMore XScrollFetcher<T>?
Fetches the next page when the remaining scroll extent reaches paginationThreshold.
final
padding EdgeInsetsGeometry?
final
pageSize int
Number of items requested on every first or next-page fetch.
final
paginationErrorBuilder XScrollErrorBuilder?
final
paginationLoadingBuilder WidgetBuilder?
final
paginationThreshold double
Starts loading the next page when this many logical pixels remain.
final
physics ScrollPhysics?
final
primary bool?
final
refreshIndicatorBuilder XScrollRefreshIndicatorBuilder?
Custom indicator used while pulling or refreshing in either direction.
final
refreshTriggerExtent double
Overscroll distance required to trigger a custom refresh.
final
restorationId String?
final
reverse bool
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollDirection Axis
Direction in which the items scroll.
final
separatorBuilder IndexedWidgetBuilder?
final
shrinkWrap bool
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<XScrollView<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