當前文章的短網址連結為: https://unos.top/qw37
Flutter Pub
https://pub.dev/packages/flutter_native_splash/
How to use
1.
dependencies: flutter_native_splash: ^0.1.9
2. Execute the command line below
pub get or flutter pub get
3. Config in your pubspec.yaml , add below codes
flutter_native_splash: image: assets/images/splash.png #// 对应生成iOS中LaunchImage图片,包含1x2x3x color: "#FFFFFF" # 闪屏页背景色 android: true # 是否支持android android_disable_fullscreen: false #是否禁用android全屏启动 fill: true #如果图像可用在所有的屏幕上添加为true,目前支持android
4. Generate android or IOS project resources.
flutter pub pub run flutter_native_splash:create
app>flutter pub pub run flutter_native_splash:create [Android] Creating splash images [Android] Updating launch_background.xml with splash image path [Android] No colors.xml file found in your Android project [Android] Creating colors.xml file and adding it to your Android project [Android] Updating styles.xml with full screen mode setting [iOS] Creating splash images [iOS] Updating LaunchScreen.storyboard with width, height and color [iOS] Updating Info.plist for status bar hidden/visible [iOS] Updating AppDelegate for status bar hidden/visible
5. Import namespace in your dart code
import 'package:flutter_native_splash/flutter_native_splash.dart';