White Screen before SplashScreen for no reason - flutter

I am having trouble removing the white screen that appears before my splash screen. I saw many videos and followed their instructions but still, that white screen don't go away. I am a beginner so I don't have much knowledge to solve it, kindly help!
I am using initState to show the splash screen. I have also put my splash image inside the drawable folder and this is how my launch_background.xml file looks like:
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="#android:color/black" />
<!-- You can insert your own image assets here -->
<item>
<bitmap
android:gravity="center"
android:src="#drawable/splash" />
</item>
</layer-list>

Okay, so my problem was solved when I added my splash in styles.xml file:
<item name="android:windowBackground">#drawable/splash</item>

Related

Reduce the size of Image in Splash Screen in Flutter

I have a image which is quite big for Splash Screen. I want to reduce the size of this image but unable to do so. I have read already answers to this question which are here on SO but none of those answers helped. Please help.
launch_background.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" />
<!-- You can insert your own image assets here -->
<item>
<bitmap
android:gravity="center"
android:src="#drawable/bluetoothicon"
android:width="100dp"
android:height="100dp" />
</item>
</layer-list>
Splash Screen
Splash Screen
Bluetooth Image
bluetooth-image
Try this code.
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" />
<item
android:width="200dp"
android:height="200dp"
android:gravity="center">
<bitmap android:src="#drawable/bluetoothicon" />
</item>
</layer-list>
Output

Add a splash screen in flutter

i try to add a splash screen in flutter i place the splash image in drawable folder and update the launch_background.xml but the quality of image is very low as compare to original image.
How to get the original image in the splash
<?xml version="1.0" encoding="utf-8"?><!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="#android:color/white" />
<!-- You can insert your own image assets here -->
<item>
<bitmap
android:gravity="center"
android:src="#drawable/splash" />
</item>
</layer-list>

how to reduce Flutter launch_background.xml display time?

I have set an image in launch_background.xml file for splash screen. it takes around 5sec to switch to next page. how to reduce display time.
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- <item android:drawable="#android:color/white" />-->
<!-- You can insert your own image assets here -->
<item>
<bitmap
android:gravity="center"
android:src="#mipmap/splash_screen" />
</item>
</layer-list>
Please suggest how to reduce display time?
I think you are running app in debug mode so it will take time. I will suggest you run the app in release mode. by running this command in terminal.
flutter run --release
By default, flutter run compiles to debug mode. Your IDE supports this mode. Android Studio, for example, provides a Run > Debug… menu option, as well as a green bug icon overlayed with a small triangle on the project page.
Read more about Flutter's build modes here

Flutter: How to hide the progress circle while login using flutter_facebook_login

I am using the flutter_facebook_login package to login the app. This method shows a login progress bar everytime I login. I want to remove that progress bar and use my own progress indicator.
How can I do that?
I already have a working progress bar and have used it. All i want is to remove the progress indicator of flutter_facebook_plugin.
I used a method where i tweaked the AndroidManifest.xml file. but it didn't work.
AndroidManifest.xml
<activity
android:name="com.facebook.FacebookActivity" android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:theme="#style/LaunchTheme" />
styles.xml
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="LaunchTheme" parent="#android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:progressBarStyle">#style/InvisibleProgress</item>
<item name="android:windowBackground">#drawable/launch_background</item>
</style>
<style name="InvisibleProgress">
<item name="android:visibility">gone</item>
</style>
</resources>
Solution for Android is available here,
works fine for Flutter plugin also
Android: How to hide progress circle in Facebook login

how to let splash page full screen in flutter

how to let the splash page full screen in flutter?
i got how to set splash page in flutter.dev
<resources>
<style name="LaunchTheme" parent="#android:style/Theme.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">#drawable/launch_background</item>
</style>
Inside your Android module go to the app/src/main/res/values
Open up the file name styles.xml
Inside this file you will have a below code that is your custom style:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="#android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">#drawable/launch_background</item>
</style>
</resources>
You need add the below line in it:
<item name="android:windowFullscreen">true</item>
Like Below:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="#android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">#drawable/launch_background</item>
<item name="android:windowFullscreen">true</item>
</style>
</resources>
Once you add the above line app stays in fullscreen mode for the entire life-cycle. To disable it you need to define a normal theme to be applied to FlutterActivity after the launch screen is gone and in that theme add the above line with value "false".
Like Below:
<style name="LaunchTheme" parent="#android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">#drawable/launch_background</item>
<item name="android:windowFullscreen">true</item>
</style>
<style name="NormalTheme" parent="#android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">#drawable/launch_background</item>
<item name="android:windowFullscreen">false</item>
</style>
Put your image inside the drawable folder and call it in src
<item><bitmap android:gravity="center" android:src="#drawable/splash" /> </item>