AndroidManifest.xml
设置 android:theme=“@style/LaunchTheme”
<applicationandroid:label="@string/app_name"android:name="${applicationName}"android:icon="@mipmap/ic_launcher"android:roundIcon="@mipmap/ic_launcher"android:theme="@style/LaunchTheme"><activityandroid:name=".MainActivity"android:exported="true"android:launchMode="singleTop"android:taskAffinity=""android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"android:hardwareAccelerated="true"android:windowSoftInputMode="adjustResize"><!-- Specifies an Android theme to apply to this Activity as soon asthe Android process has started. This theme is visible to the userwhile the Flutter UI initializes. After that, this theme continuesto determine the Window background behind the Flutter UI. --><meta-dataandroid:name="io.flutter.embedding.android.NormalTheme"android:resource="@style/NormalTheme"/><intent-filter><action android:name="android.intent.action.MAIN"/><category android:name="android.intent.category.LAUNCHER"/></intent-filter></activity><!-- Don't delete the meta-data below.This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --><meta-dataandroid:name="flutterEmbedding"android:value="2" /></application>
styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources><style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar"><item name="android:windowBackground">@drawable/launch_background</item></style><style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar"><item name="android:windowBackground">?android:colorBackground</item></style>
</resources>
launch_background.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"><item><bitmap android:src="@drawable/launch_image" /></item><itemandroid:width="65dp"android:height="326dp"android:gravity="center_horizontal|clip_vertical"android:top="145dp"><bitmap android:src="@drawable/ver6_bg_word" /></item><itemandroid:width="209dp"android:height="66dp"android:bottom="18dp"android:gravity="bottom|center_horizontal"><bitmap android:src="@drawable/ver6_prod_logo" /></item>
</layer-list
项目结构:
iOS LaunchScreen.storyboard 的使用和适配
修复项目中的警告⚠️
dart fix --apply --code=unused_import
dart fix --apply --code=use_key_in_widget_constructors