20个Flutter实例视频教程-第06节: 酷炫的路由动画-2
博客地址:
https://jspang.com/post/flutterDemo.html#toc-94f
视频地址:
https://jspang.com/post/flutterDemo.html#toc-94f
缩放的效果:


import 'package:flutter/material.dart';
class CustomeRoute extends PageRouteBuilder{
final Widget widget;
CustomeRoute(this.widget)
:super(
transitionDuration:Duration(seconds: ),
pageBuilder:(
BuildContext context,
Animation<double> animation1,
Animation<double> animation2,
){
return widget;
},
transitionsBuilder:(
BuildContext context,
Animation<double> animation1,
Animation<double> animation2,
Widget child,
){
//渐隐渐现的路由动画效果
// return FadeTransition(
// opacity: Tween(begin: 0.0,end:1.10)
// .animate(CurvedAnimation(
// parent:animation1,//这里也可以随便传值,默认就是animation1
// curve:Curves.fastOutSlowIn//快出慢进
// )),
// child: child,
// );
//缩放动画效果
return ScaleTransition(
scale: Tween(begin: 0.0,end:1.0).animate(CurvedAnimation(
parent:animation1,
curve:Curves.fastOutSlowIn
)),
child: child,
);
}
);
}
缩放代码
旋转加缩放


import 'package:flutter/material.dart';
class CustomeRoute extends PageRouteBuilder{
final Widget widget;
CustomeRoute(this.widget)
:super(
transitionDuration:Duration(seconds: ),
pageBuilder:(
BuildContext context,
Animation<double> animation1,
Animation<double> animation2,
){
return widget;
},
transitionsBuilder:(
BuildContext context,
Animation<double> animation1,
Animation<double> animation2,
Widget child,
){
//渐隐渐现的路由动画效果
// return FadeTransition(
// opacity: Tween(begin: 0.0,end:1.10)
// .animate(CurvedAnimation(
// parent:animation1,//这里也可以随便传值,默认就是animation1
// curve:Curves.fastOutSlowIn//快出慢进
// )),
// child: child,
// );
//缩放动画效果
// return ScaleTransition(
// scale: Tween(begin: 0.0,end:1.0).animate(CurvedAnimation(
// parent:animation1,
// curve:Curves.fastOutSlowIn
// )),
// child: child,
// );
//旋转+缩放动画效果
return RotationTransition(
turns: Tween(begin: 0.0,end:1.0)
.animate(CurvedAnimation(
parent:animation1,
curve:Curves.fastOutSlowIn
)),
child: ScaleTransition(
scale: Tween(begin: 0.0,end:1.0)
.animate(CurvedAnimation(
parent: animation1,
curve: Curves.fastOutSlowIn
)),
child: child,
),
);
}
);
}
旋转+缩放
左右滑动路由动画


