Splash页

  • flutter也可以添加一个SplashPage
void main() {runApp(MyApp());
}class MyApp extends StatelessWidget {// This widget is the root of your application.@overrideWidget build(BuildContext context) {return MaterialApp(title: 'Flutter Demo',home: MySplashPage(),);}
}class MySplashPage extends StatefulWidget {@override_MySplashPageState createState() => _MySplashPageState();
}class _MySplashPageState extends State<MySplashPage> {@overrideWidget build(BuildContext context) {return Container(child: Image(image: AssetImage('images/splash.png'),fit: BoxFit.fill,),);}@overridevoid initState() {// 启动的时候将屏幕设置成全屏模式SystemChrome.setEnabledSystemUIOverlays([]);super.initState();// 这里进行1秒后跳转Timer(Duration(seconds: 1),() => Navigator.of(context).pushReplacement(MaterialPageRoute(builder: (BuildContext context) => MyHomePage())));}@overridevoid dispose() {// 关闭的时候将屏幕设置成原来的状态SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);super.dispose();}
}
  • Android端需要将对应的 launch_background.xml 里添加splash的图片资源
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"><item>全屏显示<bitmap android:gravity="fill" android:src="@drawable/splash" /></item></layer-list>
  • 如果想要在跳转到第一个page的时候也是当前的splash.png 的话 就需要更改另一个配置 styles.xml 文件
<?xml version="1.0" encoding="utf-8"?>
<resources><!-- Theme applied to the Android Window while the process is starting --><style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar"><!-- Show a splash screen on the activity. Automatically removed whenFlutter draws its first frame --><item name="android:windowBackground">@drawable/launch_background</item><item name="android:windowDrawsSystemBarBackgrounds">false</item></style><!-- Theme applied to the Android Window as soon as the process has started.This theme determines the color of the Android Window while yourFlutter UI initializes, as well as behind your Flutter UI while itsrunning.This Theme is only used starting with V2 of Flutter's Android embedding. -->
<!--    正常的状态下也是显示splash一样的状态--><style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar"><item name="android:windowBackground">@drawable/launch_background</item></style>
</resources>

最后官方其实有教程的
官方地址

  • 最后是一些splash相关的的xml编写;
这是主题中的配置
<item name="android:windowBackground">@drawable/launch_background</item>launch_background.xml <?xml version="1.0" encoding="utf-8"?><!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"><!--背景图--><item android:drawable="@drawable/splash_background" /><!--中间显示logo+文案  图片--><item><bitmapandroid:gravity="center"android:src="@drawable/logo_text" /></item></layer-list>

然后需要注意的点是:背景图和 logo 这些都让UI按1080的图片进行切图,
然后我们把这2个图片都放到xxxhdpi的drawable里,这样大小不同的机型都可以显示正常的!!!

Flutter Splash闪屏页相关推荐

  1. 【Android】android开发之splash闪屏页的四种实现方式,启动页的实现教程。

    2019独角兽企业重金招聘Python工程师标准>>> 作者:程序员小冰,GitHub主页: https://github.com/QQ986945193 新浪微博:http://w ...

  2. Android Splash闪屏页秒开 Activity白屏、Activity黑屏问题

    本文转自严振杰的博客: http://blog.csdn.net/yanzhenjie1003 今天在处理项目中闪屏界面的时候,遇到程序第一次开启会出现白屏大约2秒左右,然后再执行闪屏,故找到该篇文章 ...

  3. Flutter 项目的闪屏页方案

    前言 在APP项目中闪屏页(或启动页)的作用是为了解决在程序显示第一帧之前,不要出现白屏的现象,尤其是在纯RN和Flutter的项目里面,资源加载完成到显示的速度会比Native要逊色一些.这里主要总 ...

  4. Flutter——踩坑之旅(iOS闪屏页+启动页 闪屏之后会黑一下才进入启动页)

    程序猿日常 flutter填坑--iOS闪屏页+启动页效果优化 闪屏之后会黑一下进入启动页 问题描述 大部分app都有自己的启动页,我们经常在启动页做一些判断逻辑,例如 是否第一次启动app,第一次启 ...

  5. Flutter 项目在iPhone/苹果手机启动页/闪屏页黑屏问题

    问题很奇怪 不清楚什么原因,有知道的朋友求告知,设置如图一所示的 storyboard 布局文件,就会显示1-2s的黑屏,去掉就可以了,那在 xcode 里面怎么设置开屏页呢,需要在 Info.lis ...

  6. android 闪屏页处理_Android应用闪屏页延迟跳转的三种写法

    闪屏页也称之为欢迎页.在打开一个App时,我们第一眼看到的往往是一个闪屏页面,之所以叫闪屏页,是因为它出现之后会短暂地停留几秒钟再跳转到其他页面.闪屏页除了使用户体验更好外,还能给app留出初始化数据 ...

  7. android 闪屏页处理_一种Android闪屏页实现方法

    为什么会有闪屏页 记得很久之前,那时候android手机才刚刚出来,我们学校工作室里手机游戏开发相关的还更多的是window phone,可能很多人没有见过,就是跟电脑一样有开始菜单那种.那时候工作室 ...

  8. Android闪屏页适配

    Android闪屏页适配 首先,为了避免第一次打开出现白屏,所以应该自定义style,添加anroid:windowBackground属性.此属性下放了一张1080*1920的闪屏图片,会出现在不同 ...

  9. Android 12 SplashScreen(闪屏页)适配

    牢骚(废话) 谷歌真是吃饱了撑的,搞这搞那,Android12新出了一个强制闪屏页,效果就跟小米的闪屏页广告一样,只不过谷歌的是强制的,小米是可选的.不过谷歌再怎么搞,你还是要适配啊,难受. 正题 所 ...

最新文章

  1. 雷军的“初恋”回来了
  2. CentOS7 配置Supervisor开机启动
  3. linux上热编译react,如何使用react进行热加载
  4. 张槎地铁站定位综合枢纽 与多条重要轨道交汇
  5. 前端面试题整理【转】
  6. python求解微分方程_python能解微分方程吗
  7. 强制关机对电脑的影响_强制关机损害电脑?看完秒懂
  8. figsize, dpi参数
  9. ae去闪插件deflicker使用_Ae/Pr视频去闪烁插件REVisionFX DEFlicker v1.7.1 Win大众脸已注册...
  10. 微信小程序页面的基本布局方法——flex布局
  11. 中国有哪些python比赛_有哪些大学生值得参与的竞赛?
  12. 网贷魔爪再次伸向大学生,欠款账号真的能注销吗?
  13. vector详解以及一些问题(C++)
  14. Servlet规范之安全
  15. viper4android+2.6,ViPER4Androi安卓音效驱动
  16. 支付宝,微信付款码正则表
  17. 1、关于百兆口、千兆口、万兆口端口和网线的小常识
  18. android防拷贝防复制,有没有一款可以加密保护u盘防拷贝防复制软件
  19. java实现16支球队分成4组
  20. SketchUp:SketchUp草图大师软件简介、安装、使用方法之详细攻略

热门文章

  1. 音画制作在线html编辑器,在线音画编辑器
  2. 告别纸质化考试,突破地域时间限制,在线考试系统为人事考试带来新变革
  3. js 数字转为科学计数法
  4. python dill包_Python脚本卡在dill.dump()上
  5. 使用vb6.0编写的随机生成双色球中奖号码(预测)
  6. 虚拟机MAC地址的分配与修改
  7. 计算机中的信息表示 ppt模板,第2章 计算机中信息的表示方法.ppt.Convertor
  8. xshell用无线网远程连接linux失败_Linux基础入门 | 服务器集群使用指南
  9. 如何用计算机克数和斤换算,克与斤的换算(克和斤的换算计算器)
  10. java.lang.IllegalArgumentException: Not a managed type: class com.** 解决方案