import 'package:flutter/widgets.dart';

class TransparentRoute extends PageRoute<void> {
TransparentRoute({
@required this.builder,
RouteSettings settings,
}) : assert(builder != null),
super(settings: settings, fullscreenDialog: false); final WidgetBuilder builder; @override
bool get opaque => false; @override
Color get barrierColor => null; @override
String get barrierLabel => null; @override
bool get maintainState => true; @override
Duration get transitionDuration => Duration(milliseconds: 350); @override
Widget buildPage(BuildContext context, Animation<double> animation,
Animation<double> secondaryAnimation) {
final result = builder(context);
return FadeTransition(
opacity: Tween<double>(begin: 0, end: 1).animate(animation),
child: Semantics(
scopesRoute: true,
explicitChildNodes: true,
child: result,
),
);
}
}

  

Keep in mind that this would also create a custom transition animation and behave differently than the more complex MaterialPageRoute (e.g. the swipe-back gesture would not work with the current implementation on iOS).

You could use it like this:

Navigator.of(context).push(
TransparentRoute(builder: (BuildContext context) => YourSecondPage())
);

  

For more info on the PageRoute and the different implementers, head over to https://docs.flutter.io/flutter/widgets/PageRoute-class.html

Transparent PageRoute in Flutter for displaying a (semi-) transparent page的更多相关文章

  1. Flutter 多引擎支持 PlatformView 以及线程合并解决方案

    作者:字节移动技术-李皓骅 摘要 本文介绍了 Flutter 多引擎下,使用 PlatformView 场景时不能绕开的一个线程合并问题,以及它最终的解决方案.最终 Pull Request 已经 m ...

  2. How to disable transparent hugepages (THP) on Red Hat Enterprise Linux 7

    How to disable transparent hugepages (THP) on Red Hat Enterprise Linux 7 $ Solution 已验证 - 已更新2017年六月 ...

  3. transparent 透明效果

    background-color:transparent;就是把背景色设置为透明. 实际上background默认的颜色就是透明的属性.所以写和不写都是一样的 span{ width: 0; heig ...

  4. css transparent属性_css 透明颜色transparent的使用

    在css中 transparent到底是什么意思呢? transparent 它代表着全透明黑色,即一个类似rgba(0,0,0,0)这样的值. 例如在css属性中定义:background:tran ...

  5. ElasticSearch 5学习(9)——映射和分析(string类型废弃)

    在ElasticSearch中,存入文档的内容类似于传统数据每个字段一样,都会有一个指定的属性,为了能够把日期字段处理成日期,把数字字段处理成数字,把字符串字段处理成字符串值,Elasticsearc ...

  6. HTML5资料

    1 Canvas教程 <canvas>是一个新的用于通过脚本(通常是JavaScript)绘图的HTML元素.例如,他可以用于绘图.制作图片的组合或者简单的动画(当然并不那么简单).It ...

  7. Configuring HugePages for Oracle on Linux (x86-64)

    Introduction Configuring HugePages Force Oracle to use HugePages (USE_LARGE_PAGES) Disabling Transpa ...

  8. HTML5 Canvas 颜色填充学习

    ---恢复内容开始--- 如果我们想要给图形上色,有两个重要的属性可以做到:fillStyle 和 strokeStyle. fillStyle = color strokeStyle = color ...

  9. ElasticSearch(5)-Mapping

    一.Mapping概述 映射 为了能够把日期字段处理成日期,把数字字段处理成数字,把字符串字段处理成全文本(Full-text)或精确的字符串值,Elasticsearch需要知道每个字段里面都包含了 ...

随机推荐

  1. java.text.DateFormat 线程不安全问题

    java.text下的 DateFormat 是线程不安全的: 建议1: 1.使用threadLocal包装DateFormat(太复杂,不推荐) 2.使用org.apache.commons.lan ...

  2. 让AI简单且强大:深度学习引擎OneFlow技术实践

    本文内容节选自由msup主办的第七届TOP100summit,北京一流科技有限公司首席科学家袁进辉(老师木)分享的<让AI简单且强大:深度学习引擎OneFlow背后的技术实践>实录. 北京 ...

  3. 一、大体认识jspxcms

    声明:jspxcms的license写明,允许将jspxcms用于商业和非商业用途.此处只是作为研究.分享使用心德,并不涉及商用. 使用版本:jspxcms  9.5.0 一.下载源码,并部署到ecl ...

  4. 2017(2)数据库设计,数据库设计过程,ER模型,规范化理论

    试题二(共 25 分〉 阅读以下关于系统数据分析与建模的叙述,在答题纸上回答问题1 至问题 3. [说明] 某软件公司受快递公司委托,拟开发一套快递业务综合管理系统,实现快递单和物流信息的综合管理.项 ...

  5. linux 查看是否安装了MySQL

    yum 安装mysql      yum -y install mysql-server ------------------------------------------------------- ...

  6. 使用AD画PCB的技能总结(纯属个人笔记,请大神多多指导)

    在参加2017全国电子设计大赛的过程中,我将平时学到的点点滴滴记录下来,作为曾经的回忆吧!(未完待续) ------------------------------------------------ ...

  7. 关于eclipse常用的一些快捷键

    Ctrl+Alt+H :查看方法被哪些代码调用了 Ctrl + Shif +O :自动引导类包 Ctrl+Shift+/     : 加上段注释 Ctrl+Shift+\  : 取消段注释 ALT+/ ...

  8. Kafka笔记7(构建数据管道)

    构建数据管道需要考虑的问题: 及时性  可靠性 高吞吐量和动态吞吐量   数据格式  转换    安全性   故障处理能力  耦合性与灵活性 数据管道的构建分为2个阵营,ETL和ELT ETL:提取- ...

  9. TerminateProcess实现关闭任意程序

    #include <Windows.h> #include <tchar.h> int WINAPI _tWinMain(HINSTANCE hInstance, HINSTA ...

  10. 客户端不能连接MySQL - 2003-Can't connect to MySQL server on '192.168.43.180'(10060 "Unknown error")

    客户端不能连接MySQL 场景: 数据库(此处以MySQL为例)安装在虚拟机里面,在宿主机上进行连接数据库的时候始终不能连接,但在虚拟机中使用正常. 针对上面的场景: 1. 在虚拟机里面可以正常使用M ...