Flutter插件:flutter_native_splash
配置
#Android12以上没有效果:会出现icon启动图;Android12以下才展示设置的launch背景图
flutter_native_splash:
background_image: "assets/img/launch.png"
fullscreen: true
android: true
ios: true
android_12:
# The image parameter sets the splash screen icon image. If this parameter is not specified,
# the app's launcher icon will be used instead.
# Please note that the splash screen will be clipped to a circle on the center of the screen.
# App icon with an icon background: This should be 960×960 pixels, and fit within a circle
# 640 pixels in diameter.
# App icon without an icon background: This should be 1152×1152 pixels, and fit within a circle
# 768 pixels in diameter.
image: "assets/img/icon/app_punch.png"
# Splash screen background color.
color: "#F0F4FF"
# The branding property allows you to specify an image used as branding in the splash screen.
branding: "assets/img/inc.png"
命令:
生成:flutter pub run flutter_native_splash:create
移除:flutter pub run flutter_native_splash:remove
在Android12以上,该插件不生效,只会显示Android的启动动画画面,没办法显示自己设置的背景图启动页。
具体原因看:官网说明
从 Android 12 开始,在所有应用的冷启动和温启动期间,系统一律会应用 Android 系统的默认启动画面。默认情况下,此系统默认启动画面由应用的启动器图标元素和主题的 windowBackground(如果是单色)构成。