提交 696d769b authored 作者: 张国庆's avatar 张国庆

修改列表头配置
上级 e251b9de
...@@ -31,6 +31,9 @@ class BaseListWidget extends StatefulWidget { ...@@ -31,6 +31,9 @@ class BaseListWidget extends StatefulWidget {
class _BaseListWidgetState extends State<BaseListWidget> { class _BaseListWidgetState extends State<BaseListWidget> {
late BaseListController _controller; late BaseListController _controller;
final _MIProperties _headerProperties = _MIProperties(
name: 'Header',
);
final List<dynamic> _dataList = []; final List<dynamic> _dataList = [];
int _page = 1; int _page = 1;
int _count = 0; int _count = 0;
...@@ -129,10 +132,23 @@ class _BaseListWidgetState extends State<BaseListWidget> { ...@@ -129,10 +132,23 @@ class _BaseListWidgetState extends State<BaseListWidget> {
} }
/// Build header. /// Build header.
Header buildHeader() => widget.header ?? EasyRefresh.defaultHeaderBuilder(); Header buildHeader() =>
widget.header ??
MaterialHeader(
clamping: _headerProperties.clamping,
showBezierBackground: _headerProperties.background,
bezierBackgroundAnimation: _headerProperties.animation,
bezierBackgroundBounce: _headerProperties.bounce,
infiniteOffset: _headerProperties.infinite ? 100 : null,
springRebound: _headerProperties.listSpring,
);
/// Build footer. /// Build footer.
Footer buildFooter() => widget.footer ?? EasyRefresh.defaultFooterBuilder(); Footer buildFooter() =>
widget.footer ??
const CupertinoFooter(
position: IndicatorPosition.locator,
);
/// Check if there is no data. /// Check if there is no data.
bool get isEmpty => _count == 0; bool get isEmpty => _count == 0;
...@@ -220,3 +236,17 @@ typedef ErrorCallback = Function(dynamic code, String? msg); ...@@ -220,3 +236,17 @@ typedef ErrorCallback = Function(dynamic code, String? msg);
typedef RequestDataCallback = Function( typedef RequestDataCallback = Function(
int page, int pageSize, SuccessCallback success, ErrorCallback error); int page, int pageSize, SuccessCallback success, ErrorCallback error);
typedef ItemBuilder = Function(BuildContext context, int index, dynamic item); typedef ItemBuilder = Function(BuildContext context, int index, dynamic item);
class _MIProperties {
final String name;
bool clamping = true;
bool background = false;
bool animation = false;
bool bounce = false;
bool infinite = false;
bool listSpring = false;
_MIProperties({
required this.name,
});
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论