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. 使用Dubbo的SPI扩展机制实现自定义LoadBalance——方法二 不改源码添加META-INF/dubbo元数据

    一.官网提供的方法 参考官网 http://dubbo.apache.org/zh-cn/docs/dev/impls/load-balance.html 二.方法总结 在工程中创建类并实现LoadB ...

  2. 电子产品使用感受之——我的Mac只有256GB,我的照片库该怎么办?

    说实话我使用过的Mac中最大的默认存储可能就是2011年开始使用的MacBook Pro了,机器型号大概是MC700,这台机器当年自带320GB 5400转机械硬盘,直到2016年因为使用率太高,机械 ...

  3. Android手机camera和IMU的标定

    https://qingsimon.github.io/post/2018-12-28-android%E6%89%8B%E6%9C%BA%E7%9B%B8camera%E5%92%8Cimu%E7% ...

  4. Cassandra数据模型

    Ⅰ.数据模型 1.1 Column 一组包含Name/Value Pair的数据叫Row,其中每一组Name/Value Pair叫Column Column是Cassandra最基本的数据结构,它是 ...

  5. Java 线程池比较

    小结: 1. 高级面试题总结—线程池还能这么玩? - 这个时代,作为程序员可能要学习小程序 - CSDN博客https://blog.csdn.net/androidstarjack/article/ ...

  6. 2018年年度总结 & 2019年计划

      2018关键词 「探索」 引用以前作文最爱写的开头,时间如白驹过隙,回想上次写17年年度总结,仿佛也就过了几日光景.   首先回顾一下17年定下的目标, 18年我将关键字设为探索,目的有两个,一是 ...

  7. linux(centos7)设置tomcat开机启动

    1.在/etc/rc.d/rc.local中加入: #java environment export JAVA_HOME=/usr/java/jdk1.8.0_161 export CLASSPATH ...

  8. JAVA学习笔记 (okHttp3的用法)

    最近的项目中有个接口是返回文件流数据,根据我们这边一个验签的插件,我发现里面有okHttpClient提供了Call.Factory,所以就学习了下okHttp3的用法. 1.概述 okhttp是一个 ...

  9. 安卓系统广播暴露设备信息-Android System Broadcasts Expose Device Information

    Android device details are being exposed to running applications via Wi-Fi broadcasts in the mobile ...

  10. 关于PL/SQL Developer与Oracle客户端

    这是一个很简单的知识点,但这些年遇到过太多初学者反而受其困扰,所以还是决定记录一下. 背景:国内使用Oracle的群体,几乎都会使用PL/SQL Developer这个图形化的工具进行日常数据维护.这 ...