PageView中类似Flutter Hero的过渡 [英] Flutter Hero-like transition in PageView

查看:67
本文介绍了PageView中类似Flutter Hero的过渡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PageView的一页中有一张图像.我想在进入该页面时为该图像设置动画,就像在导航器页面过渡中使用Hero动画时一样.有什么想法可以实现吗?

I have an image in one page of the PageView. I want to animate this image to the next page when i go to it, sort of like when you use Hero animations in navigator page transitions. Any ideas how this can be achieved?

推荐答案

此软件包可以满足您的需求 https://pub.dev/packages/coast

This packages does what you want https://pub.dev/packages/coast

它基本上采用与Flutter的Hero和HeroController相同的方法:检测何时开始过渡,在源页面和目标页面的元素树中搜索标记有动画的小部件(英雄,螃蟹),并根据它们进行配对在其标签上,最后在Overlay中创建一个条目,其位置和大小是源页面和目标页面上的内容之间的插值.

It is essentially taking the same approach as Flutter’s Hero and HeroController: Detect when a transition is started, search through the element trees of the source and target pages for the widgets marked for animation (heroes, crabs), pair them up based on their tags, and finally create an entry in an Overlay whose position and size is the interpolation between those on the source and target pages.

这篇关于PageView中类似Flutter Hero的过渡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