英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论