最终代码:
import 'package:flutter/material.dart';
class CustomeRoute extends PageRouteBuilder{
final Widget widget;
CustomeRoute(this.widget)
:super(
transitionDuration:Duration(seconds: ),
pageBuilder:(
BuildContext context,
Animation<double> animation1,
Animation<double> animation2,
){
return widget;
},
transitionsBuilder:(
BuildContext context,
Animation<double> animation1,
Animation<double> animation2,
Widget child,
){
//渐隐渐现的路由动画效果
// return FadeTransition(
// opacity: Tween(begin: 0.0,end:1.10)
// .animate(CurvedAnimation(
// parent:animation1,//这里也可以随便传值,默认就是animation1
// curve:Curves.fastOutSlowIn//快出慢进
// )),
// child: child,
// );
//缩放动画效果
// return ScaleTransition(
// scale: Tween(begin: 0.0,end:1.0).animate(CurvedAnimation(
// parent:animation1,
// curve:Curves.fastOutSlowIn
// )),
// child: child,
// );
//旋转+缩放动画效果
// return RotationTransition(
// turns: Tween(begin: 0.0,end:1.0)
// .animate(CurvedAnimation(
// parent:animation1,
// curve:Curves.fastOutSlowIn
// )),
// child: ScaleTransition(
// scale: Tween(begin: 0.0,end:1.0)
// .animate(CurvedAnimation(
// parent: animation1,
// curve: Curves.fastOutSlowIn
// )),
// child: child,
// ),
// );
//左右滑动动画
return SlideTransition(
position: Tween<Offset>(
begin: Offset(-1.0, 0.0),
end:Offset(0.0, 0.0)
)
.animate(CurvedAnimation(
parent:animation1,
curve:Curves.fastOutSlowIn,
)),
child: child,
);
}
);
}
最终代码
20个Flutter实例视频教程-第06节: 酷炫的路由动画-2的更多相关文章
- 20个Flutter实例视频教程-第05节: 酷炫的路由动画-1
视屏地址: https://www.bilibili.com/video/av39709290/?p=5 博客地址: https://jspang.com/post/flutterDemo.html# ...
- 20个Flutter实例视频教程-第10节: 一个不简单的搜索条-1
20个Flutter实例视频教程-第10节: 一个不简单的搜索条-1 视频地址: https://www.bilibili.com/video/av39709290/?p=10 博客地址: https ...
- 20个Flutter实例视频教程-第13节: 展开闭合案例
20个Flutter实例视频教程-第13节: 展开闭合案例 视频地址: https://www.bilibili.com/video/av39709290/?p=13 博客地址: https://js ...
- 20个Flutter实例视频教程-第03节: 不规则底部工具栏制作-1
第03节: 不规则底部工具栏制作-1 博客地址: https://jspang.com/post/flutterDemo.html#toc-973 视频地址: https://www.bilibili ...
- 20个Flutter实例视频教程-第02节: 底部导航栏制作-2
视频地址: https://www.bilibili.com/video/av39709290?p=2 博客地址: https://jspang.com/post/flutterDemo.html#t ...
- 20个Flutter实例视频教程-第04节: 不规则底部工具栏制作-2
视频地址: https://www.bilibili.com/video/av39709290/?p=4 博客地址: https://jspang.com/post/flutterDemo.html# ...
- 20个Flutter实例视频教程-第07节: 毛玻璃效果制作
视频地址: https://www.bilibili.com/video/av39709290/?p=7 博客地址: https://jspang.com/post/flutterDemo.html# ...
- 20个Flutter实例视频教程-第08节: 保持页面状态
博客地址: https://jspang.com/post/flutterDemo.html#toc-bb9 视频地址: https://www.bilibili.com/video/av397092 ...
- 20个Flutter实例视频教程-第09节: 保持页面状态-2
视频地址:https://www.bilibili.com/video/av39709290/?p=9 博客地址:https://jspang.com/post/flutterDemo.html#to ...
随机推荐
- yum安装nginx+PHP+Mysql
#mkdir /var/www/yum_repo 1.nginx安装: 在http://nginx.org/en/linux_packages.html#stable中下载CentOSX对应版本的rp ...
- 【网络协议】TCP的流量控制机制
一般来说,我们总是希望传输数据的更快一些,但假设发送方把数据发送的非常快.而接收方来不及接收,这就可能造成数据的丢失.流量控制就是让发送方的发送速率不要太快.让接收方来得及接收. 对于成块数据流,TC ...
- 区分拖曳(drag)和点击(click)事件
假设页面上有一个a标签: <a href="http://www.google.com">google</a> 现在需要对这个标签进行拖放操作,会发现当拖曳 ...
- HDU 5296 Annoying problem LCA+树状数组
题解链接 Annoying problem Time Limit: 16000/8000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/O ...
- 继承的文本框控件怎么响应EN_CHANGE等消息
继承的文本框控件如何响应EN_CHANGE等消息?我从CEdit继承了一个CMyEdit类,想在这个类里填写它的一些消息.我在消息映射表里写的是MESSAGE_HANDLER(EN_CHANGE, O ...
- IOS-RSA加解密分享
本文转载至 http://www.cocoachina.com/bbs/read.php?tid=235527 搜索了很多资料,没找到合适的RSA方法,很多人在问这问题,解决了的同志也不分享, ...
- 超实用的 Nginx 极简教程,覆盖了常用场景(转)
概述 安装与使用 安装 使用 nginx 配置实战 http 反向代理配置 负载均衡配置 网站有多个 webapp 的配置 https 反向代理配置 静态站点配置 搭建文件服务器 跨域解决方案 参考 ...
- OpenMeetings安装
OpenMeetings是一个开源的视频会议软件. 它是基于OpenLaszlo’s的新流媒体格式和开源的Flash服务器---Red5! 采用了flash流媒体服务器Red5+OpenMeeting ...
- 使用官方Android-support-v7在低版本上使用ActionBarActivity
昨天晚上更新了下Android SDK Manager,发现Extras下的Android Support Library已经更新到19.1了,上网一查原来是sdk\extras\android\su ...
- Linux-VMware三种网络模式
虚拟机网络模式 对于VMware虚拟软件来说,有三种网络模式 1.桥接 2.NAT 3.Host-only 桥接 桥接网络是指本地物理网卡和虚拟网卡通过VMnet0虚拟交换机进行桥接,因此物理网卡和虚 ...