https://pub.dev/packages/flutter_easyrefresh
flutter_easyrefresh
提供了一个专门用于自定义header的类:CustomHeader
。
CustomHeader(
headerBuilder: (
BuildContext context,
RefreshMode refreshState,
double pulledExtent,
double refreshTriggerPullDistance,
double refreshIndicatorExtent,
AxisDirection axisDirection,
bool float,
Duration? completeDuration,
bool enableInfiniteRefresh,
bool success,
bool noMore,
) {
final title = refreshState.toString();
return Container(
alignment: Alignment.center,
color: Colors.orange,
width: 100,
height: 50,
child: Text(
title,
style: const TextStyle(fontSize: 20),
),
);
},
),
我们可以根据 refreshState
做不同状态的处理。