xuelongqy / flutter_easy_refresh

A flutter widget that provides pull-down refresh and pull-up load.
https://xuelongqy.github.io/flutter_easy_refresh/
MIT License
3.9k stars 635 forks source link

v3版本有考虑再添加v2版本的BallPulseHeader、BallPulseFooter吗 #689

Closed iotjin closed 1 year ago

iotjin commented 1 year ago

如题,我看v3版本已经废弃了BallPulseHeader和BallPulseFooter,通过BezierHeader使用SpinKitThreeBounce虽然也能实现类似的效果,但是感觉没有v2版本的丝滑,我观察两者效果主要区别在下拉的时候v2版本已经出现动画,v3版本要等到松手时才出现,如果网络请求时间比较短,三个球的动画刚出现可能就消失了,显得比较突兀

下面是v3版本实现类似效果的关键代码:

EasyRefresh(
      controller: _controller,
      header: const BezierHeader(
        triggerOffset: 100,
        backgroundColor: Colors.transparent,
        foregroundColor: Colors.grey,
        clamping: false,
        showBalls: false,
        springRebound: false,
        spinWidget: SpinKitThreeBounce(size: 32, color: Colors.blue),
      ),
      onRefresh: () async => _requestData(),
      onLoad: () async => _requestData(isLoadMore: true),
      child: _listWidget(),
    )

请求完成,得加个延时才不会那么的突兀。

Future.delayed(const Duration(seconds: 2), () {
    _dataArr = tempData;
    _controller.finishRefresh();
    _controller.resetFooter();
 });
xuelongqy commented 1 year ago

实现起来应该不复杂。可以参考v2的源码和BezierBackground结合,如果你有时间提交pr的话,那就更好了

xuelongqy commented 1 year ago

3.3.2+1,可设置onlySpin。如果还有问题,请重新开启此issue