Flutter app shows a black screen before loading the app

前端 未结 4 1222
抹茶落季
抹茶落季 2021-02-20 14:28

I have noticed this problem with flutter apps, when I open a flutter app from cold boot, I see a black screen popping before the actual app is loaded. I have seen the problem wi

相关标签:
4条回答
  • 2021-02-20 15:04

    This issue was fixed recently. If you are using a version of Flutter that has this engine fix, you won't see the black frame. (The fix should be on the Flutter master branch by now, but not the alpha branch.)

    0 讨论(0)
  • 2021-02-20 15:11

    It's not a bug. That's the way it behaves normally. You can replace the loading black screen with an image:

    In AndroidManifest.xml, here is where you can change your splash image.

           <meta-data android:name="io.flutter.embedding.android.SplashScreenDrawable" 
    android:resource="@drawable/launch_background" />
    

    Find the files:

    android\app\src\main\res\drawable\launch_background.xml

    android\app\src\main\res\drawable-v21\launch_background.xml

    Change the files to add your own custom image:

    <item>
        <bitmap android:gravity="center" android:src="@drawable/splash_image" />
    </item>
    

    Your splash image should be stored in the drawable folders:

    android\app\src\main\res\drawable\splash_image.png

    app\src\main\res\drawable-v21\splash_image.png

    0 讨论(0)
  • 2021-02-20 15:21
    <meta-data
        android:name="io.flutter.embedding.android.SplashScreenDrawable"
        android:resource="@drawable/my_splash"
        />
    

    AndroidManifest.xml check the FlutterActivity and add this code

    0 讨论(0)
  • 2021-02-20 15:24

    It's not issue, this for hot reload. Don't worry about that. When you run with release, you can't see this.

    if you want to be sure try ->

    flutter run --release

    0 讨论(0)
提交回复
热议问题