Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter app on start it is showing white screen for few second

Why does my Flutter app show a white screen for few seconds on start? How do I solve this issue?

like image 777
WorkingSpace4 Avatar asked May 16 '19 12:05

WorkingSpace4


People also ask

How do I get rid of white screen on flutter app startup?

On the right in the properties, there is the background attribute. Clicking on this and choosing custom will allow you to define the RGB value you'd like the colour of the white screen to now appear as. Running your app on Android and iOS will now no longer show the annoying white screen.

How do I fix a white screen when an app starts?

Open the Settings app and tap Apps & notifications. Find and tap on the app that you think is causing the problem. Tap Storage & cache and then tap Clear cache followed by Clear storage.

How do I get rid of the white screen on flutter Web?

To solve this problem, simply open index. html from the build/web/ folder and edit it. Remove this Line or remove '/' from the href attribute. Now, after removing or editing this line, re-upload the index.


3 Answers

If you see the black window background of the activity showing until Flutter renders its first frame, add this on your AndroidManifest, between < activity> ... < /activity>

<meta-data        android:name="io.flutter.embedding.android.SplashScreenDrawable"    android:resource="@drawable/launch_background" /> 
like image 127
silexcorp Avatar answered Sep 17 '22 00:09

silexcorp


You can use the package flutter_native_splash to add native splash screens for Android and iOS without the manual changes described in other answers.

The package does the manual changes for you.

1 - Depend on it:

dev_dependencies:
  flutter_native_splash: ^0.1.4

And flutter pub get

2 - Configure your splash screen on pubspec.yaml:

    flutter_native_splash:
      image: assets/images/splash.png
      color: 42a5f5

3 - Run the package

flutter pub run flutter_native_splash:create

Splash screens are now generated.

like image 30
Henrique Arthur Avatar answered Sep 18 '22 00:09

Henrique Arthur


Android - Now you can change in

/AndroidStudioProjects/vendowallet/android/app/src/main/res/drawable/launch_background.xml

Something like

<!-- You can insert your own image assets here -->
    <item>
        <bitmap
            android:gravity="center"
            android:src="@mipmap/ic_launcher" />
    </item>

IOS

Change the LaunchImage in Assets.xcassets

like image 26
Álvaro Agüero Avatar answered Sep 20 '22 00:09

Álvaro Agüero