BaseRefreshListState<T, S extends BaseRefreshList> class abstract

  1. 定义了一个泛型类,第一个泛型是列表的数据类型,第二个泛型是继承自BaseRefreshList的类
  2. 定义了一个RefreshController,用于控制刷新和加载更多
  3. 定义了一个items列表,用于存放列表数据
  4. 定义了一个_page变量,用于存放当前页码
  5. 定义了一个inLoading变量,用于判断是否正在加载数据
  6. 在initState方法中,调用了refresh方法,用于初始化列表数据
  7. 定义了一个buildRefreshList方法,用于构建列表,该方法返回一个SmartRefresher组件,该组件包含了列表的刷新和加载更多功能
  8. 定义了一个itemBuilder方法,用于构建列表的item,该方法返回一个buildListItem方法,该方法需要在子类中实现
  9. 定义了一个refresh方法,用于刷新列表数据,该方法调用了loadData方法,该方法需要在子类中实现
  10. 定义了一个loadMore方法,用于加载更多数据,该方法调用了loadData方法,该方法需要在子类中实现
  11. 定义了一个onDataChanged方法,用于刷新或加载更多数据变更
  12. 定义了一个buildEmptyView方法,用于构建空数据布局
Inheritance
Mixed-in types

Constructors

BaseRefreshListState.new()

Properties

context BuildContext
The location in the tree where this widget builds.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
initPage int
latefinal
inLoading bool
getter/setter pair
itemCount int
包含header和footer的列表元素数量 如果showEmptyViewWhenListEmpty=true,即列表数据为空即使有header或footer也展示EmptyView, 当列表为空时实际的itemCount为header+footer+1
no setter
items List<T>
getter/setter pair
mEmptyConfig EmptyConfig?
getter/setter pair
mounted bool
Whether this State object is currently in a tree.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
wantKeepAlive bool
Whether the current instance should be kept alive.
no setteroverride
widget → S
The current configuration.
no setterinherited

Methods

activate() → void
Called when this object is reinserted into the tree after having been removed via deactivate.
inherited
build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
inherited
buildEmptyView(EmptyConfig? config) Widget
空数据布局
buildListItem(BuildContext context, T item, int index) Widget
返回列表Item Widget
buildRefreshList({Key? key, required Widget child, RefreshController? controller, Widget? refreshHeader, Widget? refreshFooter, bool enableRefresh = true, bool enableLoadMore = true, bool enableTwoLevel = false, OnTwoLevel? onTwoLevel, DragStartBehavior? dragStartBehavior, bool? primary, double? cacheExtent, int? semanticChildCount, bool? reverse, ScrollPhysics? physics = const BouncingScrollPhysics(), Axis scrollDirection = Axis.vertical, ScrollController? scrollController, List<Widget> headers = const [], List<Widget> footers = const [], EmptyConfig? emptyConfig}) Widget
See SmartRefresher
deactivate() → void
Called when this object is removed from the tree.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
didChangeDependencies() → void
Called when a dependency of this State object changes.
inherited
didPop(Route route, Route previousRoute) → void
inherited
didPopNext(Route route, Route previousRoute) → void
inherited
didPush() → void
inherited
didPushNext(Route route, Route previousRoute) → void
inherited
didRoutePop(Route route, Route? previousRoute) → void
inherited
didUpdateWidget(covariant S oldWidget) → void
Called whenever the widget configuration changes.
inherited
dispose() → void
Called when this object is removed from the tree permanently.
override
getItem(int index) → T
initState() → void
Called when this object is inserted into the tree.
override
itemBuilder(BuildContext context, int index) Widget
do not override
loadData(int page) Future<List<T>>
分页请求数据 page 分页页码
loadMore(int page) → dynamic
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onDataChanged(List<T> items) → void
刷新或加载更多后数据变更
reassemble() → void
Called whenever the application is reassembled during debugging, for example during hot reload.
override
refresh({bool byUser = true}) → dynamic
setState(VoidCallback fn) → void
Notify the framework that the internal state of this object has changed.
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
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode.
inherited
updateKeepAlive() → void
Ensures that any AutomaticKeepAlive ancestors are in a good state, by firing a KeepAliveNotification or triggering the KeepAliveHandle as appropriate.
inherited

Operators

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