Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

希望可以开放部分参数 #27

Closed
DizzyDuan opened this issue Jan 13, 2022 · 11 comments
Closed

希望可以开放部分参数 #27

DizzyDuan opened this issue Jan 13, 2022 · 11 comments
Labels
help wanted Extra attention is needed

Comments

@DizzyDuan
Copy link

希望可以开放此参数

// When the scroll ends, the duration of the refresh indicator's animation
// to the RefreshIndicator's displacement.
const Duration _kIndicatorSnapDuration = Duration(milliseconds: 150);

有些需求只是下拉放大图片。

现在回弹需要等待该时长。

很怪

@zmtzawqlp
Copy link
Member

这个设置下

@zmtzawqlp zmtzawqlp added the help wanted Extra attention is needed label Jan 13, 2022
@DizzyDuan
Copy link
Author

pullBackDuration是回弹动画的时间

_kIndicatorSnapDuration是下拉后刷新状态下停留的时间

@zmtzawqlp
Copy link
Member

pullBackDuration是回弹动画的时间

_kIndicatorSnapDuration是下拉后刷新状态下停留的时间

刷新状态多久。。跟 onrefresh 多久返回有关系

@DizzyDuan
Copy link
Author

      PullToRefreshNotification(
        onRefresh: () {
          return Future<bool>.delayed(Duration.zero, () {
            return true;
          });
        },
        pullBackOnRefresh: true,
        maxDragOffset: 200,
        pullBackCurve: Curves.linear,
        pullBackDuration: const Duration(milliseconds: 300),
      ),

使用场景不同,我并不是刷新场景,我直接返回了,依然有停留时间。

@zmtzawqlp
Copy link
Member

zmtzawqlp commented Jan 14, 2022

200毫秒?? 你是啥场景??你着急就fork 改下。我并不清楚你这样做的目的

@DizzyDuan
Copy link
Author

      PullToRefreshNotification(
        onRefresh: () {
          return Future<bool>.delayed(Duration.zero, () {
            return true;
          });
        },
        pullBackOnRefresh: true,
        maxDragOffset: 200,
        pullBackCurve: Curves.linear,
        pullBackDuration: const Duration(milliseconds: 300),
        child: PullToRefreshContainer((info) {
          double offset = info?.dragOffset ?? 0;
          return Container(
            width: double.infinity,
            height: 220 + offset,
            color: Colors.red,
          );
        }),
      ),

以上是我的使用场景。
maxDragOffset:下拉最大距离。
pullBackDuration:回弹动画时长。

当我下拉到最大距离后,放手,会有停留时间。

当我修改为,
const Duration _kIndicatorSnapDuration = Duration.zero;

就没有停留时间了。

所以我希望可以开放此参数。

@zmtzawqlp
Copy link
Member

zmtzawqlp commented Jan 14, 2022

那你完全可以不用这个组件呢。。你这个动作都没有刷新效果,你用ios 的物理效果就行了。也没有任何状态可言,把产品打一顿吧

@DizzyDuan
Copy link
Author

WX20220114-105709@2x

可以看_show这个方法,是在执行 animateTo 后才调用了onRefresh

@DizzyDuan
Copy link
Author

NestedScrollView-TabBarView

SliverAppBar-FlexibleSpaceBar-zoomBackground

效果失效

所以很尴尬

@zmtzawqlp
Copy link
Member

zmtzawqlp commented Jan 14, 2022

我的意思是。你可以自己写。这是刷新组件。不是动画组件

@DizzyDuan DizzyDuan reopened this Jan 14, 2022
@DizzyDuan
Copy link
Author

DizzyDuan commented Jan 14, 2022

@zmtzawqlp

我明白您的意思。

单纯以刷新组件来说,onRefresh的返回应该是可以控制停留时长的吧。

如果以测试的角度来看,这会是个BUG。App停留了150毫秒后调用onRefresh,访问后台50毫秒返回数据,总停留了200毫秒,App端不看源码的话会很纳闷,怎么会停留这么长时间。

您觉得呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants