如何在使用jumpTo函数时在pageview中展示平滑过渡?

huangapple go评论94阅读模式
英文:

How to show smooth transition in pageview if jumpTo function id used?

问题

我正在尝试在单击事件中使用 jumpToPage() 来更改当前页面。

但是,它在没有任何动画的情况下突然更改。

过渡的重点是用户不必再次点击下一页,而且如果误点击了复选框,他会知道如果我向上滚动,可以再次更改选项。

英文:

I am trying to change the current page upon click event using jumpToPage().

But, it's changing it very abruptly without any animation.

The point of transition is that the user does not have to click next and plus if clicked on the wrong checkbox then he would know that if I scroll up I can change the option again.

答案1

得分: 1

使用animateToPage:

> 将受控的PageView从当前页面动画到指定页面。
>
> 动画持续指定的持续时间,并遵循指定的曲线。返回的Future在动画完成时解决。

您需要提供持续时间和曲线

https://api.flutter.dev/flutter/widgets/PageController/animateToPage.html

在此处查看所有曲线动画:
https://api.flutter.dev/flutter/animation/Curves-class.html

英文:

Use animateToPage:

>Animates the controlled PageView from the current page to the given page.
>
>The animation lasts for the given duration and follows the given curve. The returned Future resolves when the animation completes.

You have to provide a duration and a curve

https://api.flutter.dev/flutter/widgets/PageController/animateToPage.html

See all the curves animations here:
https://api.flutter.dev/flutter/animation/Curves-class.html

huangapple
  • 本文由 发表于 2020年1月6日 19:27:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/59611302.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定