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. dynamic 类型不能访问属性

    x //解决方案ProjectTest.项目A里面public object r(){ ,name = "zf"}; } //解决方案ProjectTest.项目B里面 publi ...

  2. CMC+混频v103测试(scrt,vbs文件)

    Sub Main Dim cnte Dim cnt Dim delay Dim time Dim onetime onetime = 9999999 delay = 5000 time = 700 F ...

  3. SIM7600C读写本机号码

    1 先发送AT+CPBS = "ON",表示要操作的是本机号码区域,而不是SIM的电话本 2 写入命令AT+CPBW=1,"1234567" 3 读取命令AT+ ...

  4. [dev][crypto][strongswan] 有关strongswan的forward policy的源码分析

    一 默认情况下,我们使用strongswan建立了一个ipsec隧道之后,建立的policy如下: [root@D129 OUTPUT]# ip xfrm policy src dst dir pty ...

  5. 关于ico图标

    ico图标可以作为网页标签上显示的小logo,比如: 要获取一个网站的ico图标,只需要在url后输入/favicon.ico即可,比如   https://www.baidu.com/favicon ...

  6. try catch的使用场景

  7. 二、多功能提示框——MBProgressHUD

    概述 (注:图片仅展示部分功能,图片来自github) MBProgressHUD是一个Objective-C开源库,它可以让你在UI界面界面上插入一个透明的方框,伴以文字或进图条等,从而提示一些后台 ...

  8. Java课程02-动手动脑

    1.编写一个方法,生成一千个随机数,纯随机数发生器. package random; public class random { public static void main(String[] ar ...

  9. 《linux就该这么学》第十一节课: 第九章,网卡绑定与sshd服务

    8.4.服务的访问控制列表 TCPwrappers是RHEL7中默认启用的流量监控程序,能够对服务做出允许或拒绝. TCPwrappers服务由两个文件控制:  /etc/hosts.allow    ...

  10. git远程管理